-
Notifications
You must be signed in to change notification settings - Fork 1
/
gccopts.sh
executable file
·256 lines (256 loc) · 9.11 KB
/
gccopts.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
#
# gccopts.sh Shell script for configuring MEX-file creation script,
# mex.
#
# usage: Do not call this file directly; it is sourced by the
# mex shell script. Modify only if you don't like the
# defaults after running mex. No spaces are allowed
# around the '=' in the variable assignment.
#
# Note: only the gcc side of this script was tested.
# The FORTRAN variables are lifted directly from
# mexopts.sh; use that file for compiling FORTRAN
# MEX-files.
#
# SELECTION_TAGs occur in template option files and are used by MATLAB
# tools, such as mex and mbuild, to determine the purpose of the contents
# of an option file. These tags are only interpreted when preceded by '#'
# and followed by ':'.
#
#SELECTION_TAG_MEX_OPT: Template Options file for building gcc MEX-files
#
# Copyright 1984-2000 The MathWorks, Inc.
# $Revision: 1.38 $ $Date: 2000/08/07 15:50:31 $
#----------------------------------------------------------------------------
#
case "$Arch" in
Undetermined)
#----------------------------------------------------------------------------
# Change this line if you need to specify the location of the MATLAB
# root directory. The cmex script needs to know where to find utility
# routines so that it can determine the architecture; therefore, this
# assignment needs to be done while the architecture is still
# undetermined.
#----------------------------------------------------------------------------
MATLAB="$MATLAB"
#
# Determine the location of the GCC libraries
#
GCC_LIBDIR=`gcc -v 2>&1 | awk '/.*Reading specs.*/ {print substr($4,0,length($4)-6)}'`
;;
alpha)
#----------------------------------------------------------------------------
#
# gcc version 2.8.1
#
CC='gcc'
CFLAGS='-mieee'
CLIBS="-L$GCC_LIBDIR -lmx -lgcc"
COPTIMFLAGS='-O -DNDEBUG'
CDEBUGFLAGS='-g'
#
FC='f77'
FFLAGS='-shared'
FLIBS='-L$MATLAB/bin/$Arch -lmx -lUfor -lfor -lFutil'
FOPTIMFLAGS='-O'
FDEBUGFLAGS='-g'
#
LD='ld'
LDFLAGS="-L$MATLAB/bin/$Arch -expect_unresolved '*' -shared -hidden -exported_symbol $ENTRYPOINT -exported_symbol mexVersion"
LDOPTIMFLAGS=''
LDDEBUGFLAGS=''
#----------------------------------------------------------------------------
;;
hpux)
#----------------------------------------------------------------------------
#
# gcc version 2.7.2.f.1
#
#----------------------------------------------------------------------------
# Note: The GNU assembler does not fully support PIC. From the Info
# documentation:
#
# The GNU assembler does not fully support PIC. Currently, you must
# use some other assembler in order for PIC to work. We would
# welcome volunteers to upgrade GAS to handle this; the first part
# of the job is to figure out what the assembler must do differently.
#
# PIC is necessary for building shared libraries. Therefore, we need to
# use the HP assembler.
#----------------------------------------------------------------------------
echo ''
echo 'Warning: Assembly code generated by gcc may not compile'
echo 'with the HP assembler'
echo ''
CC='gcc'
CFLAGS='-fPIC -mpa-risc-1-0 -D_POSIX_C_SOURCE=199506L -B/usr/ccs/bin/ -mno-gas'
CLIBS="-L$GCC_LIBDIR -lmx -lgcc"
COPTIMFLAGS='-O -DNDEBUG'
CDEBUGFLAGS='-g'
#
FC='f90'
FFLAGS='+z'
FLIBS="-L$MATLAB/bin/$Arch -lmx"
FOPTIMFLAGS='-O'
FDEBUGFLAGS='-g'
#
LD='ld'
LDFLAGS="-L$MATLAB/bin/$Arch -b +e $ENTRYPOINT +e mexVersion"
LDOPTIMFLAGS=''
LDDEBUGFLAGS=''
#----------------------------------------------------------------------------
;;
hp700)
#----------------------------------------------------------------------------
#
# gcc version 2.7.2.f.1
#
#----------------------------------------------------------------------------
# Note: The GNU assembler does not fully support PIC. From the Info
# documentation:
#
# The GNU assembler does not fully support PIC. Currently, you must
# use some other assembler in order for PIC to work. We would
# welcome volunteers to upgrade GAS to handle this; the first part
# of the job is to figure out what the assembler must do differently.
#
# PIC is necessary for building shared libraries. Therefore, we need to
# use the HP assembler.
#----------------------------------------------------------------------------
echo ''
echo 'Warning: Assembly code generated by gcc may not compile'
echo 'with the HP assembler'
echo ''
CC='gcc'
CFLAGS='-fPIC -mpa-risc-1-0 -D_HPUX_SOURCE -B/usr/ccs/bin/ -mno-gas'
CLIBS="-L$GCC_LIBDIR -lmx -lgcc"
COPTIMFLAGS='-O -DNDEBUG'
CDEBUGFLAGS='-g'
#
FC='f90'
FFLAGS='+z'
FLIBS="-L$MATLAB/bin/$Arch -lmx"
FOPTIMFLAGS='-O'
FDEBUGFLAGS='-g'
#
LD='ld'
LDFLAGS="-L$MATLAB/bin/$Arch -b +e $ENTRYPOINT +e mexVersion"
LDOPTIMFLAGS=''
LDDEBUGFLAGS=''
#----------------------------------------------------------------------------
;;
ibm_rs)
#----------------------------------------------------------------------------
#
# gcc version 2.7.2.f.1
#
CC='gcc'
CFLAGS=''
CLIBS="-L$MATLAB/bin/$Arch -lmatlbmx -lmx -lmex -lm"
COPTIMFLAGS='-O -DNDEBUG'
CDEBUGFLAGS='-g'
#
FC='f77'
FFLAGS=''
FLIBS="-L$MATLAB/bin/$Arch -lmx -lmex $MATLAB/extern/lib/ibm_rs/fmex1.o -lm"
FOPTIMFLAGS='-O'
FDEBUGFLAGS='-g'
#
LD='gcc'
LDFLAGS="-L$MATLAB/bin/$Arch -shared -B/usr/bin/ -Wl,-e$ENTRYPOINT,-bM:SRE,-bI:$MATLAB/extern/lib/ibm_rs/exp.ibm_rs,-bE:$MATLAB/extern/lib/ibm_rs/$MAPFILE"
LDOPTIMFLAGS='-Wl,-s'
LDDEBUGFLAGS=''
#----------------------------------------------------------------------------
;;
glnx86)
#----------------------------------------------------------------------------
CC='gcc'
CFLAGS='-fPIC'
CLIBS='-lmx'
COPTIMFLAGS='-O -DNDEBUG'
CDEBUGFLAGS='-g'
#
FC='g77'
FFLAGS='-fPIC'
FLIBS='-L$MATLAB/bin/$Arch -lmx -lf2c'
FOPTIMFLAGS='-O'
FDEBUGFLAGS='-g'
#
LD=$CC
LDFLAGS='-L$MATLAB/bin/$Arch -shared'
LDOPTIMFLAGS=''
LDDEBUGFLAGS=''
#----------------------------------------------------------------------------
;;
sgi)
#----------------------------------------------------------------------------
#
# gcc version 2.95.1
#
CC='gcc'
CFLAGS=''
CLIBS="-L$GCC_LIBDIR -lmx -lgcc"
COPTIMFLAGS='-O -DNDEBUG'
CDEBUGFLAGS='-g'
#
FC='f77'
FFLAGS=''
FLIBS='-L$MATLAB/bin/$Arch -lmx'
FOPTIMFLAGS='-O'
FDEBUGFLAGS='-g'
#
LD='ld'
LDFLAGS="-L$MATLAB/bin/$Arch -shared -exported_symbol $ENTRYPOINT -exported_symbol mexVersion"
LDOPTIMFLAGS=''
LDDEBUGFLAGS=''
#----------------------------------------------------------------------------
;;
sol2)
#----------------------------------------------------------------------------
#
# gcc version 2.7.2.f.1
#
CC='gcc'
CFLAGS='-fPIC'
CLIBS="-L$GCC_LIBDIR -lmx -lgcc"
COPTIMFLAGS='-O -DNDEBUG'
CDEBUGFLAGS='-g'
#
FC='f77'
FFLAGS='-G'
FLIBS='-L$MATLAB/bin/$Arch -lmx'
FOPTIMFLAGS='-O'
FDEBUGFLAGS='-g'
#
LD='/usr/ccs/bin/ld'
LDFLAGS="-L$MATLAB/bin/$Arch -G -M $MATLAB/extern/lib/sol2/$MAPFILE"
LDOPTIMFLAGS=''
LDDEBUGFLAGS=''
#----------------------------------------------------------------------------
;;
esac
#############################################################################
#
# Architecture independent lines:
#
# Set and uncomment any lines which will apply to all architectures.
#
#----------------------------------------------------------------------------
# CC="$CC"
# CFLAGS="$CFLAGS"
# COPTIMFLAGS="$COPTIMFLAGS"
# CDEBUGFLAGS="$CDEBUGFLAGS"
# CLIBS="$CLIBS"
#
# FC="$FC"
# FFLAGS="$FFLAGS"
# FOPTIMFLAGS="$FOPTIMFLAGS"
# FDEBUGFLAGS="$FDEBUGFLAGS"
# FLIBS="$FLIBS"
#
# LD="$LD"
# LDFLAGS="$LDFLAGS"
# LDOPTIMFLAGS="$LDOPTIMFLAGS"
# LDDEBUGFLAGS="$LDDEBUGFLAGS"
#----------------------------------------------------------------------------
#############################################################################