diff -up ./acinclude.m4.old ./acinclude.m4 --- ./acinclude.m4.old 2010-08-02 12:13:27.135937703 -0500 +++ ./acinclude.m4 2010-08-02 12:15:07.896938631 -0500 @@ -157,6 +157,20 @@ AC_SUBST(SFCC_LDFLAGS) # may extend this special exception to the GPL to apply to your # modified version as well. +AC_DEFUN([SWIG_VERSION_GOOD],[ + AC_MSG_NOTICE([SWIG executable is '$SWIG']) + SWIG_LIB=`$SWIG -swiglib` + AC_MSG_NOTICE([SWIG library directory is '$SWIG_LIB']) + SWIG_VERSION=`echo $(( $available_major * 100 * 100 + $available_minor * 100 + $available_patch ))` + AC_MSG_NOTICE([SWIG version is '$SWIG_VERSION']) + # AM_CONDITIONAL(SWIG_NEW_OPTIONS, test "$SWIG_VERSION" \> 10331) +]) + +AC_DEFUN([SWIG_VERSION_BAD],[ + AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version. You should look at http://www.swig.org]) + SWIG='echo "Error: SWIG version >= $1 is required. You have '"$swig_version"'. You should look at http://www.swig.org" ; false' +]) + AC_DEFUN([AC_PROG_SWIG],[ AC_PATH_PROG([SWIG],[swig]) if test -z "$SWIG" ; then @@ -199,19 +213,44 @@ AC_DEFUN([AC_PROG_SWIG],[ if test -z "$available_patch" ; then [available_patch=0] fi - if test $available_major -ne $required_major \ - -o $available_minor -ne $required_minor \ - -o $available_patch -lt $required_patch ; then - AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version. You should look at http://www.swig.org]) - SWIG='echo "Error: SWIG version >= $1 is required. You have '"$swig_version"'. You should look at http://www.swig.org" ; false' - else - AC_MSG_NOTICE([SWIG executable is '$SWIG']) - SWIG_LIB=`$SWIG -swiglib` - AC_MSG_NOTICE([SWIG library directory is '$SWIG_LIB']) - SWIG_VERSION=`echo $(( $available_major * 100 * 100 + $available_minor * 100 + $available_patch ))` - AC_MSG_NOTICE([SWIG version is '$SWIG_VERSION']) - # AM_CONDITIONAL(SWIG_NEW_OPTIONS, test "$SWIG_VERSION" \> 10331) - fi + + + + if test $available_major -gt $required_major; then + # the available major is greater than required major --GOOD + SWIG_VERSION_GOOD() + + elif test $available_major -lt $required_major ; then + # the avialable major is less than required major -- BAD + SWIG_VERSION_BAD() + else + # the available and require major are equal check the minor and patch versions. + + if test $available_minor -gt $required_minor ; then + # GOOD + SWIG_VERSION_GOOD() + elif test $avaialble_minor -lt $required_minor ; then + # BAD + SWIG_VERSION_BAD() + else + # the minor version are also equal + + if test $available_patch -gt $required_patch ; then + # GOOD + SWIG_VERSION_GOOD() + elif test $available_minor -lt $required_minor ; then + # BAD + SWIG_VERSION_BAD() + else + # all the available major, minor and patch levels are the same as the required -- GOOD + SWIG_VERSION_GOOD() + fi + fi + fi + + + + else AC_MSG_WARN([cannot determine SWIG version]) SWIG='echo "Error: Cannot determine SWIG version. You should look at http://www.swig.org" ; false'