summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Lecher <jlec@gentoo.org>2010-11-17 13:10:04 +0000
committerJustin Lecher <jlec@gentoo.org>2010-11-17 13:10:04 +0000
commitbb53b07b40ac9fc3871cfad0ef12843d7ff0f82a (patch)
treed9f49b3a26c7eab560b1574a95844725b5a035a7 /sci-chemistry/cns
parentVersion bump. Remove old version. (diff)
downloadgentoo-2-bb53b07b40ac9fc3871cfad0ef12843d7ff0f82a.tar.gz
gentoo-2-bb53b07b40ac9fc3871cfad0ef12843d7ff0f82a.tar.bz2
gentoo-2-bb53b07b40ac9fc3871cfad0ef12843d7ff0f82a.zip
Version Bump
(Portage version: 2.1.9.24/cvs/Linux x86_64)
Diffstat (limited to 'sci-chemistry/cns')
-rw-r--r--sci-chemistry/cns/ChangeLog8
-rw-r--r--sci-chemistry/cns/cns-1.3.ebuild208
-rw-r--r--sci-chemistry/cns/files/1.3-delete.patch13
-rw-r--r--sci-chemistry/cns/files/1.3-gentoo.patch76
-rw-r--r--sci-chemistry/cns/files/cns_solve_env_sh-1.3229
5 files changed, 533 insertions, 1 deletions
diff --git a/sci-chemistry/cns/ChangeLog b/sci-chemistry/cns/ChangeLog
index f9a32a5912a6..ddf3bacbbbc6 100644
--- a/sci-chemistry/cns/ChangeLog
+++ b/sci-chemistry/cns/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for sci-chemistry/cns
# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sci-chemistry/cns/ChangeLog,v 1.25 2010/11/16 20:05:49 xarthisius Exp $
+# $Header: /var/cvsroot/gentoo-x86/sci-chemistry/cns/ChangeLog,v 1.26 2010/11/17 13:10:04 jlec Exp $
+
+*cns-1.3 (17 Nov 2010)
+
+ 17 Nov 2010; Justin Lecher <jlec@gentoo.org> +files/1.3-delete.patch,
+ +files/1.3-gentoo.patch, +files/cns_solve_env_sh-1.3, +cns-1.3.ebuild:
+ Version Bump
*cns-1.2.1-r5 (16 Nov 2010)
diff --git a/sci-chemistry/cns/cns-1.3.ebuild b/sci-chemistry/cns/cns-1.3.ebuild
new file mode 100644
index 000000000000..22e5224782de
--- /dev/null
+++ b/sci-chemistry/cns/cns-1.3.ebuild
@@ -0,0 +1,208 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sci-chemistry/cns/cns-1.3.ebuild,v 1.1 2010/11/17 13:10:04 jlec Exp $
+
+EAPI="3"
+
+inherit eutils fortran toolchain-funcs versionator flag-o-matic
+
+MY_PN="${PN}_solve"
+MY_PV="$(delete_version_separator 2)"
+MY_P="${MY_PN}_${MY_PV}"
+
+DESCRIPTION="Crystallography and NMR System"
+HOMEPAGE="http://cns.csb.yale.edu/"
+SRC_URI="${MY_P}_all.tar.gz
+ aria? ( aria2.3.1.tar.gz )"
+
+SLOT="0"
+LICENSE="cns"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="aria openmp"
+
+RDEPEND="app-shells/tcsh"
+DEPEND="${RDEPEND}"
+PDEPEND="aria? ( ~sci-chemistry/aria-2.3.1 )"
+
+RESTRICT="fetch"
+S="${WORKDIR}/${MY_P}"
+
+FORTRAN="gfortran ifc"
+
+pkg_nofetch() {
+ elog "Fill out the form at http://cns.csb.yale.edu/cns_request/"
+ use aria && elog "and http://aria.pasteur.fr/"
+ elog "and place these files:"
+ elog ${A}
+ elog "in ${DISTDIR}."
+}
+
+pkg_setup() {
+ fortran_pkg_setup
+
+ if [[ $(tc-getCC) == *gcc* ]] &&
+ ( [[ $(gcc-major-version)$(gcc-minor-version) -lt 42 ]] ||
+ ! built_with_use sys-devel/gcc openmp )
+ then
+ ewarn "You are using gcc and OpenMP is only available with gcc >= 4.2 "
+ ewarn "Switch CC to an OpenMP capable compiler"
+ fi
+}
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/${PV}-gentoo.patch \
+ "${FILESDIR}"/${PV}-delete.patch
+
+ if use aria; then
+ pushd "${WORKDIR}"/aria* >& /dev/null
+ # Update the cns sources in aria for version 1.2.1
+ epatch "${FILESDIR}"/1.2.1-aria2.3.patch
+
+ # Update the code with aria specific things
+ cp -rf cns/src/* "${S}"/source/
+ popd >& /dev/null
+ fi
+
+ # the code uses Intel-compiler-specific directives
+ if [[ ${FORTRANC} == gfortran ]]; then
+ use openmp && \
+ OMPLIB="-lgomp" && append-flags -fopenmp
+ COMP="gfortran"
+ use amd64 && \
+ append-fflags -fdefault-integer-8
+ else
+ use openmp && OMPLIB="-liomp5" && \
+ append-flags -openmp && append-ldflags -openmp
+ COMP="ifort"
+ use amd64 && append-fflags -i8
+ append-fflags -Vaxlib
+ append-ldflags -Vaxlib
+ fi
+
+ use amd64 && \
+ append-cflags "-DINTEGER='long long int'"
+
+ # Set up location for the build directory
+ # Uses obsolete `sort` syntax, so we set _POSIX2_VERSION
+ cp "${FILESDIR}"/cns_solve_env_sh-${PV} "${T}"/cns_solve_env_sh || die
+ sed -i \
+ -e "s:_CNSsolve_location_:${S}:g" \
+ -e "17 s:\(.*\):\1\nsetenv _POSIX2_VERSION 199209:g" \
+ "${S}"/cns_solve_env
+ sed -i \
+ -e "s:_CNSsolve_location_:${S}:g" \
+ -e "17 s:\(.*\):\1\nexport _POSIX2_VERSION; _POSIX2_VERSION=199209:g" \
+ "${T}"/cns_solve_env_sh
+
+ ebegin "Fixing shebangs..."
+ find "${S}" -type f \
+ -exec sed "s:/bin/csh:${EPREFIX}/bin/csh:g" -i '{}' \; || die
+ find . -name "Makefile*" \
+ -exec \
+ sed \
+ -e "s:^SHELL=/bin/sh:SHELL=${EPREFIX}/bin/sh:g" \
+ -e "s:/bin/ls:ls:g" \
+ -e "s:/bin/rm:rm:g" \
+ -i '{}' \; || die
+ eend
+}
+
+src_compile() {
+ local GLOBALS
+ local MALIGN
+
+ # Set up the compiler to use
+ pushd instlib/machine/unsupported/g77-unix 2>/dev/null
+ ln -s Makefile.header Makefile.header.${FORTRANC} || die
+ popd 2>/dev/null
+
+ # make install really means build, since it's expected to be used in-place
+ # -j1 doesn't mean we do no respect MAKEOPTS!
+ emake -j1 \
+ CC="$(tc-getCC)" \
+ CXX="$(tc-getCXX)" \
+ F77="${FORTRANC}" \
+ LD="${FORTRANC}" \
+ CCFLAGS="${CFLAGS} -DCNS_ARCH_TYPE_\$(CNS_ARCH_TYPE) \$(EXT_CCFLAGS)" \
+ CXXFLAGS="${CXXFLAGS} -DCNS_ARCH_TYPE_\$(CNS_ARCH_TYPE) \$(EXT_CCFLAGS)" \
+ LDFLAGS="${LDFLAGS}" \
+ F77OPT="${FFLAGS:- -O2} ${MALIGN}" \
+ F77STD="${GLOBALS}" \
+ OMPLIB="${OMPLIB}" \
+ compiler="${COMP}" \
+ install \
+ || die "emake failed"
+
+}
+
+src_test() {
+ # We need to force on g77 manually, because we can't get aliases working
+ # when we source in a -c
+ einfo "Running tests ..."
+ sh -c \
+ "export CNS_G77=ON; source ${T}/cns_solve_env_sh; make run_tests" \
+ || die "tests failed"
+ einfo "Displaying test results ..."
+ cat "${S}"/*_g77/test/*.diff-test
+}
+
+src_install() {
+ cat >> "${T}"/66cns <<- EOF
+ CNS_SOLVE="${EPREFIX}/usr"
+ CNS_ROOT="${EPREFIX}/usr"
+ CNS_DATA="${EPREFIX}/usr/share/cns"
+ CNS_DOC="${EPREFIX}/usr/share/doc/cns-1.3"
+ CNS_LIB="${EPREFIX}/usr/share/cns/libraries"
+ CNS_MODULE="${EPREFIX}/usr/share/cns/modules"
+ CNS_TOPPAR="${EPREFIX}/usr/share/cns/libraries/toppar"
+ CNS_CONFDB="${EPREFIX}/usr/share/cns/libraries/confdb"
+ CNS_XTALLIB="${EPREFIX}/usr/share/cns/libraries/xtal"
+ CNS_NMRLIB="${EPREFIX}/usr/share/cns/libraries/nmr"
+ CNS_XRAYLIB="${EPREFIX}/usr/share/cns/libraries/xray"
+ CNS_XTALMODULE="${EPREFIX}/usr/share/cns/modules/xtal"
+ CNS_NMRMODULE="${EPREFIX}/usr/share/cns/modules/nmr"
+ CNS_HELPLIB="${EPREFIX}/usr/share/cns/helplib"
+ EOF
+
+ doenvd "${T}"/66cns || die
+
+ # Don't want to install this
+ rm -f "${S}"/*linux*/utils/Makefile
+
+ sed -i \
+ -e "s:\$CNS_SOLVE/doc/:\$CNS_SOLVE/share/doc/${PF}/:g" \
+ "${S}"/bin/cns_web || die
+
+ newbin "${S}"/*linux*/bin/cns_solve* cns_solve \
+ || die "install cns_solve failed"
+
+ # Can be run by either cns_solve or cns
+ dosym cns_solve /usr/bin/cns
+
+ dobin \
+ "${S}"/*linux*/utils/* \
+ "${S}"/bin/cns_{edit,header,import_cif,transfer,web} || die "install bin failed"
+
+ insinto /usr/share/cns
+ doins -r "${S}"/libraries "${S}"/modules "${S}"/helplib "${S}"/bin/cns_info || die
+
+ dohtml \
+ -A iq,cgi,csh,cv,def,fm,gif,hkl,inp,jpeg,lib,link,list,mask,mtf,param,pdb,pdf,pl,ps,sc,sca,sdb,seq,tbl,top \
+ -f all_cns_info_template,omac,def \
+ -r doc/html/* || die
+ # Conflits with app-text/dos2unix
+ rm -f "${D}"/usr/bin/dos2unix || die
+}
+
+pkg_info() {
+ if use openmp; then
+ elog "Set OMP_NUM_THREADS to the number of threads you want."
+ elog "If you get segfaults on large structures, set the GOMP_STACKSIZE"
+ elog "variable if using gcc (16384 should be good)."
+ fi
+}
+
+pkg_postinst() {
+ pkg_info
+}
diff --git a/sci-chemistry/cns/files/1.3-delete.patch b/sci-chemistry/cns/files/1.3-delete.patch
new file mode 100644
index 000000000000..cbddf4289158
--- /dev/null
+++ b/sci-chemistry/cns/files/1.3-delete.patch
@@ -0,0 +1,13 @@
+diff --git a/utils/cluster_struc.cpp b/utils/cluster_struc.cpp
+index b64467a..5f727db 100644
+--- a/utils/cluster_struc.cpp
++++ b/utils/cluster_struc.cpp
+@@ -173,7 +173,7 @@ int main(int argc, char *argv[]) {
+ for (int i = 0; i < nrstruc; i++) {
+ delete[] neighbor[i];
+ }
+- delete[] neighbor, neighborcount;
++ delete[] neighbor, delete[] neighborcount;
+ return 5;
+ }
+ if (rmsd < cutoff) {
diff --git a/sci-chemistry/cns/files/1.3-gentoo.patch b/sci-chemistry/cns/files/1.3-gentoo.patch
new file mode 100644
index 000000000000..95961fe6ff0c
--- /dev/null
+++ b/sci-chemistry/cns/files/1.3-gentoo.patch
@@ -0,0 +1,76 @@
+diff --git a/instlib/source/Makefile.proto b/instlib/source/Makefile.proto
+index 0d0dd3e..dd4b680 100644
+--- a/instlib/source/Makefile.proto
++++ b/instlib/source/Makefile.proto
+@@ -11,6 +11,8 @@
+
+ SHELL=/bin/sh
+
++cns_string=`date "+%y%m%d%H%M"`
++
+ # commands
+ RM = /bin/rm
+
+@@ -19,32 +21,26 @@ DEPENDS = $(OBJS) dmemory.o machine_c.o
+
+ # the default is to make the cns executable
+ cns_solve:
+- @ make -k printflags F77BUG="$(debug)" DEBUG="$(debug)"
+- @ make -k ../bin/cns_solve F77BUG="$(debug)" DEBUG="$(debug)"
+- @ make -k exepurge
++ @ make printflags F77BUG="$(debug)" DEBUG="$(debug)"
++ @ make ${MAKEOPTS} ../bin/cns_solve F77BUG="$(debug)" DEBUG="$(debug)"
++ @ make exepurge
+
+ # rule for the fortran routines
+ $(OBJS):
+- @ echo "compiling: $(@:.o=.f)"; \
+- $(F77) -c $(F77FLAGS) $(@:.o=.f)
++ $(F77) -c $(F77FLAGS) $(@:.o=.f)
+
+ # rule for the dynamic memory allocation C routines
+ dmemory.o: dmemory.c
+- @ echo ; echo "compiling: $?"
+- @ $(CC) -c $(CCFLAGS) $?
++ $(CC) -c $(CCFLAGS) $?
+
+ # rule for the machine specific C routines
+ machine_c.o: machine_c.c
+- @ echo ; echo "compiling: $?"
+- @ $(CC) -c $(CCFLAGS) $?
++ $(CC) -c $(CCFLAGS) $?
+
+ # rule for the executable itself
+ ../bin/cns_solve: $(DEPENDS)
+- @ echo ; echo "linking: cns_solve"; echo
+- @ cns_string=`date "+%y%m%d%H%M"`; \
+- $(LD) -o cns_solve-$$cns_string.exe $(OBJS) dmemory.o machine_c.o \
+- $(LDFLAGS) \
+- $(CNS_FFTDIR) $(CNS_FFTLIB); \
++ $(LD) $(LDFLAGS) -o cns_solve-$$cns_string.exe $(OBJS) dmemory.o machine_c.o \
++ $(CNS_FFTDIR) $(CNS_FFTLIB) $(OMPLIB); \
+ if [ -x cns_solve-$$cns_string.exe ]; \
+ then echo "created executable file cns_solve-$$cns_string.exe"; \
+ echo ""; cd ../bin; $(RM) -f cns_solve; $(RM) -f cns; \
+@@ -59,7 +55,7 @@ printflags:
+ @ echo; echo "flags:"; \
+ echo " fortran -> [$(F77)] $(F77FLAGS)"; \
+ echo " c -> [$(CC)] $(CCFLAGS)"; \
+- echo " link -> [$(LD)] $(LDFLAGS) $(CNS_FFTDIR) $(CNS_FFTLIB)"; \
++ echo " link -> [$(LD)] $(LDFLAGS) $(CNS_FFTDIR) $(CNS_FFTLIB) $(OMP_LIB)"; \
+ echo
+
+ # regenerate makefiles
+diff --git a/instlib/utils/Makefile b/instlib/utils/Makefile
+index 98de84f..2b0a9ce 100644
+--- a/instlib/utils/Makefile
++++ b/instlib/utils/Makefile
+@@ -28,7 +28,7 @@ utils:
+ $(CC) -o $@ $(CCFLAGS) $(@).c $(CCLINK)
+
+ .cpp:
+- $(CPP) -o $@ $(CCFLAGS) $(@).cpp $(CCLINK)
++ $(CXX) -o $@ $(CXXFLAGS) $(@).cpp $(CCLINK)
+
+ .l:
+ lex $(@).l
diff --git a/sci-chemistry/cns/files/cns_solve_env_sh-1.3 b/sci-chemistry/cns/files/cns_solve_env_sh-1.3
new file mode 100644
index 000000000000..12368f87b596
--- /dev/null
+++ b/sci-chemistry/cns/files/cns_solve_env_sh-1.3
@@ -0,0 +1,229 @@
+#!/bin/sh
+#
+# This file sets up the appropriate environmental variables and paths
+# for CNSsolve. In the case of the same machines with different versions
+# of the OS, backward compatibility is assumed - ie. a later version will
+# be setup for a previous version of the OS if nothing else is available.
+#
+# written by: Paul Adams
+#
+# copyright Yale University
+#
+# ==========================================================================
+#
+# >>>>>> Important: define the location of the CNSsolve directory <<<<<<
+#
+# CHANGE THE NEXT LINE TO POINT TO THE LOCATION OF THE CNSsolve DIRECTORY
+
+ CNS_SOLVE=_CNSsolve_location_
+
+#
+# ==========================================================================
+#
+# full expansion of the CNS_SOLVE variable prior to use.
+#
+export CNS_SOLVE; CNS_SOLVE=$CNS_SOLVE
+#
+# ==========================================================================
+#
+# get the machine architecture
+#
+if [ -d $CNS_SOLVE ]; then
+ if [ ! "$CNS_ARCH" ]; then
+ export CNS_ARCH; CNS_ARCH=`$CNS_SOLVE/bin/getarch`
+ fi
+else
+ export CNS_ARCH; CNS_ARCH='unknown'
+fi
+#
+# ==========================================================================
+#
+# system variables for OpenMP
+#
+# The default stack sizes are usually insufficient, especially when
+# CNS is compiled using OpenMP. If the stack sizes are too
+# small segfaults may occur. Recommended setting for "stacksize":
+limit stacksize unlimited
+#
+# KMP_STACKSIZE is specific for Intel ifort, icc:
+##setenv KMP_STACKSIZE 256m
+#
+# OMP_STACKSIZE is used by all compilers:
+setenv OMP_STACKSIZE 256m
+#
+# Uncomment the following line and change as appropriate to set the number
+# of processors (threads) to use.
+###setenv OMP_NUM_THREADS 4
+#
+# ==========================================================================
+#
+# general environmental variables
+#
+export CNS_LIB; CNS_LIB=$CNS_SOLVE/libraries
+export CNS_MODULE; CNS_MODULE=$CNS_SOLVE/modules
+export CNS_TOPPAR; CNS_TOPPAR=$CNS_LIB/toppar
+export CNS_CONFDB; CNS_CONFDB=$CNS_LIB/confdb
+export CNS_XTALLIB; CNS_XTALLIB=$CNS_LIB/xtal
+export CNS_NMRLIB; CNS_NMRLIB=$CNS_LIB/nmr
+export CNS_XRAYLIB; CNS_XRAYLIB=$CNS_LIB/xray
+export CNS_XTALMODULE; CNS_XTALMODULE=$CNS_MODULE/xtal
+export CNS_NMRMODULE; CNS_NMRMODULE=$CNS_MODULE/nmr
+export CNS_HELPLIB; CNS_HELPLIB=$CNS_SOLVE/helplib
+#
+# general user aliases
+#
+cns_web () { $CNS_SOLVE/bin/cns_web; }
+cns_header () { $CNS_SOLVE/bin/cns_header; }
+cns_info () { cat $CNS_SOLVE/bin/cns_info; }
+cns_transfer () { $CNS_SOLVE/bin/cns_transfer; }
+if [ -x $CNS_SOLVE/bin/cns_edit_local ]; then
+ cns_edit () { $CNS_SOLVE/bin/cns_edit_local; }
+else
+ cns_edit () { $CNS_SOLVE/bin/cns_edit; }
+fi
+#
+# g77 compilation and use
+#
+g77on () { CNS_G77=ON; . $CNS_SOLVE/.cns_solve_env_sh; }
+g77off () { unset CNS_G77; . $CNS_SOLVE/.cns_solve_env_sh; }
+#
+# developer aliases
+#
+run_tests () { $CNS_SOLVE/bin/run_tests; }
+run_diffs () { $CNS_SOLVE/bin/run_diffs; }
+maketar () { $CNS_SOLVE/bin/maketar; }
+create_patch () { $CNS_SOLVE/bin/create_patch; }
+#
+#
+# ==========================================================================
+#
+# to do expansions - unset noglob just in case user has it otherwise
+#
+set +f
+#
+# try to set up appropriate path
+#
+# first strip off any trailing information (eg. _g77)
+#
+CNS_ARCH=`echo ${CNS_ARCH} | sed -e 's/_g77//g'`
+#
+cns_vendor=`echo $CNS_ARCH | awk 'BEGIN{FS="-"}{print $1}'`
+cns_cpu=`echo $CNS_ARCH | awk 'BEGIN{FS="-"}{print $2}'`
+cns_os=`echo $CNS_ARCH | awk 'BEGIN{FS="-"}{print $3}'`
+cns_major=`echo $CNS_ARCH | awk 'BEGIN{FS="-"}{print $4}'`
+cns_minor=`echo $cns_major | sed -e 's/\./ /g'`
+#
+# if we are looking for a specific type of setup then limit search
+#
+cns_dirs=""
+if [ ! "$CNS_G77" ]; then
+ if /bin/ls -d $CNS_SOLVE/$cns_vendor-* >/dev/null 2>&1 ; then
+ cns_dirs="`/bin/ls -d $CNS_SOLVE/$cns_vendor-* 2>&1 | awk 'BEGIN{FS="/"}{print $NF}' | sort -t\- -n -r -k 3 -k 4`"
+ fi
+else
+ CNS_ARCH="${CNS_ARCH}_g77"
+ if /bin/ls -d $CNS_SOLVE/$cns_vendor-*_g77 >/dev/null 2>&1 ; then
+ cns_dirs="`/bin/ls -d $CNS_SOLVE/$cns_vendor-*_g77 2>&1 | awk 'BEGIN{FS="/"}{print $NF}' | sort -t\- -n -r -k 3 -k 4`"
+ fi
+fi
+#
+# first look for an exact match (with os version)
+#
+#
+cns_found=0
+if [ -n "$cns_dirs" ]; then
+ for cns_dir in $cns_dirs ; do
+ cns_tmp_major=`echo $cns_dir | awk 'BEGIN{FS="-"}{print $4}'`
+ if [ -f $CNS_SOLVE/$cns_dir/bin/cns_solve ]; then
+ if [ $cns_dir = ${cns_vendor}-${cns_cpu}-${cns_os}-${cns_major} -o \
+ $cns_dir = ${cns_vendor}-${cns_cpu}-${cns_os}-${cns_major}_g77 ]; then
+ cns_archenv=$cns_dir
+ cns_found=1
+ fi
+ fi
+ done
+#
+#
+# now look for an exact match (without os version)
+#
+ if [ $cns_found -eq 0 ]; then
+ for cns_dir in $cns_dirs ; do
+ if [ -f $CNS_SOLVE/$cns_dir/bin/cns_solve ]; then
+ if [ $cns_dir = ${cns_vendor}-${cns_cpu}-${cns_os} -o \
+ $cns_dir = ${cns_vendor}-${cns_cpu}-${cns_os}_g77 ]; then
+ cns_archenv=$cns_dir
+ cns_found=1
+ fi
+ fi
+ done
+ fi
+#
+# now look for a backwards compatible match (with os version major/minor)
+#
+ if [ $cns_found -eq 0 ]; then
+ for cns_dir in $cns_dirs ; do
+ if [ $cns_found -eq 0 ]; then
+ cns_tmp_major=`echo $cns_dir | awk 'BEGIN{FS="-"}{print $4}' | sed 's/_g77//g'`
+ if [ -f $CNS_SOLVE/$cns_dir/bin/cns_solve ]; then
+ if [ $cns_dir = ${cns_vendor}-${cns_cpu}-${cns_os}-* ]; then
+ osv_test=`echo $cns_major $cns_tmp_major | awk '{if ($1 > $2) print 1}'`
+ if [ $osv_test -eq 1 ]; then
+ cns_archenv=$cns_dir
+ cns_found=1
+ fi
+ fi
+ fi
+ fi
+ done
+ fi
+#
+# now look for a wildcard match on cpu
+#
+ if [ $cns_found -eq 0 ]; then
+ cpu_cpu=`echo $cns_cpu | sed 's/[0-9]*\.*[0-9]*$//'`
+ cpu_ver=`echo $cns_cpu | sed 's/[A-Za-z]*//'`
+ for cns_dir in $cns_dirs ; do
+ if [ $cns_found -eq 0 ]; then
+ cns_tmp_cpu=`echo $cns_dir | awk 'BEGIN{FS="-"}{print $2}' | sed 's/[0-9]*\.*[0-9]*$//'`
+ cns_tmp_ver=`echo $cns_dir | awk 'BEGIN{FS="-"}{print $2}' | sed 's/[A-Za-z]*//'`
+ if [ -f $CNS_SOLVE/$cns_dir/bin/cns_solve ]; then
+ if [ $cns_dir = ${cns_vendor}-${cpu_cpu}*-${cns_os}-${cns_major} -o \
+ $cns_dir = ${cns_vendor}-${cpu_cpu}*-${cns_os}-${cns_major}_g77 ]; then
+ cpu_test=`echo $cpu_ver $cns_tmp_ver | awk '{if ($1 > $2) print 1}'`
+ if [ $cpu_test -eq 1 ]; then
+ cns_archenv=$cns_dir
+ cns_found=1
+ fi
+ fi
+ fi
+ fi
+ done
+ fi
+fi
+#
+# if found set environment
+#
+if [ $cns_found -eq 1 ]; then
+ #
+ # set installation and source directory
+ #
+ export CNS_INST; CNS_INST=$CNS_SOLVE/$cns_archenv
+ export CNS_SOURCE; CNS_SOURCE=$CNS_INST/source
+ #
+ # path for CNSsolve utility programs
+ #
+ if [ -d $CNS_SOLVE/$cns_archenv/utils ]; then
+ export PATH; PATH=`$CNS_SOLVE/bin/modify_path -sh $CNS_SOLVE/$cns_archenv/utils`
+ fi
+ #
+ # path for CNSsolve executable if installed
+ #
+ if [ -d $CNS_SOLVE/$cns_archenv/bin ]; then
+ export PATH; PATH=`$CNS_SOLVE/bin/modify_path -sh $CNS_SOLVE/$cns_archenv/bin`
+ fi
+fi
+#
+unset cns_vendor cns_cpu cns_os cns_major cns_minor cns_tmp_major cns_tmp_minor
+unset cns_dir cns_dirs cns_found cns_archenv cns_diff cns_count cns_same
+unset cpu_cpu cpu_ver cns_tmp_cpu cns_tmp_ver cpu_test osv_test
+#