#
# matopts.sh   Shell script for configuring MAT 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_SA_OPT: Template Options file for building standalone MAT applications
#
# Copyright (c) 1984-1998 by The MathWorks, Inc.
# All Rights Reserved.
# $Revision: 1.18 $  $Date: 1998/12/16 23:29:10 $
#----------------------------------------------------------------------------
#
    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)
#----------------------------------------------------------------------------
            CC='cc'
            CFLAGS="-I$TMW_ROOT/extern/include"
            CLIBS="-L$TMW_ROOT/extern/lib/$Arch -lmx -lmat"
            COPTIMFLAGS='-O -DNDEBUG'
            CDEBUGFLAGS='-g'
#
            FC='f77'
            FFLAGS="-I$TMW_ROOT/extern/include -fpe3"
            FLIBS="-L$TMW_ROOT/extern/lib/$Arch -lmx -lmat"
            FOPTIMFLAGS='-O'
            FDEBUGFLAGS='-g'
#
            LD="$COMPILER"
            LDFLAGS=''
            LDOPTIMFLAGS=''
            LDDEBUGFLAGS=''
#----------------------------------------------------------------------------
            ;;
        hp700)
#----------------------------------------------------------------------------
            CC='cc'
#
# Add the +DAportable switch to CFLAGS if you build your application on
# PARISC 2.0 but want it to run on PARISC 1.1 as well.
#
            CFLAGS="-Aa -I$TMW_ROOT/extern/include"
            CLIBS="-L$TMW_ROOT/extern/lib/$Arch -lmx -lmat"
            COPTIMFLAGS='-O -DNDEBUG'
            CDEBUGFLAGS='-g'
#
            FC='f77'
            FFLAGS="-I$TMW_ROOT/extern/include"
            FLIBS="-Wl,-L$TMW_ROOT/extern/lib/$Arch -lmx -lmat"
            FOPTIMFLAGS='-O'
            FDEBUGFLAGS='-g'
#
            LD="$COMPILER"
            LDFLAGS=''
            LDOPTIMFLAGS=''
            LDDEBUGFLAGS=''
#----------------------------------------------------------------------------
            ;;
        ibm_rs)
#----------------------------------------------------------------------------
            CC='cc'
            CFLAGS="-I$TMW_ROOT/extern/include"
            CLIBS="-L$TMW_ROOT/extern/lib/$Arch -lmx -lmat"
            COPTIMFLAGS='-O -DNDEBUG'
            CDEBUGFLAGS='-g'
#
            FC='f77'
            FFLAGS="-I$TMW_ROOT/extern/include"
            FLIBS="-L$TMW_ROOT/extern/lib/$Arch -lmx -lmat"
            FOPTIMFLAGS='-O'
            FDEBUGFLAGS='-g'
#
            LD="$COMPILER"
            LDFLAGS=''
            LDOPTIMFLAGS=''
            LDDEBUGFLAGS=''
#----------------------------------------------------------------------------
            ;;
        lnx86)
#----------------------------------------------------------------------------
#
# Default to libc5 based development (ie. RedHat4.2)
#
	    CC='gcc'
            if [ -f /etc/redhat-release ]; then
		OS=`cat /etc/redhat-release`
		version=`expr "$OS" : '.*\([0-9][0-9]*\)\.'`
#
# Use this compiler for RedHat5.* systems
#
		if [ "$version" = "5" ]; then
		    CC='i486-linuxlibc5-gcc'
		fi
	    elif [ -f /etc/debian_version ]; then
	        OS=`cat /etc/debian_version`
		version=`expr "$OS" : '.*\([0-9][0-9]*\)\.'`
#
# Use this compiler for Debian 2.* systems
#
		if [ "$version" = "2" ]; then
		    CC='i486-linuxlibc1-gcc'
		fi
	    fi
            CFLAGS="-ansi -I$TMW_ROOT/extern/include"
            CLIBS="-L$TMW_ROOT/extern/lib/$Arch -lmx -lmat"
            COPTIMFLAGS='-O -DNDEBUG'
            CDEBUGFLAGS='-g'
#
# These flags use f2c and gcc for building FORTRAN applications.
# The fort77 script invokes the f2c command transparently,
# so it can be used like a real FORTRAN compiler.
#
            FC='fort77'
            FFLAGS="-I$TMW_ROOT/extern/include"
#
# Use these flags for the Absoft F77 FORTRAN Compiler
#
        #   FC='f77'
        #   FFLAGS="-I$TMW_ROOT/extern/include -f -B24 -B108 -N90"
#
            FLIBS="-L$TMW_ROOT/extern/lib/$Arch -lmx -lmat"
            FOPTIMFLAGS='-O'
            FDEBUGFLAGS='-g'
#
            LD="$COMPILER"
            LDFLAGS=''
            LDOPTIMFLAGS=''
            LDDEBUGFLAGS=''
#----------------------------------------------------------------------------
            ;;
        sgi)
#----------------------------------------------------------------------------
            CC='cc'
            CFLAGS="-I$TMW_ROOT/extern/include -o32"
            CLIBS="-L$TMW_ROOT/extern/lib/$Arch -lmx -lmat"
            COPTIMFLAGS='-O -DNDEBUG'
            CDEBUGFLAGS='-g'
#
            FC='f77'
            FFLAGS="-I$TMW_ROOT/extern/include -o32"
            FLIBS="-L$TMW_ROOT/extern/lib/$Arch -lmx -lmat"
            FOPTIMFLAGS='-O'
            FDEBUGFLAGS='-g'
#
            LD="$COMPILER"
            LDFLAGS='-o32'
            LDOPTIMFLAGS=''
            LDDEBUGFLAGS=''
#----------------------------------------------------------------------------
            ;;
        sgi64)
# R8000 only: The default action of mbuild is to generate full MIPS IV
#             (R8000) instruction set.
#----------------------------------------------------------------------------
            CC='cc'
            CFLAGS="-64 -mips4 -I$TMW_ROOT/extern/include"
            CLIBS="-L$TMW_ROOT/extern/lib/$Arch -lmx -lmat"
            COPTIMFLAGS='-O -DNDEBUG'
            CDEBUGFLAGS='-g'
#
            FC='f77'
            FFLAGS="-64 -mips4 -I$TMW_ROOT/extern/include"
            FLIBS="-L$TMW_ROOT/extern/lib/$Arch -lmx -lmat"
            FOPTIMFLAGS='-O'
            FDEBUGFLAGS='-g'
#
            LD="$COMPILER"
            LDFLAGS='-64 -mips4'
            LDOPTIMFLAGS=''
            LDDEBUGFLAGS=''
#----------------------------------------------------------------------------
            ;;
        sol2)
#----------------------------------------------------------------------------
            CC='cc'
            CFLAGS="-I$TMW_ROOT/extern/include"
            CLIBS="-L$TMW_ROOT/extern/lib/$Arch -lmx -lmat"
            COPTIMFLAGS='-O -DNDEBUG'
            CDEBUGFLAGS='-g'
#
            FC='f77'
            FFLAGS="-I$TMW_ROOT/extern/include"
            FLIBS="-L$TMW_ROOT/extern/lib/$Arch -lmx -lmat"
            FOPTIMFLAGS='-O'
            FDEBUGFLAGS='-g'
#
            LD="$COMPILER"
            LDFLAGS=''
            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"
#----------------------------------------------------------------------------
#############################################################################
