#!/bin/sh
#
# Copyright by The HDF Group.
# Copyright by the Board of Trustees of the University of Illinois.
# All rights reserved.
#
# This file is part of HDF5.  The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
# Try to locate the software as named in argument.
# This is a sequential search of all possible locations of the software.
# Usage: locate_sw <SW-Name>
# It prints a string showing the paths leading to the include, lib and bin
# directory of the software, separated by colons.  E.g., if the software is
# located in /usr/sdt/*, it prints
# /usr/sdt/include:/usr/sdt/lib:/usr/sdt/bin
# Any component that is not found will be returned as an empty string. E.g.,
# if somehow the header files of the software are not found, it prints
# :/usr/sdt/lib;/usr/sdt/bin
# Function definitions
USAGE()
{
    echo "Usage: locate_sw <SW-Name>"
    echo "    where <SW-Name> can be hdf4, hdf5, zlib"
    echo "    It prints the paths leading the header files (include),"
    echo "    library (lib), and tools (bin).   E.g.,"
    echo "    /usr/sdt/include:/usr/sdt/lib:/usr/sdt/bin"
    echo "    Any component that is not found will be returned as an empty string. E.g.,"
    echo "    if somehow the header files of the software are not found, it prints"
    echo "    :/usr/sdt/lib;/usr/sdt/bin"
    echo "Exit code: 0 if software located; otherwise non-zero"
}
# locate hdf4 software
locate_hdf4()
{
# this default is the best guess of locating hdf4 software
swpaths_defaults="/usr/ncsa /usr/sdt /usr/local"
swpaths=
case "$OSname" in
    SunOS)
        case "$OSrelease" in
            5.7)
               swpaths="/afs/ncsa/packages/hdf/SunOS_5.7"