dnl Available from the GNU Autoconf Macro Archive at:
dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_pkg_swig.html
dnl
dnl renamed from ac_pkg_swig to ax_swig
AC_DEFUN([AX_SWIG],
[
SWIG_REQUEST_VERSION=
changequote(<<, >>)
for a in $1 $2 $3 $4 $5 $6 $7 $8 $9 x; do
case "$a" in
x) break;;
[0-9]*.[0-9]*.[0-9]*) SWIG_REQUEST_VERSION="$a";;
c++) SWIGFLAGS="$SWIGFLAGS -c++";;
raw) SWIGFLAGS="$SWIGFLAGS -c";;
esac
done
changequote([, ])
PATH_save="$PATH"
PATH="$PATH:/opt/casa/03/bin:/opt/casa/02/bin:/opt/local/bin:/usr/local/bin"
AC_PATH_PROGS(SWIG,swig3 swig)
if test -n "$SWIG";
then
SWIGLIB=`$SWIG -swiglib`
AC_SUBST(SWIG)
AC_SUBST(SWIGLIB)
AC_SUBST(SWIGFLAGS)
AC_MSG_CHECKING(swig version)
changequote(<<, >>)
swig_version=`$SWIG -version 2>&1 | sed 's/.* \([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p; d'`
swig_major_ver=`echo $swig_version | sed 's/^\([0-9][0-9]*\).*/\1/'`
swig_minor_ver=`echo $swig_version | sed 's/^[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/'`
swig_micro_ver=`echo $swig_version | sed 's/^[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/'`
changequote([, ])
AC_MSG_RESULT($swig_version)
SWIGVERNUM=`printf "%02d%02d%02d" $swig_major_ver $swig_minor_ver $swig_micro_ver`
# SWIGVERNUM=`echo $SWIG_REQUEST_VERSION | awk '{ split($[1],a,"\."); print [a[1]*1000000+a[2]*1000+a[3]] }' 2>/dev/null`
if test -n "$SWIG_REQUEST_VERSION";
then
AC_MSG_CHECKING(requested swig version ($SWIG_REQUEST_VERSION))
changequote(<<, >>)
swig_major_req=`expr $SWIG_REQUEST_VERSION : '\([0-9]*\)\.[0-9]*\.[0-9]*'`
swig_minor_req=`expr $SWIG_REQUEST_VERSION : '[0-9]*\.\([0-9]*\)\.[0-9]*'`
swig_micro_req=`expr $SWIG_REQUEST_VERSION : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
changequote([, ])
if test $swig_major_ver -ge $swig_major_req &&
test $swig_minor_ver -ge $swig_minor_req &&
test $swig_micro_ver -ge $swig_micro_req
then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_CHECKING(looking in the rest of PATH)
AC_MSG_RESULT()
while test "x$SWIG" != "x"; do
## save paths to things we need before we ruin PATH
swig_sed=`which sed`
swig_expr=`which expr`
swig_dirname=`which dirname`
## unset cache flag
unset ac_cv_path_SWIG
## save unsuccessful path
baddir=`$swig_dirname $SWIG`
## unset user override
unset SWIG
## remove unsuccessful path
old_path=`echo $PATH | $swig_sed 's|:| |g'`
PATH=""
for p in $old_path; do
if test "$baddir" != "$p"; then
if test "x$PATH" = "x"; then
PATH="$p"
else
PATH="$PATH:$p"
fi
fi
done
AC_PATH_PROG(SWIG,swig)