#
# mbuildopts.sh Shell script for configuring mbuild, the C/C++ stand alone 
#		applications creation script.
#
# usage:        Do not call this file directly; it is sourced by the
#               mbuild shell script.  Modify only if you don't like the
#               defaults after running mbuild.  No spaces are allowed
#               around the '=' in the variable assignment.
#
# 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_ML_OPT: Build and link with MATLAB C/C++ Math Library
#
# Copyright 1984-2000 The MathWorks, Inc.
# $Revision: 1.45 $  $Date: 2000/06/13 14:41:49 $
#----------------------------------------------------------------------------
#
    case "$Arch" in
        Undetermined)
#----------------------------------------------------------------------------
# Change this line if you need to specify the location of the TMW_ROOT
# root directory.  The mbuild 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.
#----------------------------------------------------------------------------
            TMW_ROOT="$TMW_ROOT"
            ;;
        alpha)
#----------------------------------------------------------------------------
#
# Alpha C compiler options
#		
            CC='cc'
            CFLAGS="-I$TMW_ROOT/extern/include -ieee"
            CLIBS="-L$TMW_ROOT/extern/lib/$Arch $OTHER_LIBS -lmmfile -lmatlb -lmat -lmx -lm"
            COPTIMFLAGS='-O -DNDEBUG'
	    CDEBUGFLAGS='-g'
#
            SHLCFLAGS="$CFLAGS"
#           
# Alpha C++ compiler options
#
            CPP=cxx
            CPPFLAGS="-I$TMW_ROOT/extern/include/cpp -I$TMW_ROOT/extern/include -x cxx -std1 -DALPHA  -DUNIX -Olimit 5000 -ieee"
            CPPLIBS="-L$TMW_ROOT/extern/lib/$Arch $OTHER_LIBS -lmatpp -lmmfile -lmatlb -lmat -lmx -lots -lm"
            CPPOPTIMFLAGS='-O -DNDEBUG'
            CPPDEBUGFLAGS='-g'
            CPPLDFLAGS=''
#
            LD="$COMPILER"
            LDFLAGS='-L$TMW_ROOT/extern/lib/$Arch -L$TMW_ROOT/bin/$Arch'
	    LDOPTIMFLAGS=''
	    LDDEBUGFLAGS=''
#
            SHLLD='ld'
            SHLLDFLAGS="-L$TMW_ROOT/extern/lib/$Arch -L$TMW_ROOT/bin/$Arch -shared -expect_unresolved \* -hidden \`cat $EXPFILE\`"
            SHLMAKEDEF="awk '{printf \"-exported_symbol %s\\n\", \$0;}'"
#----------------------------------------------------------------------------
            ;;
        hpux)
#----------------------------------------------------------------------------
#
# HP C compiler flags
#		
            CC='cc'
#
# -Wp,-H65535 - works around a compiler limitation so we can compile the
#               MEX version of standalone/compiler/messages.c
#
            CFLAGS="-Wp,-H65535 -Ae -I$TMW_ROOT/extern/include"
            CLIBS="-L$TMW_ROOT/extern/lib/$Arch $OTHER_LIBS -lmmfile -lmatlb -lmat -lmx -lm"
	    COPTIMFLAGS='-O -DNDEBUG'
	    CDEBUGFLAGS='-g'
#
# -Wp,-H65535 - works around a compiler limitation so we can compile the
#               MEX version of standalone/compiler/messages.c
#
            SHLCFLAGS="+z -D_POSIX_C_SOURCE=199506L -Wp,-H65535 -Ae -I$TMW_ROOT/extern/include"
#           
# HP C++ compiler flags
#
            CPP='aCC'
            CPPFLAGS="+d -I$TMW_ROOT/extern/include/cpp -I$TMW_ROOT/extern/include -D_POSIX_C_SOURCE=199506L -DHPUX -DUNIX"
            CPPLIBS="-L$TMW_ROOT/extern/lib/$Arch $OTHER_LIBS -lmatpp -lmmfile -lmatlb -lmat -lmx -lm"
            CPPOPTIMFLAGS='-O -DNDEBUG'
            CPPDEBUGFLAGS='-g'
            CPPLDFLAGS="-I$TMW_ROOT/extern/include/cpp -I$TMW_ROOT/extern/include -D_POSIX_C_SOURCE=199506L -DHPUX -DUNIX"
#
            LD="$COMPILER"
            LDFLAGS='-L$TMW_ROOT/extern/lib/$Arch -L$TMW_ROOT/bin/$Arch'
	    LDOPTIMFLAGS=''
	    LDDEBUGFLAGS=''
#
            SHLLD='ld'
            SHLLDFLAGS="-L$TMW_ROOT/extern/lib/$Arch -L$TMW_ROOT/bin/$Arch -b -c $EXPFILE"
            SHLMAKEDEF="awk '{printf \"+e %s\\n\", \$0;}'"
#----------------------------------------------------------------------------
            ;;
        hp700)
#----------------------------------------------------------------------------
#
# HP C compiler flags
#		
            CC='cc'
#
# -Wp,-H65535 - works around a compiler limitation so we can compile the
#               MEX version of standalone/compiler/messages.c
# +DAportable - remove from CFLAGS if you wish to optimize for target machine
#
            CFLAGS="-Wp,-H65535 -Ae -I$TMW_ROOT/extern/include +DAportable"
            CLIBS="-L$TMW_ROOT/extern/lib/$Arch $OTHER_LIBS -lmmfile -lmatlb -lmat -lmx -lm"
	    COPTIMFLAGS='-O -DNDEBUG'
	    CDEBUGFLAGS='-g'
#
# -Wp,-H65535 - works around a compiler limitation so we can compile the
#               MEX version of standalone/compiler/messages.c
# +DAportable - remove from SHLCFLAGS if you wish to optimize for target machine
#
            SHLCFLAGS="+z -D_HPUX_SOURCE -Wp,-H65535 -Ae +DAportable -I$TMW_ROOT/extern/include"
#           
# HP C++ compiler flags
#
            CPP='aCC'
#
# +DAportable - remove from CPPFLAGS if you wish to optimize for target machine
#
            CPPFLAGS="+d -I$TMW_ROOT/extern/include/cpp -I$TMW_ROOT/extern/include -D_HPUX_SOURCE -DHP700 -DUNIX +DAportable"
            CPPLIBS="-L$TMW_ROOT/extern/lib/$Arch $OTHER_LIBS -lmatpp -lmmfile -lmatlb -lmat -lmx -lm"
            CPPOPTIMFLAGS='-O -DNDEBUG'
            CPPDEBUGFLAGS='-g'
#
# +DAportable - remove from CPPLDFLAGS if you wish to optimize for target machine
#
            CPPLDFLAGS="-I$TMW_ROOT/extern/include/cpp -I$TMW_ROOT/extern/include -D_HPUX_SOURCE -DHP700 -DUNIX +DAportable"
#
            LD="$COMPILER"
            LDFLAGS='-L$TMW_ROOT/extern/lib/$Arch -L$TMW_ROOT/bin/$Arch'
	    LDOPTIMFLAGS=''
	    LDDEBUGFLAGS=''
#
            SHLLD='ld'
            SHLLDFLAGS="-L$TMW_ROOT/extern/lib/$Arch -L$TMW_ROOT/bin/$Arch -b -c $EXPFILE"
            SHLMAKEDEF="awk '{printf \"+e %s\\n\", \$0;}'"
#----------------------------------------------------------------------------
            ;;
        ibm_rs)
#----------------------------------------------------------------------------
#
# IBM RS/6000 C compiler flags
#		
            CC='cc'
            CFLAGS="-I$TMW_ROOT/extern/include -DIBM_RS"
            CLIBS="-L$TMW_ROOT/extern/lib/$Arch $OTHER_LIBS -lmatpp -lmmfile -lmatlb -lmat -lmx -lm"
	    COPTIMFLAGS='-O -DNDEBUG'
	    CDEBUGFLAGS='-g'
#
            SHLCFLAGS="$CFLAGS"
#           
# IBM RS/6000 C++ compiler flags
#
            CPP='xlC'
            CPPFLAGS="-I$TMW_ROOT/extern/include/cpp -I$TMW_ROOT/extern/include -+ -Q -qfloat=nomaf -qlanglvl=ansi -qspill=2048 -D_ALL_SOURCE -DIBM_RS -DUNIX"
            CPPLIBS="-L$TMW_ROOT/extern/lib/$Arch $OTHER_LIBS -lmatpp -lmmfile  -lmatlb -lmat -lmx -lm"
            CPPOPTIMFLAGS='-O -DNDEBUG'
            CPPDEBUGFLAGS='-g'
            CPPLDFLAGS=''
#
            LD="$COMPILER"
            LDFLAGS='-L$TMW_ROOT/extern/lib/$Arch -L$TMW_ROOT/bin/$Arch'
            LDOPTIMFLAGS=''
	    LDDEBUGFLAGS=''
#
            SHLLD="$LD"                                                  
            SHLLDFLAGS="-L$TMW_ROOT/extern/lib/$Arch -L$TMW_ROOT/bin/$Arch -bE:$EXPFILE -bM:SRE -bnoentry"
            SHLMAKEDEF="cat"
#----------------------------------------------------------------------------
            ;;
        glnx86)
#----------------------------------------------------------------------------
            RPATH="-Wl,--rpath-link,$TMW_ROOT/bin/$Arch"
#
# Linux C compiler flags
#		
            CC='gcc'
            CFLAGS="-ansi -D_GNU_SOURCE -I$TMW_ROOT/extern/include"
            CLIBS="-L$TMW_ROOT/extern/lib/$Arch $OTHER_LIBS -lmmfile -lmatlb -lmat -lmx -lm"
	    COPTIMFLAGS='-O -DNDEBUG'
	    CDEBUGFLAGS='-g'
#
            SHLCFLAGS="-fPIC $CFLAGS"
#           
# Linux C++ compiler flags
#
            CPP='g++'
            CPPFLAGS="-I$TMW_ROOT/extern/include/cpp -I$TMW_ROOT/extern/include -DGLNX86 -DGCC -DUNIX -x c++"
            CPPLIBS="$RPATH -L$TMW_ROOT/extern/lib/$Arch $OTHER_LIBS -lmatpp -lmmfile -lmatlb -lmat -lmx -lm"
            CPPOPTIMFLAGS='-DNDEBUG'
            CPPDEBUGFLAGS='-g'
            CPPLDFLAGS=''
#
            LD="$COMPILER"
            LDFLAGS="$RPATH -L$TMW_ROOT/extern/lib/$Arch -L$TMW_ROOT/bin/$Arch"
            LDOPTIMFLAGS="$RPATH -L$TMW_ROOT/bin/$Arch"
            LDDEBUGFLAGS="$RPATH -L$TMW_ROOT/bin/$Arch"
# 
            SHLLD="$LD"
            SHLLDFLAGS="$RPATH -shared -L$TMW_ROOT/extern/lib/$Arch -L$TMW_ROOT/bin/$Arch"
            SHLMAKEDEF="cat"
#----------------------------------------------------------------------------
            ;;
        sgi)
#----------------------------------------------------------------------------
#
# SGI C compiler flags
#		
            CC='cc'
            CFLAGS="-I$TMW_ROOT/extern/include -n32 -mips3"
            CLIBS="-L$TMW_ROOT/extern/lib/$Arch $OTHER_LIBS -lmmfile -lmatlb -lmat -lmx -lm"
	    COPTIMFLAGS='-O -DNDEBUG'
	    CDEBUGFLAGS='-g'
#
            SHLCFLAGS="$CFLAGS"
#           
# SGI C++ compiler flags
#
            CPP='CC'
            CPPFLAGS="-I$TMW_ROOT/extern/include/cpp -I$TMW_ROOT/extern/include -DSGI -DUNIX -n32 -mips3 -woff 3262 -exceptions -INLINE:none"
            CPPLIBS="-L$TMW_ROOT/extern/lib/$Arch $OTHER_LIBS -lmatpp -lmmfile -lmatlb -lmat -lmx -lm"
            CPPOPTIMFLAGS='-O1 Olimit 7000 -DNDEBUG'
            CPPDEBUGFLAGS='-g'
            CPPLDFLAGS='-Wl,-woff,85 -exceptions'
#
            LD="$COMPILER"
            LDFLAGS='-L$TMW_ROOT/extern/lib/$Arch -L$TMW_ROOT/bin/$Arch'
	    LDOPTIMFLAGS=''
	    LDDEBUGFLAGS=''
# 
            SHLLD='ld'
            SHLLDFLAGS="-shared -exports_file $EXPFILE -L$TMW_ROOT/extern/lib/$Arch -L$TMW_ROOT/bin/$Arch"
            SHLMAKEDEF="cat"
#----------------------------------------------------------------------------
            ;;
        sol2)
#----------------------------------------------------------------------------
#
# Solaris C compiler flags
#
            CC='cc'
            CFLAGS="-I$TMW_ROOT/extern/include"
            CLIBS="-L$TMW_ROOT/extern/lib/$Arch $OTHER_LIBS -lmmfile -lmatlb -lmat -lmx -lm"
	    COPTIMFLAGS='-O -DNDEBUG'
	    CDEBUGFLAGS='-g'
#
            SHLCFLAGS="-dalign -KPIC -I$TMW_ROOT/extern/include"
#           
# Solaris C++ compiler flags                                     
#
            CPP='CC'
            CCV=`CC -V 2>&1`
            version=`expr "$CCV" : '.*\([0-9][0-9]*\)\.'`
            if [ "$version" = "4" ]; then
                    echo "SC5.0 or later C++ compiler is required"
            fi
            CPPFLAGS="-I$TMW_ROOT/extern/include/cpp -I$TMW_ROOT/extern/include -DSOL2 -DUNIX -DX11 +d"
            CPPLIBS="-L$TMW_ROOT/extern/lib/$Arch $OTHER_LIBS -lmatpp -lmmfile -lmatlb -lmat -lmx -lnsl -lm"
            CPPOPTIMFLAGS='-DNDEBUG -O3'
            CPPDEBUGFLAGS='-g'
            CPPLDFLAGS=''
#
            LD="$COMPILER"
            LDFLAGS='-L$TMW_ROOT/extern/lib/$Arch -L$TMW_ROOT/bin/$Arch'
	    LDOPTIMFLAGS=''
	    LDDEBUGFLAGS=''
#
            SHLLD=$LD
            SHLLDFLAGS="-G -M $EXPFILE -L$TMW_ROOT/extern/lib/$Arch -L$TMW_ROOT/bin/$Arch"
            SHLMAKEDEF="awk 'BEGIN {printf \"{\\n\\tglobal:\\n\";}
                                   {printf \"\\t\\t%s;\\n\", \$0;}
                             END   {printf \"\\tlocal:\\n\\t\\t*;\\n};\\n\";}'"
#----------------------------------------------------------------------------
            ;;
    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"
#
#           LD="$LD"
#           LDFLAGS="$LDFLAGS"
#           LDOPTIMFLAGS="$LDOPTIMFLAGS"
#           LDDEBUGFLAGS="$LDDEBUGFLAGS"
#----------------------------------------------------------------------------
#############################################################################
