2
# gccopts.sh Shell script for configuring MEX-file creation script,
3
# mex. These options were tested with gcc 3.2.3.
5
# usage: Do not call this file directly; it is sourced by the
6
# mex shell script. Modify only if you don't like the
7
# defaults after running mex. No spaces are allowed
8
# around the '=' in the variable assignment.
10
# Note: only the gcc side of this script was tested.
11
# The FORTRAN variables are lifted directly from
12
# mexopts.sh; use that file for compiling FORTRAN
15
# Note: For the version of system compiler supported with this release,
16
# refer to Technical Note 1601 at:
17
# http://www.mathworks.com/support/tech-notes/1600/1601.html
20
# SELECTION_TAGs occur in template option files and are used by MATLAB
21
# tools, such as mex and mbuild, to determine the purpose of the contents
22
# of an option file. These tags are only interpreted when preceded by '#'
23
# and followed by ':'.
25
#SELECTION_TAG_MEX_OPT: Template Options file for building gcc MEX-files
27
# Copyright 1984-2004 The MathWorks, Inc.
28
# $Revision: 1.43.4.7 $ $Date: 2006/03/10 00:42:26 $
29
#----------------------------------------------------------------------------
33
if [ "$ENTRYPOINT" = "mexLibrary" ]; then
34
MLIBS="-L$TMW_ROOT/bin/$Arch -lmx -lmex -lmat -lmwservices -lut -lm"
36
MLIBS="-L$TMW_ROOT/bin/$Arch -lmx -lmex -lmat -lm"
40
#----------------------------------------------------------------------------
41
# Change this line if you need to specify the location of the MATLAB
42
# root directory. The script needs to know where to find utility
43
# routines so that it can determine the architecture; therefore, this
44
# assignment needs to be done while the architecture is still
46
#----------------------------------------------------------------------------
49
# Determine the location of the GCC libraries
51
GCC_LIBDIR=`gcc -v 2>&1 | awk '/.*Reading specs.*/ {print substr($4,0,length($4)-6)}'`
54
#----------------------------------------------------------------------------
55
RPATH="-Wl,-rpath-link,$TMW_ROOT/bin/$Arch"
57
CFLAGS='-O3 -Xcompiler "-fPIC -D_GNU_SOURCE -pthread -fexceptions -m32"'
58
CLIBS="$RPATH $MLIBS -lm -lstdc++"
59
COPTIMFLAGS='-Xcompiler "-O3 -funroll-loops -msse2 -DNDEBUG"'
63
CXXFLAGS='-fPIC -D_GNU_SOURCE -pthread '
64
CXXLIBS="$RPATH $MLIBS -lm"
65
CXXOPTIMFLAGS='-O -DNDEBUG'
68
# NOTE: g77 is not thread safe
70
FFLAGS='-fPIC -fexceptions'
71
FLIBS="$RPATH $MLIBS -lm -lstdc++"
77
LDFLAGS='-pthread -shared -m32 -Wl,--version-script,$TMW_ROOT/extern/lib/$Arch/$MAPFILE'
82
#----------------------------------------------------------------------------
85
#----------------------------------------------------------------------------
86
RPATH="-Wl,-rpath-link,$TMW_ROOT/bin/$Arch"
88
CFLAGS='-O3 -Xcompiler "-fPIC -D_GNU_SOURCE -pthread -fexceptions -m64"'
89
CLIBS="$RPATH $MLIBS -lm -lstdc++"
90
COPTIMFLAGS='-Xcompiler "-O3 -funroll-loops -msse2 -DNDEBUG"'
94
CXXFLAGS='-fPIC -fno-omit-frame-pointer -ansi -D_GNU_SOURCE -pthread '
95
CXXLIBS="$RPATH $MLIBS -lm"
96
CXXOPTIMFLAGS='-O -DNDEBUG'
99
# NOTE: g77 is not thread safe
101
FFLAGS='-fPIC -fno-omit-frame-pointer -fexceptions'
102
FLIBS="$RPATH $MLIBS -lm -lstdc++"
107
LDEXTENSION='.mexa64'
108
LDFLAGS="-pthread -shared -Wl,--version-script,$TMW_ROOT/extern/lib/$Arch/$MAPFILE"
113
#----------------------------------------------------------------------------
116
#----------------------------------------------------------------------------
118
GCC_LIBDIR=`$CC -v 2>&1 | sed -n '1s/[^\/]*\(.*\/lib\).*/\1/p'`
119
CFLAGS='-fPIC -fexceptions'
121
COPTIMFLAGS='-O -DNDEBUG'
128
CXXOPTIMFLAGS='-O -DNDEBUG'
131
LDEXTENSION='.mexsol'
132
LDFLAGS="-shared -Wl,-M,$TMW_ROOT/extern/lib/$Arch/$MAPFILE,-R,$GCC_LIBDIR"
137
#----------------------------------------------------------------------------
140
#----------------------------------------------------------------------------
142
CFLAGS='-fno-common -no-cpp-precomp -fexceptions'
143
CLIBS="$MLIBS -lstdc++"
144
COPTIMFLAGS='-O3 -DNDEBUG'
148
CXXFLAGS='-fno-common -no-cpp-precomp -fexceptions'
149
CXXLIBS="$MLIBS -lstdc++"
150
CXXOPTIMFLAGS='-O3 -DNDEBUG'
154
LDEXTENSION='.mexmac'
155
LDFLAGS="-bundle -Wl,-flat_namespace -undefined suppress -Wl,-exported_symbols_list,$TMW_ROOT/extern/lib/$Arch/$MAPFILE"
160
#----------------------------------------------------------------------------
163
#----------------------------------------------------------------------------
165
CFLAGS='-O3 -Xcompiler "-fPIC -D_GNU_SOURCE -pthread -fno-common -no-cpp-precomp -fexceptions -m32"'
166
CLIBS="$MLIBS -lm -lstdc++"
167
COPTIMFLAGS='-Xcompiler "-O3 -funroll-loops -msse2 -DNDEBUG"'
172
CXXFLAGS='-fno-common -no-cpp-precomp -fexceptions'
173
CXXLIBS="$MLIBS -lstdc++"
174
CXXOPTIMFLAGS='-O3 -DNDEBUG'
178
LDEXTENSION='.mexmaci'
179
LDFLAGS="-bundle -Wl,-flat_namespace -undefined suppress -Wl,-exported_symbols_list,$TMW_ROOT/extern/lib/$Arch/$MAPFILE"
184
#----------------------------------------------------------------------------
188
#############################################################################
190
# Architecture independent lines:
192
# Set and uncomment any lines which will apply to all architectures.
194
#----------------------------------------------------------------------------
197
# COPTIMFLAGS="$COPTIMFLAGS"
198
# CDEBUGFLAGS="$CDEBUGFLAGS"
203
# LDOPTIMFLAGS="$LDOPTIMFLAGS"
204
# LDDEBUGFLAGS="$LDDEBUGFLAGS"
205
#----------------------------------------------------------------------------
206
#############################################################################