From 19486da1e9d02b538e24d5989e2b1115535450d4 Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 24 Feb 2005 16:24:07 +0000 Subject: [PATCH] Improve version checking algorithm to provide compilation procedure for Red Hat 9 --- config_files/Python-2.2.1.sh | 26 +++++++++++++++++++++++--- config_files/gcc-3.2.sh | 22 +++++++++++++++++----- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/config_files/Python-2.2.1.sh b/config_files/Python-2.2.1.sh index 9a3a86e..6773f8d 100755 --- a/config_files/Python-2.2.1.sh +++ b/config_files/Python-2.2.1.sh @@ -7,8 +7,11 @@ if [ -z "$PYTHONHOME" ]; then fi isPython=`which python 2>/dev/null` if [ -n isPython ]; then + # version number is calculated as: *10000+*100+ + # e.g. for Python 2.2.1 it is equal to 20201 ver=`python -V 2>&1` - if [ "$ver" = "Python 2.2.1" ] ; then + ver=`echo $ver | awk '{print $2}' | awk -F. '{v1=0;v2=0;v3=0;if(NF>0)v1=$1;if(NF>1)v2=$2;if(NF>2)v3=$3;print v1*10000+v2*100+v3}'` + if [ $ver -eq 20201 ] ; then return 0 fi fi @@ -38,7 +41,17 @@ if [ -z "${pythonhome}" ] ; then fi if [ -n "${pythonhome}" ] ; then pythonhome=`cd ${pythonhome}/..; pwd` - if [ "`${pythonhome}/bin/python -V 2>&1`" == "Python 2.2.1" ] ; then + # get version number: , and + # and numbers are checked strickly, but number can be larger than required one + # version number is calculated as: *10000+*100+ + # e.g. for Python 2.2.1 it is equal to 20201 + ver=`python -V 2>&1` + maj_ver=`echo $ver | awk '{print $2}' | awk -F. '{if(NF>0) print $1; else print 0}'` + min_ver=`echo $ver | awk '{print $2}' | awk -F. '{if(NF>1) print $2; else print 0}'` + rel_ver=`echo $ver | awk '{print $2}' | awk -F. '{if(NF>2) print $3; else print 0}'` + let ver=$maj_ver*10000+$min_ver*100+$rel_ver + if [ $ver -ge 20201 ] ; then +# if [ "`${pythonhome}/bin/python -V 2>&1`" == "Python 2.2.1" ] ; then tmp="\${PYTHONHOME}/lib/python2.2 ${pythonhome}/lib/python2.2 \${PYTHONPATH} ${PYTHONPATH}"; pythonpath=`sort_path ${tmp}` cat > ${INSTALL_WORK}/env_${PRODUCT_TYPE}.sh <*10000+*100+ +# e.g. for gcc 3.2 it is equal to 30200, for gcc 3.3.2 - 30202 +gcc_ver=`gcc -dumpversion | awk -F. '{v1=0;v2=0;v3=0;if(NF>0)v1=$1;if(NF>1)v2=$2;if(NF>2)v3=$3;print v1*10000+v2*100+v3}'` +if [ $gcc_ver -eq 30200 ] ; then return 0 fi return 1 @@ -30,8 +32,15 @@ if [ -z "${gcc_root}" ] ; then fi if [ -n "${gcc_root}" ] ; then gcc_root=`cd ${gcc_root}/..; pwd` - gcc_ver=`gcc -dumpversion | awk -F. '{ print $1 * 1000 + $2 }'` - if [ $gcc_ver -ge 3002 ] ; then + # get version number: , and + # and numbers are checked strickly, but number can be larger than required one + # version number is calculated as: *10000+*100+ + # e.g. for gcc 3.2 it is equal to 30200, for gcc 3.3.2 - 30202 + maj_ver=`gcc -dumpversion | awk -F. '{if(NF>0) print $1; else print 0}'` + min_ver=`gcc -dumpversion | awk -F. '{if(NF>1) print $2; else print 0}'` + rel_ver=`gcc -dumpversion | awk -F. '{if(NF>2) print $3; else print 0}'` + let gcc_ver=$maj_ver*10000+$min_ver*100+$rel_ver + if [ $gcc_ver -ge 30200 ] ; then tmp="\${GCC_ROOT}/bin ${gcc_root}/bin \${PATH} ${PATH}"; path=`sort_path ${tmp}` tmp="\${GCC_ROOT}/lib ${gcc_root}/lib \${LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}"; @@ -46,7 +55,10 @@ export LD_LIBRARY_PATH=${ld_library_path} ## EOF make_env ${INSTALL_ROOT} ${INSTALL_WORK} "${PRODUCT_SEQUENCE}" - if [ $gcc_ver -eq 3002 ] ; then +####### THIS COULD BE USED FOR STRICT COMPARISON ############################## +# if [ $maj_ver -eq 3 ] && [ $min_ver -eq 2 ] && [ $rel_ver -eq 0 ] ; then +###################################################################################### + if [ $maj_ver -eq 3 ] && [ $min_ver -eq 2 ] && [ $rel_ver -ge 0 ] ; then return 0 else return 2 -- 2.39.2