#!/bin/sh ########################################################################## # This program is the CONFIDENTIAL and PROPRIETARY property # of Mainsoft(R) Corporation. Any unauthorized use, reproduction # or transfer of this computer program is strictly prohibited. # # Copyright (c) 2000 Mainsoft Corporation. # This is an unpublished work, and is subject to limited distribution # and restricted disclosure only. ALL RIGHTS RESERVED. # ########################################################################## # # validate_compiler.sunos5 # # This script is to be run from VMW client GUI, # it performs verification of compilers settings on Solaris # ########################################################################## status=0 exec 1>&2 ## redirect stdout to stderr # Test 1. Verify MWCC* environment variables existence case $MWOS in ux11) VARIABLES="MWCCPP_HOME MWCCPP MWCCPP_INCLUDE_DIR MWCC_HOME MWCC" ;; *) VARIABLES="MWCCPP_HOME MWCCPP MWCCPP_INCLUDE_DIR MWCC_HOME MWCC MWCC_INCLUDE_DIR" ;; esac for var in `echo $VARIABLES` do value=`eval echo $"${var:-}"` if [ -z "$value" ] ;then status=1 break fi done # Test 2. Verify MWCC directories and executables existence if [ ! -d "$MWCC_HOME" ] ;then echo "Invalid compiler home '${MWCC_HOME}': Directory does not exist." exit 1 fi if [ ! -d "$MWCCPP_HOME" ] ;then echo "Invalid compiler home '${MWCCPP_HOME}': Directory does not exist." exit 1 fi if [ ! -x "$MWCCPP" ] ;then echo "Invalid compiler home '${MWCCPP_HOME}':" echo "Expected the C++ compiler at: '${MWCCPP}'" echo "No such file found or file found but is not an executable." exit 1 fi if [ ! -x "$MWCC" ] ;then echo "Invalid compiler home '${MWCC_HOME}':" echo "Expected the C compiler at: '${MWCC}'" echo "No such file found or file found but is not an executable." exit 1 fi case $MWOS in linux) INCLUDE_CC="include/c++" INCLUDE_cc="include/c++" ;; ux11) INCLUDE_CC="include/iostream" ;; aix4) ;; *) INCLUDE_CC="include/CC" INCLUDE_cc="include/cc" ;; esac case $MWOS in ux11) if [ -z "${MWCCPP_INCLUDE_DIR:-}" ] && [ ! -d "${MWCCPP_HOME}/include" ]; then echo "Invalid compiler home '${MWCCPP_HOME}':" echo "The subdirectory 'include' does not exist." exit 1 fi ;; *) if [ -z "${MWCC_INCLUDE_DIR:-}" ] || [ -z "${MWCCPP_INCLUDE_DIR:-}" ] && [ ! -d "${MWCC_HOME}/include" ]; then echo "Invalid compiler home '${MWCC_HOME}':" echo "The subdirectory 'include' does not exist." exit 1 fi ;; esac INCLUDE_CC_CHECK=""; INCLUDE_cc_CHECK=""; #create list of checks for all include dirs for dir in `echo ${INCLUDE_CC:-} | sed 's/:/ /g'` do if [ "$INCLUDE_CC_CHECK" = "" ];then INCLUDE_CC_CHECK="[ ! -d \"${MWCCPP_HOME}/$dir\" ]" else INCLUDE_CC_CHECK="$INCLUDE_CC_CHECK && [ ! -d \"${MWCCPP_HOME}/$dir\" ]" fi done case $MWOS in ux11) ;; * ) for dir in `echo ${INCLUDE_cc:-} | sed 's/:/ /g'` do if [ "$INCLUDE_cc_CHECK" = "" ];then INCLUDE_cc_CHECK="[ ! -d \"${MWCC_HOME}/$dir\" ]" else INCLUDE_cc_CHECK="$INCLUDE_cc_CHECK && [ ! -d \"${MWCC_HOME}/$dir\" ]" fi done if [ -z "${MWCC_INCLUDE_DIR:-}" ] && eval $INCLUDE_cc_CHECK ; then echo "Invalid compiler home '${MWCC_HOME}':" echo "The subdirectory '$INCLUDE_cc' does not exist." exit 1 fi ;; esac if [ -z "${MWCCPP_INCLUDE_DIR:-}" ] && eval $INCLUDE_CC_CHECK ; then echo "Invalid compiler home '${MWCCPP_HOME}':" echo "The subdirectory '$INCLUDE_CC' does not exist." exit 1 fi if [ $status != 0 ] ;then echo "Compiler setup failed, please make sure the compiler home is defined correctly." exit 1 fi # Test 3. Verify versions of compilers case $MWCONFIG_NAME in linux) VERSION_CC_COMMAND=`$MWCCPP -dumpversion` VERSION_cc_COMMAND=`$MWCC -dumpversion` ;; sunos5) VERSION_CC_COMMAND=`$MWCCPP -V 2>&1 | sed -n 's/^CC:.* C++[ ]*\([^ ]*\).*/\1/p'` VERSION_cc_COMMAND=`$MWCC -V 2>&1 | sed -n 's/^cc:.* C[ ]*\([^ ]*\).*/\1/p'` ;; ux11) case `uname -r` in ?.11.00) VERSION_CC_COMMAND=`what $MWCCPP 2>&1 |awk 'NR==2 {print $NF}'` VERSION_cc_COMMAND=`what $MWCC 2>&1 | awk 'NR==2 {print $4}'` ;; ?.11.11) VERSION_CC_COMMAND=`what $MWCCPP 2>&1 | awk '/aC\+\+/ {print $4;exit}'` VERSION_cc_COMMAND=`what $MWCC 2>&1 | awk 'NR==4 {print $2}'` ;; esac ;; ia64_ux11) VERSION_CC_COMMAND=`$MWCCPP -V 2>&1 | sed -n -e 's/^.* [A-Z][0-9A-Z]\{1,\} \(A[0-9\.]\{1,\}\) .*$/\1/p'` VERSION_cc_COMMAND=`$MWCC -V 2>&1 | sed -n -e 's/^.* [A-Z][0-9A-Z]\{1,\} \(A[0-9\.]\{1,\}\) .*$/\1/p'` ;; aix4) VERSION_CC_COMMAND=`$MWCCPP -qversion | awk '{print $NF}'` VERSION_cc_COMMAND=`$MWCC -qversion | awk '{print $NF}'` ;; *);; esac version=$VERSION_CC_COMMAND minorver=`echo $version | awk -F. '{print $2}'` case $MWCONFIG_NAME in sunos5) case `uname -r` in 5.6) if [ "$version" != "5.3" ];then echo "C++ Compiler version mismatch." echo " Version found: $version" echo " Version required: 5.3" status=1 fi ;; 5.7|5.8|5.9|5.10) if [ 3 -gt "$minorver" -o "$minorver" -gt 7 ] ;then echo "C++ Compiler version mismatch." echo " Version found: $version" echo " Version required: 5.3 to 5.7" status=1 fi ;; esac if expr "$version" "<" "5.3" > /dev/null then exit 1 fi ;; linux) shortversion=`echo $version|awk -F. '{print $1"."$2}'` if [ "$version" != "3.2" -a "$shortversion" != "3.3" ] ;then echo " Version found: $version" echo " Version required: 3.2 or 3.3.*" status=1 elif [ "$version" = "3.2" ]; then check=`$MWCCPP -v 2>&1 | awk 'NR==4 {print $0}' |grep "fixed by Mainsoft"` if [ "$check" = "" ];then echo "C++ Compiler version mismatch." echo "Use compiler fixed by Mainsoft 20040316" status=1 fi fi ;; aix4) version=`echo $version|sed 's/\.[^.]*$//'` case `oslevel` in 4.3*) if [ "$version" != "5.0.2" ] ;then echo "C++ Compiler version mismatch." echo " Version found: $version" echo " Version required: 5.0.2" status=1 fi ;; 5.1*|5.2*) if [ "$version" != "5.0.2" -a "$version" != "6.0.0" -a "$version" != "V7" ];then echo "C++ Compiler version mismatch." echo " Version found: $version" echo " Version required: 5.0.2 or 6.0.0 or 7.0.0" status=1 fi ;; esac if expr "$version" "<" "5.0.2" >/dev/null then exit 1 fi ;; ux11) if [ "$version" != "A.03.31" -a "$version" != "A.03.39" -a "$version" != "A.03.45" -a "$version" != "A.03.55" ] ;then echo "C++ Compiler version mismatch." echo " Version found: $version" echo " Version required: A.03.31 or A.03.39 or A.03.45 or A.03.55" status=1 fi if expr "$version" "<" "A.03.31" >/dev/null then exit 1 fi ;; ia64_ux11) if [ "$version" != "A.05.50" -a "$version" != "A.05.56" -a "$version" != "A.06.01" ] ;then echo "C++ Compiler version mismatch." echo " Version found: $version" echo " Version required: A.05.50 or A.05.56 or A.06.01 " status=1 fi if expr "$version" "<" "A.05.50" >/dev/null then exit 1 fi ;; *) ;; esac version=$VERSION_cc_COMMAND minorver=`echo $version | awk -F. '{print $2}'` case $MWCONFIG_NAME in sunos5) case `uname -r` in 5.6) if [ "$version" != "5.3" ];then echo "C Compiler version mismatch." echo " Version found: $version" echo " Version required: 5.3" status=1 fi ;; 5.7|5.8|5.9|5.10) if [ 3 -gt "$minorver" -o "$minorver" -gt 7 ] ;then echo "C Compiler version mismatch." echo " Version found: $version" echo " Version required: 5.3 to 5.7" status=1 fi ;; esac if expr "$version" "<" "5.3" >/dev/null then exit 1 fi ;; linux) shortversion=`echo $version|awk -F. '{print $1"."$2}'` if [ "$version" != "3.2" -a "$shortversion" != "3.3" ] ;then echo " Version found: $version" echo " Version required: 3.2 or 3.3.*" status=1 elif [ "$version" = "3.2" ]; then check=`$MWCCPP -v 2>&1 | awk 'NR==4 {print $0}' |grep "fixed by Mainsoft"` if [ "$check" = "" ];then echo "C Compiler version mismatch." echo "Use compiler fixed by Mainsoft 20040316" status=1 fi fi ;; aix4) version=`echo $version|sed 's/\.[^.]*$//'` case `oslevel` in 4.3*) if [ "$version" != "5.0.2" ] ;then echo "C Compiler version mismatch." echo " Version found: $version" echo " Version required: 5.0.2" status=1 fi ;; 5.1*|5.2*) if [ "$version" != "5.0.2" -a "$version" != "6.0.0" -a "$version" != "V7" ];then echo "C Compiler version mismatch." echo " Version found: $version" echo " Version required: 5.0.2 or 6.0.0 or 7.0.0" status=1 fi ;; esac if expr "$version" "<" "5.0.2" >/dev/null then exit 1 fi ;; ux11) case `uname -r` in [AB].11.00) if [ "$version" != "B.11.11.02" ] ;then echo "C Compiler version mismatch." echo " Version found: $version" echo " Version required: B.11.11.02" status=1 fi if expr "$version" "<" "B.11.11.02" >/dev/null then exit 1 fi ;; [AB].11.11) if [ "$version" != "B.11.11.04" -a "$version" != "B.11.11.06" -a "$version" != "B.11.11.10" ] ;then echo "C Compiler version mismatch." echo " Version found: $version" echo " Version required: B.11.11.04 or B.11.11.06 or B.11.11.10" status=1 fi if expr "$version" "<" "B.11.11.04" >/dev/null then exit 1 fi ;; esac ;; ia64_ux11) # For now MWCC=MWCCPP as we use aCC with flags to compile C files # So we want to check version of C++ (A.05.50 or A.05.56) # and not C (A.05.41) if [ "$version" != "A.05.50" -a "$version" != "A.05.56" -a "$version" != "A.06.01" ] ;then echo "C Compiler version mismatch." echo " Version found: $version" echo " Version required: A.05.50 or A.05.56 or A.06.01 " status=1 fi if expr "$version" "<" "A.05.50" >/dev/null then exit 1 fi ;; *) ;; esac # Test 4. Verify validity of license files (don't exit on error) # for file in `echo ${LM_LICENSE_FILE:-} | sed 's/:/ /g'` do file "$file" | egrep "text" >/dev/null || echo "Invalid format of the license file \"$file\"" done # Test 5. Basic compiler test (trying to compile a simple file) TMPDIR=${TMPDIR:-/var/tmp} if [ ! -d "$TMPDIR" ] ;then echo "Cannot find TMPDIR directory \"$TMPDIR\"" exit 1 fi cd "$TMPDIR" tmpfile="tmp$$" touch $tmpfile.cpp $MWCCPP -c $tmpfile.cpp 2> $tmpfile.log if [ $? -ne 0 ] ;then echo "Failed basic C++ compiler test, details follow:" cat $tmpfile.log rm -f $tmpfile.* exit 1 fi touch $tmpfile.c $MWCC -c $tmpfile.c 2> $tmpfile.log if [ $? -ne 0 ] ;then echo "Failed basic C compiler test, details follow:" cat $tmpfile.log rm -f $tmpfile.* exit 1 fi # Test 6. Compiler test for mandatory patch rm -f $tmpfile.* case $MWOS in linux) echo '#include ' > $tmpfile.cpp echo '#include ' >> $tmpfile.cpp ;; *) echo '#include ' > $tmpfile.cpp echo '#include ' >> $tmpfile.cpp ;; esac $MWCCPP -c $tmpfile.cpp 2>/dev/null if [ $? -ne 0 ] ;then echo "Compiler mandatory patches test failed." echo "Refer to the VisualMainwin release notes or use the MainWin utility" echo "'mwcheck_platform -compiler' on the host where the compiler was installed" echo "to make sure your compiler installation stands up to requirements." rm -f $tmpfile.* exit 1 fi # Test 7. cl.exe compiler basic test cl.exe /c $tmpfile.cpp 1>/dev/null 2> $tmpfile.log if [ $? -ne 0 ] ;then echo "CL.EXE basic test failed with the following message:" cat $tmpfile.log rm -f $tmpfile.* exit 1 fi rm -f $tmpfile.* # Test 8. test for AIX to check if compiler support # lines if [ $MWOS = "aix4" ];then cd "$TMPDIR" echo "#line 1 \"a.cpp\"" > $tmpfile.i echo "__LINE__" >> $tmpfile.i $MWCCPP $tmpfile.i 1>/dev/null 2> $tmpfile.log test=`grep "a.cpp" $tmpfile.log 2> /dev/null` if [ "$test" = "" ];then echo "Error : This version of the Visual Age C++ compiler" echo "does not support the #line preprocessor directive." echo "Please install the IBM fix." echo "For more information, see the Release Notes." status=1 fi # rm -f $tmpfile.* fi # Test 9. test for AIX to check if stdlib.h is correct if [ $MWOS = "aix4" ];then cd "$TMPDIR" echo "#include " > $tmpfile.C echo "void main(){}" >> $tmpfile.C $MWCCPP $tmpfile.C 1> /dev/null 2> $tmpfile.log if [ $? != 0 ];then echo "/usr/vacpp/include/stdlib.h file is broken (see MainWin Release Notes)." rm -f $tmpfile.* exit 1 fi fi exit $status ### the last line