Sophie

Sophie

distrib > Mandriva > 2007.0 > i586 > media > contrib-release > by-pkgid > 8079d983ecf371717db799dd75bd56c2 > files > 67

libopenrm1-1.5.2-2mdv2007.0.i586.rpm

#!/bin/sh -f

# $Id: #
# Version: $Name: OpenRM-1-5-2-RC1 $
# $Revision: 1.6 $
# $Log: configure,v $
# Revision 1.6  2004/04/18 20:25:57  wes
# Updates for OpenRM 1.5.2
#
# Revision 1.5  2003/08/06 19:04:18  wes
# Updated for 1.5.0.
#
# Revision 1.4  2000/12/05 02:25:56  wes
# Added -Wall compile flag for Linux (gcc) to generate lots of
# compile warnings.
#
# Revision 1.3  2000/09/02 22:42:40  wes
# Added -lXi as a mandatory X11 library for all platforms.
#
# Revision 1.2  2000/09/02 21:58:25  wes
# CVS tag updates, doc updates.
#
#
# copied from $OPENRM/rmdemo/configure.
#

#
# usage: configure [-opengl=/opengl/home/dir] [-rm=/rm/home/dir] [-x11=/x11/home/dir] [-opt=flag (eg: -g, -O2, etc.)] [-irixarch=flag (eg, 32, n32 or 64)]
#

#
# the purpose of this script is to generate a file included by
# a Makefile in the rmdemo distribution. the included file contains
# definitions that locate several components needed to build
# the demos. these components include:
#
# 1. RM Scene Graph: the location of the RM Scene Graph distribution
#    (includes & libs), compile-time flags
# 2. OpenGL: where does OpenGL live? 
# 3. X11: Where is X11?
# 4. Compiler information: optimization and arch specific flags
#


#
# names of the files modified by this script:
#
MakeIncFName="makeinclude"
MakeIncFNameBackup="makeinclude.bak"


RMHOME=""
OPENGLHOME=""
X11HOME=""

#
# internally-used variables
#
OSversion=""

#
# RM stuff
#
# the following are the default values used for RM Scene Graph.
# stuff prefixed with "const" is what the developer should change
# or add to if different libararies are needed.
#
constRMLibs="-lrm -lrmaux -lrmv"
constRMCFlags="-DRM_X"

# the default values that will be written to the makeinclude
# file unless overridden by command line args to this script
RMHome=""
RMLibs=""
RMCFlags=""

#
# OpenGL stuff
#
#
# the following are the default values used for OpenGL
# stuff prefixed with "const" is what the developer should change
# or add to if different libararies are needed.
#
constOpenGLLibs="-lGL -lGLU"
constOpenGLCFlags=""

# the default values that will be written to the makeinclude
# file unless overridden by command line args to this script
OpenGLHome=""
OpenGLLibs=""
OpenGLCFlags=""

#
# X Stuff
#
constX11Libs="-lX11 -lpthread -lXi -lm"
constX11CFlags=""
X11Home=""
X11Include=""
X11Libs=""

constX11LinuxLibs="-lXmu"

#
# Compile flags
#
# default optimization flag is -g. this default value may be 
# overridden by a command line argument.

constOptFlag="-g"
compileOptFlag=""

constArchFlag=""
archFlags=""



#
# support subroutines
#

print_error()
{
    echo " $*" 2>&1;
    echo usage: $0 [-opengl=/opengl/home/dir] [-rm=/rm/home/dir] [-x11=/x11/home/dir] [-opt=flag \(eg: -g, -O2, etc.\)] [-irixarch=flag \(one of: 32, n32 or 64, n32 is default if on an IRIX box\)]
}

doPreamble()
{
    echo "# " >> $MakeIncFName
    echo "# autogenerated by configure" >> $MakeIncFName
    echo "# on `date`" >> $MakeIncFName
    echo "# " >> $MakeIncFName
}

doOpenGL()
{
# 
# input parms:
# $1 - $OPENGLHOME
# $2 - $OSversion
# $3 - $archFlags

# we're assuming we won't have -n32 or -64 unless the OS is IRIX

    case $3 in
    -n32 )
       oglLibDir=`echo $1`/lib32
       ;;

    -64 )
       oglLibDir=`echo $1`/lib64
       ;;

    *)
       oglLibDir=`echo $1`/lib
       ;;

    esac

    echo configuring for OpenGL..
    OpenGLHome=`echo $1`
    OpenGLLibs=`echo -L$oglLibDir $constOpenGLLibs`
    OpenGLCFlags=`echo $constOpenGLCFlags -I$1/include`
}

doRM()
{
    echo configuring for RM..
    RMHome=`echo $1`
    RMLibs=`echo -L$1/lib $constRMLibs`
    RMCFlags=`echo $constRMCFlags -I$1/include`
}

doX11()
{

# 
# input parms:
# $1 - $OPENGLHOME
# $2 - $OSversion
# $3 - $archFlags
#
# we're assuming we won't have -n32 or -64 unless the OS is IRIX
#

    case $3 in
    -n32 )
       x11LibDir=`echo $1`/lib32
       ;;

    -64 )
       x11LibDir=`echo $1`/lib64
       ;;

    *)
       x11LibDir=`echo $1`/lib
       ;;

    esac

#
# do arch-specific processing.
#
    case $2 in

    Linux )
      archX11Libs="-lXmu"
      ;;

    *)
      archX11Libs=""
      ;;

    esac

    echo configuring for X11..
    X11Home=`echo $1`
    X11Libs=`echo -L$x11LibDir $archX11Libs $constX11Libs`
    X11CFlags=`echo $constX11CFlags -I$1/include`
}

doX11Defaults ()
{
    case $1 in

    Linux )
    X11HOME=/usr/X11R6
    ;;

    SunOS )
    X11HOME=/usr/openwin
    ;;

    IRIX* )
    X11HOME=/usr
    ;;

    *)
      ;;

    esac
}

doOpenGLDefaults ()
{
    case $1 in

    Linux )
    OPENGLHOME=/usr
    ;;

    SunOS )
    OPENGLHOME=/usr/openwin
    ;;

    IRIX* )
    OPENGLHOME=/usr
    ;;

    *)
      ;;

    esac
}

doRMDefaults ()
{
    case $1 in

    Linux )
    RMHOME=/usr/local/rm152
    ;;

    SunOS )
    RMHOME=/usr/local/rm152
    ;;

    IRIX* )
    RMHOME=/usr/local/rm152
    ;;

    *)
      ;;

    esac
}

doArchDefaults ()
{
    case $1 in

    Linux )
    archFlags="-Wall"
    ;;

    SunOS )
    archFlags=""
    ;;

#
# 12/3/1999
# RMSG is currently available only under -n32 builds on IRIX
#
    IRIX* )
    archFlags="-n32"
    ;;

    *)
      ;;

    esac
}

doArchFlags ()
{
    archFlags=$1
}

doCompileOpt ()
{
    compileOptFlag=$1
}

#############################
#
# main
#
#############################

# set the OSversion
OSversion=`uname -s`

#
# assign default values for OPENGLHOME and X11HOME depending
# upon the OSversion. later, we may override these values if
# the user specified something on the command line

doX11Defaults $OSversion
doOpenGLDefaults $OSversion
doRMDefaults $OSversion
doCompileOpt $constOptFlag
doArchDefaults $OSversion

# process the command line args

for arg do
    case $arg in

    -opengl=* )
# strip off any -foo= stuff before the real args
    OPENGLHOME=`echo $arg | sed 's/[-a-z]*=//'` 
    ;;

    -rm=* )
# strip off any -foo= stuff before the real args
    RMHOME=`echo $arg | sed 's/[-a-z]*=//'` 
    ;;

    -x11=* )
# strip off any -foo= stuff before the real args
    X11HOME=`echo $arg | sed 's/[-a-z,0-9]*=//'` 
    ;;

    -opt=* )
# strip off any -foo= stuff before the real args
    USEROPT=`echo $arg | sed 's/[-a-z,0-9]*=//'` 
    ;;

    -irixarch=* )
# strip off any -foo= stuff before the real args
    IRIXARCH=`echo $arg | sed 's/[-a-z,0-9]*=//'` 
    ;;
    

    *)
    print_error "unrecognized config option $arg"
    exit 1
    ;;

    esac

done

#
# check to see if the incfile exists, move it to .bak if so
#
if test -r $MakeIncFName ; then
    cp $MakeIncFName $MakeIncFNameBackup
    rm $MakeIncFName
fi

touch  $MakeIncFName


#
# each of the following routines is invoked to set 
# flags and settings stored in a file included into a Makefile.
#
if test -n "`echo $USERARCH`" ; then
    doArchFlags $USERARCH
fi

if test -n "`echo $OPENGLHOME`" ; then
    doOpenGL $OPENGLHOME $OSversion $archFlags
fi

if test -n "`echo $RMHOME`" ; then
    doRM $RMHOME
fi

if test -n "`echo $X11HOME`" ; then
    doX11 $X11HOME $OSversion $archFlags
fi

if test -n "`echo $USEROPT`" ; then
    doCompileOpt $USEROPT
fi


#
# now dump the variables into the makeinclude file
#

doPreamble

echo RMHOME=$RMHome >> $MakeIncFName
echo RMLIBS=$RMLibs >> $MakeIncFName
echo RMCFLAGS=$RMCFlags >> $MakeIncFName
echo "#  " >> $MakeIncFName

echo OPENGLHOME=$OpenGLHome >> $MakeIncFName
echo OPENGLLIBS=$OpenGLLibs >> $MakeIncFName
echo OPENGLCFLAGS=$OpenGLCFlags >> $MakeIncFName
echo "#  " >> $MakeIncFName

echo X11HOME=$X11Home >> $MakeIncFName
echo X11LIBS=$X11Libs >> $MakeIncFName
echo X11CFLAGS=$X11CFlags >> $MakeIncFName
echo "#  " >> $MakeIncFName

echo OPTFLAGS=$compileOptFlag >> $MakeIncFName
echo ARCHFLAGS=$archFlags >> $MakeIncFName

echo "all done, created a new $MakeIncFName"

#############################
#
# end main
#
#############################