Autogenerate SWIG dependencies

Require SWIG >= 2.0

Closes #505
This commit is contained in:
Derek Bankieris 2019-05-29 09:02:47 -05:00
parent 295b9e3285
commit 99d856a17f
3 changed files with 91 additions and 16 deletions

View File

@ -126,8 +126,7 @@ AC_DEFUN([AX_GTEST_HOME],[
AC_DEFUN([AX_SWIG_BIN],[ AC_DEFUN([AX_SWIG_BIN],[
AC_ARG_WITH([swig], AC_ARG_WITH([swig],
AS_HELP_STRING([--with-swig@<:@=DIR@:>@], [path of directory containing the SWIG executable.]), AS_HELP_STRING([--with-swig@<:@=DIR@:>@], [path of directory containing the SWIG executable.]),
SWIG_BIN="$withval", PATH="$withval:${PATH}"
SWIG_BIN=/bin:/usr/bin:/usr/local/bin:/sw/bin
) )
AC_SUBST([SWIG_BIN]) AC_SUBST([SWIG_BIN])
]) ])
@ -256,8 +255,7 @@ AS_IF([test "$ac_cv_path_PYTHON" = "nopython"],AC_MSG_ERROR([could not find pyth
AC_PATH_PROG(GNUPLOT, gnuplot, nognuplot) AC_PATH_PROG(GNUPLOT, gnuplot, nognuplot)
AS_IF([test "$ac_cv_path_GNUPLOT" = "nognuplot"],AC_MSG_NOTICE([could not find gnuplot]),[]) AS_IF([test "$ac_cv_path_GNUPLOT" = "nognuplot"],AC_MSG_NOTICE([could not find gnuplot]),[])
AX_SWIG_BIN([]) AX_SWIG_BIN([])
AC_PATH_PROG(SWIG, swig, noswig, $SWIG_BIN) AX_PKG_SWIG(2.0, [], [AC_MSG_ERROR([Trick requires SWIG version >= 2.0])])
AS_IF([test "$ac_cv_path_SWIG" = "noswig"],AC_MSG_ERROR([could not find swig]),[])
AX_JAVA AX_JAVA
dnl look for libraries and headers we need to compile dnl look for libraries and headers we need to compile
AC_PATH_X AC_PATH_X

93
configure vendored
View File

@ -660,6 +660,7 @@ ac_ct_JAVA_CC
JAVA_CC_FLAGS JAVA_CC_FLAGS
JAVA_CC JAVA_CC
USE_JAVA USE_JAVA
SWIG_LIB
SWIG SWIG
SWIG_BIN SWIG_BIN
GNUPLOT GNUPLOT
@ -4136,16 +4137,18 @@ fi
# Check whether --with-swig was given. # Check whether --with-swig was given.
if test "${with_swig+set}" = set; then : if test "${with_swig+set}" = set; then :
withval=$with_swig; SWIG_BIN="$withval" withval=$with_swig; PATH="$withval:${PATH}"
else
SWIG_BIN=/bin:/usr/bin:/usr/local/bin:/sw/bin
fi fi
# Extract the first word of "swig", so it can be a program name with args.
set dummy swig; ac_word=$2 # Find path to the "swig" executable.
for ac_prog in swig swig3.0 swig2.0
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; } $as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_SWIG+:} false; then : if ${ac_cv_path_SWIG+:} false; then :
@ -4157,7 +4160,7 @@ else
;; ;;
*) *)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $SWIG_BIN for as_dir in $PATH
do do
IFS=$as_save_IFS IFS=$as_save_IFS
test -z "$as_dir" && as_dir=. test -z "$as_dir" && as_dir=.
@ -4171,7 +4174,6 @@ done
done done
IFS=$as_save_IFS IFS=$as_save_IFS
test -z "$ac_cv_path_SWIG" && ac_cv_path_SWIG="noswig"
;; ;;
esac esac
fi fi
@ -4185,9 +4187,80 @@ $as_echo "no" >&6; }
fi fi
if test "$ac_cv_path_SWIG" = "noswig"; then : test -n "$SWIG" && break
as_fn_error $? "could not find swig" "$LINENO" 5 done
fi
if test -z "$SWIG" ; then
as_fn_error $? "Trick requires SWIG version >= 2.0" "$LINENO" 5
elif test -n "2.0" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking SWIG version" >&5
$as_echo_n "checking SWIG version... " >&6; }
swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $swig_version" >&5
$as_echo "$swig_version" >&6; }
if test -n "$swig_version" ; then
# Calculate the required version number components
required=2.0
required_major=`echo $required | sed 's/[^0-9].*//'`
if test -z "$required_major" ; then
required_major=0
fi
required=`echo $required | sed 's/[0-9]*[^0-9]//'`
required_minor=`echo $required | sed 's/[^0-9].*//'`
if test -z "$required_minor" ; then
required_minor=0
fi
required=`echo $required | sed 's/[0-9]*[^0-9]//'`
required_patch=`echo $required | sed 's/[^0-9].*//'`
if test -z "$required_patch" ; then
required_patch=0
fi
# Calculate the available version number components
available=$swig_version
available_major=`echo $available | sed 's/[^0-9].*//'`
if test -z "$available_major" ; then
available_major=0
fi
available=`echo $available | sed 's/[0-9]*[^0-9]//'`
available_minor=`echo $available | sed 's/[^0-9].*//'`
if test -z "$available_minor" ; then
available_minor=0
fi
available=`echo $available | sed 's/[0-9]*[^0-9]//'`
available_patch=`echo $available | sed 's/[^0-9].*//'`
if test -z "$available_patch" ; then
available_patch=0
fi
# Convert the version tuple into a single number for easier comparison.
# Using base 100 should be safe since SWIG internally uses BCD values
# to encode its version number.
required_swig_vernum=`expr $required_major \* 10000 \
\+ $required_minor \* 100 \+ $required_patch`
available_swig_vernum=`expr $available_major \* 10000 \
\+ $available_minor \* 100 \+ $available_patch`
if test $available_swig_vernum -lt $required_swig_vernum; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: SWIG version >= 2.0 is required. You have $swig_version." >&5
$as_echo "$as_me: WARNING: SWIG version >= 2.0 is required. You have $swig_version." >&2;}
SWIG=''
as_fn_error $? "Trick requires SWIG version >= 2.0" "$LINENO" 5
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SWIG library" >&5
$as_echo_n "checking for SWIG library... " >&6; }
SWIG_LIB=`$SWIG -swiglib`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SWIG_LIB" >&5
$as_echo "$SWIG_LIB" >&6; }
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot determine SWIG version" >&5
$as_echo "$as_me: WARNING: cannot determine SWIG version" >&2;}
SWIG=''
as_fn_error $? "Trick requires SWIG version >= 2.0" "$LINENO" 5
fi
fi
# Check whether --enable-java was given. # Check whether --enable-java was given.
if test "${enable_java+set}" = set; then : if test "${enable_java+set}" = set; then :

View File

@ -259,10 +259,14 @@ build/top.i: build/CP_instances
SWIG_SRC = \$(subst .i,.cpp,\$(SWIG_I)) $swig_src_dir/top.cpp SWIG_SRC = \$(subst .i,.cpp,\$(SWIG_I)) $swig_src_dir/top.cpp
\$(SWIG_SRC) : %.cpp: %.i | \$(SWIG_I) \$(SWIG_SRC) : %.cpp: %.i %.d | \$(SWIG_I)
\t\$(PRINT_SWIG) \t\$(PRINT_SWIG)
\t\@echo \$(SWIG) \$(TRICK_INCLUDE) \$(TRICK_DEFINES) \$(TRICK_VERSIONS) \$(TRICK_SWIG_FLAGS) -c++ -python -includeall -ignoremissing -w201,303,325,362,389,401,451 -outdir trick -o \$@ \$< >> \$(MAKE_OUT) \t\@echo \$(SWIG) \$(TRICK_INCLUDE) \$(TRICK_DEFINES) \$(TRICK_VERSIONS) \$(TRICK_SWIG_FLAGS) -c++ -python -includeall -ignoremissing -w201,303,325,362,389,401,451 -outdir trick -o \$@ \$< >> \$(MAKE_OUT)
\t\$(ECHO_CMD)\$(SWIG) \$(TRICK_INCLUDE) \$(TRICK_DEFINES) \$(TRICK_VERSIONS) \$(TRICK_SWIG_FLAGS) -c++ -python -includeall -ignoremissing -w201,303,325,362,389,401,451 -outdir trick -o \$@ \$< 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]} \t\$(ECHO_CMD)\$(SWIG) \$(TRICK_INCLUDE) \$(TRICK_DEFINES) \$(TRICK_VERSIONS) \$(TRICK_SWIG_FLAGS) -c++ -python -includeall -ignoremissing -w201,303,325,362,389,401,451 -MMD -MP -outdir trick -o \$@ \$< 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}
\$(SWIG_SRC:.cpp=.d): ;
-include \$(SWIG_SRC:.cpp=.d)
SWIG_SRC_CUSTOM_OUTDIR = \$(subst .i,.cpp,\$(SWIG_I_CUSTOM_OUTDIR))\n" ; SWIG_SRC_CUSTOM_OUTDIR = \$(subst .i,.cpp,\$(SWIG_I_CUSTOM_OUTDIR))\n" ;