@@ -154,23 +154,45 @@ else
154154fi
155155AM_CONDITIONAL([ WITH_GDAL] , test "x$with_gdal" != "xno")
156156
157-
157+ # SWIG
158158# -------------------------------------------------------------------------------------
159- AC_ARG_VAR ( [ SWIG] ,[ path to swig, python api generator] )
160- AC_PATH_PROG ( [ SWIG] ,[ swig] ,[ ] )
161- if test "x$SWIG" = "x"; then
162- AC_MSG_ERROR ( [ swig is not found, set SWIG variable!] )
163- fi
164- SWIG_VERSION=`$SWIG -version|grep ersion|cut -d ' ' -f 3`
165- SWIG_VERSION_MAJOR=`echo $SWIG_VERSION|cut -d . -f1`
166- if test "x$SWIG_VERSION_MAJOR" != "x3"; then
167- AC_MSG_ERROR ( [ swig is too old should be at least 3.0, set SWIG variable for custom location!] )
168- fi
169- AC_MSG_NOTICE ( [ swig version: $SWIG_VERSION] )
159+ AC_ARG_WITH ( swig ,
160+ AS_HELP_STRING ( [ --with-swig=<path to swig executable>] ,
161+ [ Specify path to SWIG executable. ]
162+ [ If set will (re)generate python API, otherwise will try to use previously generated sources. ]
163+ [ Note that github repository do not track them.] ) ,)
164+ # only developers/advanced user should call swig
165+ # the public source code releases should come with swig generated files
166+ if test -n "$with_swig"; then
167+ SWIG=$with_swig
168+ AC_PATH_PROG ( [ SWIG] ,[ swig] ,[ ] )
169+ if test "x$SWIG" = "x"; then
170+ AC_MSG_ERROR ( [ swig is not found, set SWIG variable!] )
171+ fi
172+ SWIG_VERSION=`$SWIG -version|grep ersion|cut -d ' ' -f 3`
173+ SWIG_VERSION_MAJOR=`echo $SWIG_VERSION|cut -d . -f1`
174+ if test "x$SWIG_VERSION_MAJOR" != "x3"; then
175+ AC_MSG_ERROR ( [ swig is too old should be at least 3.0, set SWIG variable for custom location!] )
176+ fi
177+ AC_MSG_NOTICE ( [ swig: $SWIG] )
178+ AC_MSG_NOTICE ( [ swig version: $SWIG_VERSION] )
179+ else
180+ # check for swig generated files presence
181+ AC_CHECK_FILE ( $srcdir/src/main/cxxtitan_wrap.cxx ,
182+ AC_MSG_NOTICE ( [ found cxxtitan_wrap.cxx] ) ,
183+ AC_MSG_FAILURE ( [ Couldn't find SWIG generated python API sources.]
184+ [ Set --with-swig to SWIG to regenerate interface.] )
185+ )
186+ AC_CHECK_FILE ( $srcdir/src/main/cxxtitan.py ,
187+ AC_MSG_NOTICE ( [ found cxxtitan_wrap.cxx] ) ,
188+ AC_MSG_FAILURE ( [ Couldn't find SWIG generated python API sources.]
189+ [ Set --with-swig to SWIG to regenerate interface.] )
190+ )
191+ fi
192+ AM_CONDITIONAL([ WITH_SWIG] , test "x$with_swig" != "xno")
170193
171194# -------------------------------------------------------------------------------------
172195AC_CHECK_LIB ( m ,matherr )
173- AC_CHECK_LIB ( nsl , inet_ntoa )
174196
175197# # Checks for header files
176198# =====================================================================================
0 commit comments