#!/bin/sh
# Create the S-PLUS Library files from the *.pre files in $INSTALL_DIR
# This routine is called from the CONFIGURE shell script, which sets a
# number of default environment variables

# Test for more restrictive file system than that for which S-PLUS is built.
# If we're installing on a more restrictive system, give warning.

# set S_LONGTESTNAME
. "$SHOME"/splus/lib/install/env.var
# S_LONGTESTNAME should start with "z4q9p"
# and be one less than MAX_FILE_NAME_LEN

if test x"$S_LONGTESTNAME" != x""
then
    HERE=`pwd`
    cd "$SHOME"

    rm -f z4q9p* >/dev/null 2>&1
    cat >$S_LONGTESTNAME <<EOF
This file is a test for more restrictive file system than that for
which S-PLUS is built.
EOF

    lsres=`ls z4q9p* 2>/dev/null`
    rm -f z4q9p* >/dev/null 2>&1

    if test x"$lsres" != x"$S_LONGTESTNAME"
    then
        cat <<EOF

It appears that you are installing S-PLUS on a file system which has
more restrictive file names than the file system for which this
version of S-PLUS is built.

The directory you are installing to is "$SHOME".

S-PLUS may not work correctly if installed on this file system,
because S-PLUS object names may be truncated (or altered) in the
installation.

EOF
echo-n "Press <return> to continue: "
    read xx

    fi
    cd "$HERE"
fi

# Source file with S-Plus Default Environment variables
. "$SHOME"/splus/lib/install/USER.env

# warn the user if no value for S_LIB_STATIC

if test x"$S_LIB_STATIC" = x
then
    cat <<EOF
Warning: Unable to determine the proper system library specification to 
use when statically loading code.  If you have compilers installed and wish
to statically load code, run CONFIGURE again, select option number 4 from
the main menu, and specify the appropriate libraries.  For information
on how to determine the appropriate library specification, see the section
"Libraries For Dynamic and Static Loading" in the S-PLUS Installation and
Maintenance Manual.

EOF
echo-n "Press <return> to continue: "
    read xx
fi

# warn the user if no value for S_LIB_DYNLOAD2

if test x"$S_LIB_DYNLOAD2" = x
then
    cat <<EOF
Warning: I do not have a library specification to use when doing dynamic
loading with dyn.load2.  If you do not fix this, dynamic loading with
dyn.load2 will not work, so you will not be able to incorporate your own
external C or Fortran routines into S-PLUS with this method.  To fix it,
you must run the SETUP script, select the View/Modify defaults option, and
set the library specification to use.  Please see the section titled
"Libraries For Dynamic Loading with dyn.load2 and Static Loading" in the
Installation Chapter of the S-PLUS User's Manual for information on how to
set the library specification.  Note that the shell script mentioned in
the manual is wrong, it should be: splus/lib/install/LIB_HINT.

EOF
echo-n "Press <return> to continue: "
    read xx
fi

exit 0
