mttrc 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. #! /bin/sh
  2. ######################################
  3. ##### Model Transformation Tools #####
  4. ######################################
  5. # Bourne shell script: mttrc - sets up paths etc for mtt
  6. # Usage: mttrc
  7. # Copyright (c) P.J.Gawthrop 1996,1977.
  8. ###############################################################
  9. ## Version control history
  10. ###############################################################
  11. ## $Id$
  12. ## $Log$
  13. ## Revision 1.45 2009/06/26 01:08:49 geraint
  14. ## Octave load path no longer accepts trailing // as recursive.
  15. ## Path is now calculated using find, which is much quicker than Octave's genpath()
  16. ##
  17. ## Revision 1.44 2006/04/25 23:24:29 geraint
  18. ## Reverted to simple g++ for MTT_CXX. Trying to force the version causes library problems.
  19. ##
  20. ## Revision 1.43 2006/02/09 23:49:40 geraint
  21. ## added rtxi build flags
  22. ##
  23. ## Revision 1.42 2005/11/16 00:43:15 geraint
  24. ## rtxi
  25. ##
  26. ## Revision 1.41 2004/02/17 17:53:34 geraint
  27. ## Fixed [ 898739 ] libhdf5 dependency breaks -cc reps.
  28. ## Now uses mkoctfile to determine include and library flags.
  29. ##
  30. ## Revision 1.40 2003/09/23 15:57:18 gawthrop
  31. ## And back to gv
  32. ##
  33. ## Revision 1.39 2003/09/22 17:38:56 gawthrop
  34. ## gv --> ghostview
  35. ##
  36. ## Revision 1.38 2003/07/13 21:53:24 geraint
  37. ## Updated to conform to latest Octave (tested with 2.1.49).
  38. ## - the pathsearch library was merged into liboctave last year
  39. ## - static_cast no longer seems to work between Matrix and ColumnVector
  40. ##
  41. ## Revision 1.37 2002/09/19 08:08:15 gawthrop
  42. ## Updated documentation documentation
  43. ##
  44. ## Revision 1.36 2002/08/28 15:48:00 geraint
  45. ## Updated mttrc to make standalone C++ compilation configuration clearer.
  46. ##
  47. ## Revision 1.35 2002/08/06 09:56:54 geraint
  48. ## Updated to work with changes in unstable version of Octave 2.1.36.
  49. ## Tested with 2.0.17 (ok) but will break earlier unstables (2.1.(<=35)).
  50. ##
  51. ## Revision 1.34 2002/05/08 14:51:03 geraint
  52. ## Moved matlab/octave data type conversion functions to a separate file.
  53. ##
  54. ## Revision 1.33 2002/05/08 11:39:36 gawthrop
  55. ## Added MTT_REP to PATH
  56. ##
  57. ## Revision 1.32 2002/05/07 23:50:34 geraint
  58. ## Preliminary support for Matlab dynamically linked shared objects:
  59. ## invoke with: mtt -cc sys rep mexglx
  60. ## ode2odes support is not yet included.
  61. ##
  62. ## Revision 1.31 2002/05/02 20:12:45 geraint
  63. ## Added -Wl,--rpath to MTT_CXXLIBS. Sets the runtime linker path so that the
  64. ## sys-admin does not have to ldconfig the octave directory for -cc to work.
  65. ##
  66. ## Revision 1.30 2002/05/02 11:10:11 geraint
  67. ## s/loctave/loctinterp/
  68. ##
  69. ## Revision 1.29 2002/05/02 11:03:46 geraint
  70. ## Reinstated -liboctinterp and -lncurses; needed by xleftdiv.
  71. ##
  72. ## Revision 1.28 2002/05/01 12:21:29 geraint
  73. ## No longer uses save_ascii_data_for_plotting function to write data
  74. ## - eliminates dependence on liboctinterp (and libncurses) for .cc.
  75. ##
  76. ## Revision 1.27 2002/04/28 18:41:26 geraint
  77. ## Fixed [ 549658 ] awk should be gawk.
  78. ## Replaced calls to awk with call to gawk.
  79. ##
  80. ## Revision 1.26 2002/04/26 16:16:33 geraint
  81. ## Removed unnecessary variables PLAT and GCCVERS.
  82. ##
  83. ## Revision 1.25 2002/04/02 09:16:39 geraint
  84. ## Tidied up library search paths, now assumes that system libraries are set up correctly.
  85. ## For Debian, this means installing the following: blas-dev, fftw-dev, lapack-dev, libncurses5-dev, libkpathsea-dev, libreadline-dev
  86. ## It may also be necessary to run /sbin/ldconfig on the relevant directories (especially Octave's).
  87. ##
  88. ## Revision 1.24 2001/10/15 14:28:35 gawthrop
  89. ## Now has . at start of components library path $MTT_COMPONENTS
  90. ##
  91. ## Revision 1.23 2001/07/24 22:32:49 gawthrop
  92. ## Use gv, not ghostview
  93. ##
  94. ## Revision 1.22 2001/04/12 03:08:00 geraint
  95. ## Improved sh->csh conversion, reduces environment namespace pollution.
  96. ## Still need to do proper if [ -z $MTT_BASE ] ... else ... fi conversion.
  97. ##
  98. ## Revision 1.21 2001/04/10 13:56:13 gawthrop
  99. ## Uses standard mkoctfile
  100. ##
  101. ## Revision 1.20 2001/04/10 13:08:19 gawthrop
  102. ## Smoother translation to .cs using sh2csh
  103. ##
  104. ## Revision 1.19 2001/03/30 15:13:49 gawthrop
  105. ## Rationalised simulation modes to each return mtt_data
  106. ##
  107. ## Revision 1.18 2001/03/19 02:28:52 geraint
  108. ## Branch merge: merging-ode2odes-exe back to MAIN.
  109. ##
  110. ## Revision 1.17.2.4 2001/03/06 03:48:43 geraint
  111. ## Print additional environment variable for "mtt -p".
  112. ## MTT_LDFLAGS defaults to " " to avoid installation warning.
  113. ##
  114. ## Revision 1.17.2.3 2001/03/01 05:05:53 geraint
  115. ## Minor revisions.
  116. ##
  117. ## Revision 1.17.2.2 2001/02/23 03:53:53 geraint
  118. ## Minor revisions. (ode2odes.exe works on GNU/Linux and ~GNU/Irix)
  119. ##
  120. ## Revision 1.17.2.1 2001/02/22 06:41:40 geraint
  121. ## Initial merge of ode2odes.exe into main mtt.
  122. ## standalone_rep.make deleted: rules moved to mtt, variables to mttrc.
  123. ##
  124. ## Revision 1.17 2000/12/27 16:46:13 peterg
  125. ## Stripped the mtt- from paths
  126. ##
  127. ## Revision 1.16 2000/12/27 15:16:44 peterg
  128. ## If then else format
  129. ##
  130. ## Revision 1.15 2000/12/27 14:57:43 peterg
  131. ## Now takes the base path as an argument
  132. ##
  133. ## Revision 1.14 2000/12/27 13:11:43 peterg
  134. ## *** empty log message ***
  135. ##
  136. ## Revision 1.13 2000/10/03 12:12:14 peterg
  137. ## New path structure to account for three way split in mtt tree
  138. ##
  139. ## Revision 1.12 2000/09/18 12:17:07 peterg
  140. ## Now includes to control system toolbox in OCTAVE_PATH
  141. ## Don't use -path stuff - use :: instead.
  142. ##
  143. ## Revision 1.11 2000/05/21 17:55:15 peterg
  144. ## New rep path
  145. ##
  146. ## Revision 1.10 2000/05/16 11:41:23 peterg
  147. ## *** empty log message ***
  148. ##
  149. ## Revision 1.9 1999/03/11 04:02:19 peterg
  150. ## Revised so that sh2csh does its stuff.
  151. ##
  152. ## Revision 1.8 1998/07/17 19:48:46 peterg
  153. ## *** empty log message ***
  154. ##
  155. ## Revision 1.7 1998/03/24 09:11:49 peterg
  156. ## Compatible with .csh version
  157. ##
  158. ## Revision 1.6 1998/03/13 11:53:29 peterg
  159. ## reduce --> reduce 64
  160. ##
  161. ## Revision 1.5 1998/01/16 08:55:01 peterg
  162. ## MAKE=make
  163. ##
  164. ## Revision 1.4 1998/01/06 09:14:51 peterg
  165. ## Added latex2html to setup
  166. ##
  167. # Revision 1.3 1998/01/06 09:11:26 peterg
  168. # Removed matlab from the setup
  169. #
  170. # Revision 1.2 1997/12/04 10:49:16 peterg
  171. # Put under RCS at last
  172. # Added CC variable
  173. #
  174. ###############################################################
  175. ## When using csh, replace $1 by the mtt base path, eg /usr/share/mtt/latest
  176. export MTT_BASE=$1
  177. if [ -z "$MTT_BASE" ]; then
  178. echo mttrc requires one argument: eg mttrc /usr/share/mtt/latest
  179. else
  180. echo Setting paths with base $MTT_BASE
  181. # The following line sets up the make to use -- gmake is the standard
  182. # but you may wish to use lsmake for parallelism
  183. export MAKE='make'
  184. # The following sets up the c compiler
  185. export CC='gcc'
  186. # Setup the paths
  187. export MTTPATH=$MTT_BASE/bin
  188. export MTT_LIB=$MTT_BASE/lib
  189. export MTT_DOC=$MTT_BASE/doc
  190. export MTT_CC=$MTT_BASE/cc
  191. export MTT_COMPONENTS=.:$MTT_LIB/comp
  192. export MTT_CRS=$MTT_LIB/cr
  193. export MTT_EXAMPLES=$MTT_LIB/examples
  194. export MTT_REP=$MTT_LIB/rep
  195. export PATH=$PATH\:$MTTPATH\:$MTTPATH/trans\:$MTT_CC\:$MTT_REP
  196. #Setup octave
  197. ##<<<<<<< mttrc
  198. ## export MATRIX_PATH=$MTTPATH/trans/m/
  199. ## export MATRIX_PATH=$MATRIX_PATH\:$MTT_LIB/comp/simple/
  200. ## export MATRIX_PATH=$MATRIX_PATH\:$MTT_LIB/control/
  201. ## export MATRIX_PATH=$MATRIX_PATH\:$MTT_LIB/octave/\:\:
  202. ##=======
  203. MATRIX="octave"
  204. #MATRIX_PATH1=$(echo "genpath('$MTTPATH/trans/m')" |$MATRIX -q | awk '{print $3}')
  205. #MATRIX_PATH2=$(echo "genpath('$MTT_LIB/comp/simple')" |$MATRIX -q | awk '{print $3}')
  206. #MATRIX_PATH3=$(echo "genpath('$MTT_LIB/control')" |$MATRIX -q | awk '{print $3}')
  207. #MATRIX_PATH4=$(echo "genpath('$MTT_LIB/octave')" |$MATRIX -q | awk '{print $3}')
  208. #export MATRIX_PATH=$MATRIX_PATH1:$MATRIX_PATH2:$MATRIX_PATH3:$MATRIX_PATH4
  209. MATRIX_PATH1=$(find $MTTPATH/trans/m -type d|grep -v CVS|awk '{printf ":%s", $0}')
  210. MATRIX_PATH2=$(find $MTT_LIB/comp/simple -type d|grep -v CVS|awk '{printf ":%s", $0}')
  211. MATRIX_PATH3=$(find $MTT_LIB/control -type d|grep -v CVS|awk '{printf ":%s", $0}')
  212. MATRIX_PATH4=$(find $MTT_LIB/octave -type d|grep -v CVS|awk '{printf ":%s", $0}')
  213. export MATRIX_PATH=$MATRIX_PATH1:$MATRIX_PATH2:$MATRIX_PATH3:$MATRIX_PATH4
  214. ##>>>>>>> 1.45
  215. export OCTAVE_PATH=.\:$MATRIX_PATH
  216. ##<<<<<<< mttrc
  217. export MATRIX="octave --path $OCTAVE_PATH"
  218. ##=======
  219. ## export MATRIX="$MATRIX --path $OCTAVE_PATH"
  220. ##>>>>>>> 1.45
  221. # Setup the symbolic stuff
  222. ##export SYMBOLIC='reduce 64'
  223. export SYMBOLIC='reduce -w'
  224. # Setup xfig
  225. export FIG="xfig \
  226. -startfontsize 20 \
  227. -metric \
  228. -portrait \
  229. -startgridmode 2 \
  230. -pheight 21 \
  231. -pwidth 30 \
  232. -library_dir $MTT_LIB/xfig/\
  233. "
  234. # Setup ps viewer
  235. export PSVIEW='evince'
  236. # Setup pdf viewer
  237. export PDFVIEW='acroread'
  238. # Setup html viewer
  239. export HTMLVIEW='firefox'
  240. # Setup dvi viewer
  241. export DVIVIEW='xdvi'
  242. # Setup latex2html
  243. export LATEX2HTML="latex2html -contents_in_navigation -index_in_navigation -address http://mtt.sourceforge.net"
  244. # Ascend stuff
  245. export ASCENDLIBRARY=$MTTPATH/ascend/lib
  246. # Oct file generation - use version with no optimisation.
  247. #export MKOCTFILE=$MTT_LIB/octave/mkoctfile # This for no optimisation
  248. export MKOCTFILE=mkoctfile
  249. #########################################################################################
  250. ##
  251. ## Configure environment for standalone compilation of files linked with Octave libraries
  252. ## (required for ode2odes.exe only)
  253. # location of Octave directories on local system (usually /usr, /usr/local or /opt)
  254. OCTAVEPREFIX="/usr"
  255. # include paths for Octave
  256. IOCTAVE="-I${OCTAVEPREFIX}/include/octave/ -I${OCTAVEPREFIX}/include/octave/octave"
  257. # include and library paths for Octave
  258. if [ -z `which ${MKOCTFILE}` ]; then
  259. # Octave development stuff not installed
  260. # C++ and .oct representations will not work
  261. OCTAVE_INC_FLAGS=" "
  262. OCTAVE_LIB_FLAGS=" "
  263. else
  264. OCTAVE_INC_FLAGS="`${MKOCTFILE} --print INCFLAGS`"
  265. OCTAVE_LIB_FLAGS="\
  266. `${MKOCTFILE} --print LFLAGS` \
  267. `${MKOCTFILE} --print LIBOCTAVE` \
  268. `${MKOCTFILE} --print LIBCRUFT` \
  269. `${MKOCTFILE} --print LIBOCTINTERP` \
  270. `${MKOCTFILE} --print BLAS_LIBS` \
  271. `${MKOCTFILE} --print FFTW_LIBS` \
  272. `${MKOCTFILE} --print LIBS` \
  273. `${MKOCTFILE} --print FLIBS` \
  274. `${MKOCTFILE} --print RLD_FLAG`"
  275. fi
  276. # C++ compiler options
  277. DEBUG="-g"
  278. OPTIM="-O3"
  279. FLAGS="-fno-rtti -fno-exceptions -fno-implicit-templates"
  280. # exported variables
  281. export MTT_CXX="g++"
  282. export MTT_CXXFLAGS="${DEBUG} ${OPTIM} ${FLAGS}"
  283. export MTT_CXXLIBS="${OCTAVE_LIB_FLAGS}"
  284. export MTT_CXXINCS="-I. -I${MTT_LIB}/cc ${OCTAVE_INC_FLAGS}"
  285. export MTT_LDFLAGS=" "
  286. ## End of Octave environment configuration
  287. ##
  288. #########################################################################################
  289. ############################################################
  290. ##
  291. ## Configure environment for compilation of Matlab mex files
  292. MATLAB_ARCH="glnx86"
  293. MATLAB_ROOT="/usr/local/matlab6p1"
  294. MATLAB_FLAGS="-shared -fPIC -ansi -D_GNU_SOURCE -pthread"
  295. MATLAB_INCS="-I${MATLAB_ROOT}/extern/include"
  296. MATLAB_LIBS="-Wl,--rpath-link,${MATLAB_ROOT}/extern/lib/${MATLAB_ARCH},--rpath-link,${MATLAB_ROOT}/bin/${MATLAB_ARCH} -L${MATLAB_ROOT}/bin/${MATLAB_ARCH} -lmx -lmex -lm"
  297. # exported variables
  298. export MTT_MATLAB_FLAGS="${MATLAB_FLAGS} ${MATLAB_INCS} ${MATLAB_LIBS}"
  299. ## End of Matlab environment configuration
  300. ##
  301. #############################################################
  302. #######################################################
  303. ##
  304. ## Configure environment for compilation of RTXI module
  305. ##<<<<<<< mttrc
  306. ## RTXI_INCS="-I/usr/local/src/mtt/rtxi/rtxi_cvs_30Sep05/include -I/usr/include/qt3 -I/home/peterg/Development/rtxi/include"
  307. # MORE_RTXI_INCS="-I/usr/realtime/include -I/usr/src/linux/include"
  308. ##=======
  309. ROOT="/usr/local/rtxi-knoppix"
  310. RTXI_LIBTOOL="${ROOT}/usr/local/lib/rtxi/libtool"
  311. RTXI_CXX="g++-3.3"
  312. RTXI_CXXLD="g++-3.3"
  313. RTXI_CXXCOMPILE="${RTXI_LIBTOOL} --mode=compile --tag CXX ${RTXI_CXX}"
  314. RTXI_CXXLINK="${RTXI_LIBTOOL} --mode=link --tag CXX ${RTXI_CXXLD}"
  315. RTXI_INCS=""
  316. RTXI_INCS="${RTXI_INCS} -I${ROOT}/usr/share/qt3/include"
  317. RTXI_INCS="${RTXI_INCS} -I."
  318. RTXI_INCS="${RTXI_INCS} -I${ROOT}/usr/realtime/include"
  319. RTXI_INCS="${RTXI_INCS} -I${ROOT}/usr/share/qt3/include"
  320. RTXI_INCS="${RTXI_INCS} -I${ROOT}/usr/src/comedi/include"
  321. RTXI_INCS="${RTXI_INCS} -I${ROOT}/usr/src/rtxi/include"
  322. RTXI_DEFS="-D_REENTRANT -DQT_THREAD_SUPPORT"
  323. RTXI_CXXFLAGS="-g -O2 ${RTXI_INCS} ${RTXI_DEFS}"
  324. RTXI_LIBS="-L${ROOT}/usr/share/qt3/lib -lqt-mt"
  325. ##>>>>>>> 1.45
  326. RTXI_FLAGS="-DHAVE_CONFIG_H -D_REENTRANT -DQT_THREAD_SUPPORT"
  327. RTXI_LDFLAGS="-L${ROOT}/usr/realtime/lib -lpthread -module -avoid-version"
  328. RTXI_RPATH="${ROOT}/usr/local/lib/rtxi/models/"
  329. export MTT_RTXI_CXXCOMPILE="${RTXI_CXXCOMPILE}"
  330. export MTT_RTXI_CXXLINK="${RTXI_CXXLINK}"
  331. export MTT_RTXI_LIBTOOL="${RTXI_LIBTOOL}"
  332. export MTT_RTXI_CXXFLAGS="${RTXI_CXXFLAGS}"
  333. export MTT_RTXI_LIBS="${RTXI_LIBS}"
  334. export MTT_RTXI_FLAGS="${RTXI_RTXI_FLAGS}"
  335. export MTT_RTXI_LDFLAGS="${RTXI_LDFLAGS}"
  336. export MTT_RTXI_RPATH="${RTXI_RPATH}"
  337. ## End of RTXI environment configuration
  338. ##
  339. #############################################################
  340. fi