#!/bin/sh # # This script is an automatic configuration file for configuring the makefiles # in this directory for a particular architecture # # Usage: configure # # where is one of the configuration files in directory config/. # ########## Try to auto detect architecture ########## MACHID=`bin/machid` if [ "${MACHID}" = "ibmrs6000" ] ; then if [ -d /usr/lpp/ppe.poe ] ; then # user has parallel environment MACHID="${MACHID}poe" ; fi elif [ "${MACHID}" = "sunsparcsolaris" ] ; then if [ -d /opt/SUNWhpc ] ; then # user has hpc environment MACHID="${MACHID}hpc" ; elif [ -x `which mpirun` -a -x `which g++` ] ; then # user has g++ and mpich environment MACHID="${MACHID}g++mpich" ; fi fi ########## Try to set ARCHITECTURE ########## ARCHITECTURE="" if [ -n "$1" ] ; then if [ -f config/${1} ] ; then ARCHITECTURE=$1 ; echo "found ${ARCHITECTURE}" ; else echo "ERROR. config/${1} not found" ; echo "" ; fi else if [ "${MACHID}" = "smells like origin 2000" ] ; then ARCHITECTURE="o2000-CC" ; elif [ "${MACHID}" = "ibmrs6000poe" ] ; then ARCHITECTURE="sp2-xlC" ; elif [ "${MACHID}" = "sunsparcsolarishpc" ] ; then ARCHITECTURE="sun4-CC-sunhpc" ; elif [ "${MACHID}" = "sunsparcsolarisg++mpich" ] ; then ARCHITECTURE="sun4-g++-mpich" ; elif [ "${MACHID}" = "smells like linux with g++ and mpich" ] ; then ARCHITECTURE="x86-g++-linux" ; else echo "" ; echo "WARNING." ; echo "Unknown machine type" ; echo " ${MACHID}" ; uname -a ; echo "Please report to KeLP developers." ; fi if [ -n "${ARCHITECTURE}" ] ; then echo "Auto-detected ${ARCHITECTURE}" ; fi fi ########## Try to avoid pilot errors ########## if [ -h arch ] ; then CURRENT=`ls -l arch | awk '{print $NF}' | awk -F'/' '{print $NF}'` ; if [ "${ARCHITECTURE}" = "${CURRENT}" ] ; then echo "? Configuration is already set to ${CURRENT}" ; exit 0 ; else echo "" ; echo "ERROR." ; echo "Configuration is already set to" ; echo " $CURRENT" ; echo "Execute" ; echo " % gmake clean" ; echo "before changing configuration" ; echo "" ; exit 1 ; fi fi ########## Try to set arch ########## if [ -z "${ARCHITECTURE}" ] ; then echo echo "Possible architecture types" echo "---------------------------" (cd config; echo * | xargs -n1 ) echo exit 1 ; else rm -f arch ln -s config/$ARCHITECTURE arch exit 0 ; fi