[mapserver-commits] r12917 - in trunk/mapserver: . m4
mapscript/python
svn at osgeo.org
svn at osgeo.org
Fri Dec 23 12:52:13 EST 2011
Author: tbonfort
Date: 2011-12-23 09:52:13 -0800 (Fri, 23 Dec 2011)
New Revision: 12917
Added:
trunk/mapserver/m4/ax_pkg_swig.m4
Modified:
trunk/mapserver/Makefile.in
trunk/mapserver/configure
trunk/mapserver/configure.in
trunk/mapserver/mapscript/python/Makefile.in
Log:
add --enable-python-mapscript and --with-python=[path] to configure script. check for swig.
Modified: trunk/mapserver/Makefile.in
===================================================================
--- trunk/mapserver/Makefile.in 2011-12-23 16:45:22 UTC (rev 12916)
+++ trunk/mapserver/Makefile.in 2011-12-23 17:52:13 UTC (rev 12917)
@@ -320,7 +320,7 @@
#
# --- You shouldn't have to edit anything else. ---
#
-all: $(LIBMAP) $(EXE_LIST) @MAKE_PHPMS@
+all: $(LIBMAP) $(EXE_LIST) @MAKE_PHP_MAPSCRIPT@ @MAKE_PYTHON_MAPSCRIPT@
EXE_LDFLAGS = $(LIBMAP)
# Explicitly invoke this rule when maplexer.l is altered. We don't do
@@ -356,9 +356,6 @@
.cpp.$(OBJ_SUFFIX): mapserver.h
$(LTCXX) $(CXX) -c $(CXXFLAGS) $< -o $@
-php_mapscript:: $(LIBMAP)
- cd mapscript/php; $(MAKE); cd ../..
-
maplexer.o: maplexer.c mapserver.h mapfile.h
mapparser.o: mapparser.c mapserver.h
@@ -369,8 +366,8 @@
mod_mapserver.la: $(LIBMAP) mod_mapserver.c
$(APXS) -c -Wc,"$(CFLAGS)" $(LIBMAP) mod_mapserver.c
+mapscript: mapscriptvars mapserver-config
-
$(LIBMAP): $(OBJS)
$(LINK) $(OBJS) $(SUP_LIBS) $(STATIC_LIBS) -o $(LIBMAP)
@@ -443,11 +440,26 @@
cat mapserver-config.in >> mapserver-config
chmod a+x mapserver-config
-php_mapscript_clean::
- cd mapscript/php; $(MAKE) clean; cd ../..
+php_mapscript: $(LIBMAP)
+ cd mapscript/php; $(MAKE);
-install: install-lib install-bin install-cgibin
+php_mapscript_clean:
+ cd mapscript/php; $(MAKE) clean;
+php_mapscript_install:
+ cd mapscript/php; $(MAKE) install;
+
+python_mapscript: $(LIBMAP)
+ cd mapscript/python; $(MAKE);
+
+python_mapscript_clean:
+ cd mapscript/python; $(MAKE) clean;
+
+python_mapscript_install:
+ cd mapscript/python; $(MAKE) install;
+
+install: install-lib install-bin install-cgibin @MAKE_PHP_MAPSCRIPT_INSTALL@ @MAKE_PYTHON_MAPSCRIPT_INSTALL@
+
install-cgibin: install-lib install-bin
@echo ""
@echo "***** MapServer CGI / FastCGI Installation *****"
@@ -481,21 +493,18 @@
install-module: mod_mapserver.la install-lib
$(APXS) -i -a -n "mapserver" mod_mapserver.la
-clean:
+clean: @MAKE_PHP_MAPSCRIPT_CLEAN@ @MAKE_PYTHON_MAPSCRIPT_CLEAN@
rm -rf $(LIBMAP) *.o *.lo *.la .libs $(EXE_LIST) renderers/agg/src/*.o renderers/agg/src/*.lo renderers/agg/src/.libs
- cd mapscript/python && make clean
- cd mapscript/php && make clean
-
exe-clean:
rm -f $(EXE_LIST)
distclean:
$(MAKE) clean
- rm config.*
+ rm config.log
if test -d autom4te.cache ; then \
rm -f -r autom4te.cache ; \
fi
sorta-clean:
- rm -f *.o
+ rm -f *.o *.lo
Modified: trunk/mapserver/configure
===================================================================
--- trunk/mapserver/configure 2011-12-23 16:45:22 UTC (rev 12916)
+++ trunk/mapserver/configure 2011-12-23 17:52:13 UTC (rev 12917)
@@ -618,14 +618,21 @@
ALL_INC
ALL_ENABLED
OS_INCLUDE_DIR
+MAKE_PYTHON_MAPSCRIPT_INSTALL
+MAKE_PYTHON_MAPSCRIPT_CLEAN
+MAKE_PYTHON_MAPSCRIPT
+PYTHON
+SWIG_LIB
+SWIG
JAVA_INCLUDE
_ACJNI_JAVAC
SO_COMMAND_NAME
SO_EXT
LD_SHARED
C_PIC
-MAKE_PHPMS_CLEAN
-MAKE_PHPMS
+MAKE_PHP_MAPSCRIPT_INSTALL
+MAKE_PHP_MAPSCRIPT_CLEAN
+MAKE_PHP_MAPSCRIPT
USE_PHP_REGEX
PHP_REGEX_OBJ
PHP_REGEX_INC
@@ -897,6 +904,8 @@
enable_internal_ld_detect
with_ld_shared
with_java_include_os_name
+enable_python_mapscript
+with_python
'
ac_precious_vars='build_alias
host_alias
@@ -1552,6 +1561,7 @@
Use perl -V output to figure the command to use to
link php_mapscript.so. Try this only if the default
internal macro didn't work.
+ --enable-python-mapscript build the python mapscript module.
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -1639,6 +1649,7 @@
installation where os-dependent include files are
found (for instance linux or solaris).
Only used by Java mapscript.
+ --with-python[=PATH] Specify python binary (PATH is path to python)
Some influential environment variables:
CC C compiler command
@@ -11154,7 +11165,77 @@
# ----------------------------------------
# _ACJNI
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_pkg_swig.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_PKG_SWIG([major.minor.micro], [action-if-found], [action-if-not-found])
+#
+# DESCRIPTION
+#
+# This macro searches for a SWIG installation on your system. If found,
+# then SWIG is AC_SUBST'd; if not found, then $SWIG is empty. If SWIG is
+# found, then SWIG_LIB is set to the SWIG library path, and AC_SUBST'd.
+#
+# You can use the optional first argument to check if the version of the
+# available SWIG is greater than or equal to the value of the argument. It
+# should have the format: N[.N[.N]] (N is a number between 0 and 999. Only
+# the first N is mandatory.) If the version argument is given (e.g.
+# 1.3.17), AX_PKG_SWIG checks that the swig package is this version number
+# or higher.
+#
+# As usual, action-if-found is executed if SWIG is found, otherwise
+# action-if-not-found is executed.
+#
+# In configure.in, use as:
+#
+# AX_PKG_SWIG(1.3.17, [], [ AC_MSG_ERROR([SWIG is required to build..]) ])
+# AX_SWIG_ENABLE_CXX
+# AX_SWIG_MULTI_MODULE_SUPPORT
+# AX_SWIG_PYTHON
+#
+# LICENSE
+#
+# Copyright (c) 2008 Sebastian Huber <sebastian-huber at web.de>
+# Copyright (c) 2008 Alan W. Irwin <irwin at beluga.phys.uvic.ca>
+# Copyright (c) 2008 Rafael Laboissiere <rafael at laboissiere.net>
+# Copyright (c) 2008 Andrew Collier <colliera at ukzn.ac.za>
+# Copyright (c) 2011 Murray Cumming <murrayc at openismus.com>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+#serial 8
+
+
+
+
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -22049,10 +22130,10 @@
$as_echo "no" >&6; }
fi
- PHPMS_MAKEFILE=mapscript/php/Makefile
- MAKE_PHPMS=php_mapscript
- MAKE_PHPMS_CLEAN=php_mapscript_clean
+ MAKE_PHP_MAPSCRIPT="php_mapscript"
+ MAKE_PHP_MAPSCRIPT_CLEAN="php_mapscript_clean"
+ MAKE_PHP_MAPSCRIPT_INSTALL="php_mapscript_install"
PHP_VERSION_FLAG="-DPHP_VERSION_ID=$PHP_VERSION"
PHPCONFIG=$PHPCONFIG
@@ -22071,12 +22152,14 @@
$as_echo " PHP/MapScript module not configured." >&6; }
fi
-MAKE_PHPMS=$MAKE_PHPMS
+MAKE_PHP_MAPSCRIPT=$MAKE_PHP_MAPSCRIPT
-MAKE_PHPMS_CLEAN=$MAKE_PHPMS_CLEAN
+MAKE_PHP_MAPSCRIPT_CLEAN=$MAKE_PHP_MAPSCRIPT_CLEAN
+MAKE_PHP_MAPSCRIPT_INSTALL=$MAKE_PHP_MAPSCRIPT_INSTALL
+
if test "x$LD_SHARED" = "x" ; then
echo 'void f(){}' > conftest.c
@@ -22389,6 +22472,230 @@
+
+
+
+# Check whether --enable-python-mapscript was given.
+if test "${enable_python_mapscript+set}" = set; then :
+ enableval=$enable_python_mapscript;
+else
+ enable_python_mapscript=no
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we should build python mapscript" >&5
+$as_echo_n "checking if we should build python mapscript... " >&6; }
+if test "$enable_python_mapscript" = "yes" ; then
+
+ # Ubuntu has swig 2.0 as /usr/bin/swig2.0
+ for ac_prog in swig 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_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_SWIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $SWIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_SWIG="$SWIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_SWIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+SWIG=$ac_cv_path_SWIG
+if test -n "$SWIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SWIG" >&5
+$as_echo "$SWIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$SWIG" && break
+done
+
+ if test -z "$SWIG" ; then
+ :
+ elif test -n "2.0.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.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.0 is required. You have $swig_version." >&5
+$as_echo "$as_me: WARNING: SWIG version >= 2.0.0 is required. You have $swig_version." >&2;}
+ SWIG=''
+
+ 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=''
+
+ fi
+ fi
+
+
+ if test -z $SWIG; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: swig not found, you will not be able to build/update wrappers" >&5
+$as_echo "$as_me: WARNING: swig not found, you will not be able to build/update wrappers" >&2;}
+ fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if python path is provided" >&5
+$as_echo_n "checking if python path is provided... " >&6; }
+
+
+# Check whether --with-python was given.
+if test "${with_python+set}" = set; then :
+ withval=$with_python;
+else
+ with_python=yes
+fi
+
+
+if test -n "$with_python" -a "$with_python" != "yes" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ if test -x "$with_python"; then
+ PYTHON=$with_python
+ else
+ as_fn_error $? "$with_python does not seem to be an executable" "$LINENO" 5
+ fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: using system default" >&5
+$as_echo "using system default" >&6; }
+ # Extract the first word of "python", so it can be a program name with args.
+set dummy python; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PYTHON+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PYTHON in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+PYTHON=$ac_cv_path_PYTHON
+if test -n "$PYTHON"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5
+$as_echo "$PYTHON" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ if test -z "$PYTHON"; then
+ as_fn_error $? "no python found on path" "$LINENO" 5
+ fi
+fi
+PYTHON=$PYTHON
+
+
+ MAKE_PYTHON_MAPSCRIPT="python_mapscript"
+ MAKE_PYTHON_MAPSCRIPT_CLEAN="python_mapscript_clean"
+ MAKE_PYTHON_MAPSCRIPT_INSTALL="python_mapscript_install"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Python/MapScript module configured." >&5
+$as_echo " Python/MapScript module configured." >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Python/MapScript module not configured." >&5
+$as_echo " Python/MapScript module not configured." >&6; }
+fi
+
+MAKE_PYTHON_MAPSCRIPT=$MAKE_PYTHON_MAPSCRIPT
+
+MAKE_PYTHON_MAPSCRIPT_CLEAN=$MAKE_PYTHON_MAPSCRIPT_CLEAN
+
+MAKE_PYTHON_MAPSCRIPT_INSTALL=$MAKE_PYTHON_MAPSCRIPT_INSTALL
+
+
OS_INCLUDE_DIR=$OS_INCLUDE_DIR
@@ -22404,7 +22711,7 @@
RPATHS=$RPATHS
-ac_config_files="$ac_config_files Makefile $PHPMS_MAKEFILE mapscript/python/Makefile mapscript/java/Makefile mapscript/csharp/Makefile mapscript/perl/Makefile.PL"
+ac_config_files="$ac_config_files Makefile mapscript/php/Makefile mapscript/python/Makefile mapscript/java/Makefile mapscript/csharp/Makefile mapscript/perl/Makefile.PL"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -23510,7 +23817,7 @@
case $ac_config_target in
"libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
- "$PHPMS_MAKEFILE") CONFIG_FILES="$CONFIG_FILES $PHPMS_MAKEFILE" ;;
+ "mapscript/php/Makefile") CONFIG_FILES="$CONFIG_FILES mapscript/php/Makefile" ;;
"mapscript/python/Makefile") CONFIG_FILES="$CONFIG_FILES mapscript/python/Makefile" ;;
"mapscript/java/Makefile") CONFIG_FILES="$CONFIG_FILES mapscript/java/Makefile" ;;
"mapscript/csharp/Makefile") CONFIG_FILES="$CONFIG_FILES mapscript/csharp/Makefile" ;;
@@ -24891,6 +25198,13 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: PHP MapScript: no" >&5
$as_echo " PHP MapScript: no" >&6; }
fi
+if test -n "${MAKE_PYTHON_MAPSCRIPT}"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Python MapScript: yes" >&5
+$as_echo " Python MapScript: yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: Python MapScript: no" >&5
+$as_echo " Python MapScript: no" >&6; }
+fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5
$as_echo "" >&6; }
Modified: trunk/mapserver/configure.in
===================================================================
--- trunk/mapserver/configure.in 2011-12-23 16:45:22 UTC (rev 12916)
+++ trunk/mapserver/configure.in 2011-12-23 17:52:13 UTC (rev 12917)
@@ -35,6 +35,8 @@
m4_include([m4/mapserver.m4])
m4_include([m4/apache.m4])
m4_include([m4/ax_jni_include_dir.m4])
+m4_include([m4/ax_pkg_swig.m4])
+
AC_CONFIG_SRCDIR([mapserv.c])
dnl Checks for programs.
AC_PROG_CC
@@ -2659,10 +2661,10 @@
AC_MSG_RESULT(no)
fi
- PHPMS_MAKEFILE=mapscript/php/Makefile
- MAKE_PHPMS=php_mapscript
- MAKE_PHPMS_CLEAN=php_mapscript_clean
+ MAKE_PHP_MAPSCRIPT="php_mapscript"
+ MAKE_PHP_MAPSCRIPT_CLEAN="php_mapscript_clean"
+ MAKE_PHP_MAPSCRIPT_INSTALL="php_mapscript_install"
AC_SUBST(PHP_VERSION_FLAG, "-DPHP_VERSION_ID=$PHP_VERSION")
AC_SUBST(PHPCONFIG, $PHPCONFIG)
AC_SUBST(PHP_REGEX_INC, $PHP_REGEX_INC)
@@ -2674,8 +2676,9 @@
AC_MSG_RESULT([ PHP/MapScript module not configured.])
fi
-AC_SUBST(MAKE_PHPMS, $MAKE_PHPMS)
-AC_SUBST(MAKE_PHPMS_CLEAN, $MAKE_PHPMS_CLEAN)
+AC_SUBST(MAKE_PHP_MAPSCRIPT,$MAKE_PHP_MAPSCRIPT)
+AC_SUBST(MAKE_PHP_MAPSCRIPT_CLEAN,$MAKE_PHP_MAPSCRIPT_CLEAN)
+AC_SUBST(MAKE_PHP_MAPSCRIPT_INSTALL,$MAKE_PHP_MAPSCRIPT_INSTALL)
dnl ---------------------------------------------------------------------
dnl Shared library building.
@@ -2731,6 +2734,52 @@
AC_SUBST(JAVA_INCLUDE,$JAVA_INCLUDE)
+AC_DEFUN([PYTHON_CHECK],[
+AC_MSG_CHECKING(if python path is provided)
+
+AC_ARG_WITH(python,
+[ --with-python[[=PATH]] Specify python binary (PATH is path to python)],,[with_python=yes])
+
+if test -n "$with_python" -a "$with_python" != "yes" ; then
+ AC_MSG_RESULT([yes])
+ if test -x "$with_python"; then
+ PYTHON=$with_python
+ else
+ AC_MSG_ERROR([$with_python does not seem to be an executable])
+ fi
+else
+ AC_MSG_RESULT([using system default])
+ AC_PATH_PROG(PYTHON,python)
+ if test -z "$PYTHON"; then
+ AC_MSG_ERROR([no python found on path])
+ fi
+fi
+AC_SUBST(PYTHON,$PYTHON)
+])
+
+
+AC_ARG_ENABLE(python-mapscript,
+[ --enable-python-mapscript build the python mapscript module. ],,[enable_python_mapscript=no])
+AC_MSG_CHECKING([if we should build python mapscript])
+if test "$enable_python_mapscript" = "yes" ; then
+ AX_PKG_SWIG([2.0.0])
+ if test -z $SWIG; then
+ AC_MSG_WARN([swig not found, you will not be able to build/update wrappers])
+ fi
+ PYTHON_CHECK
+ MAKE_PYTHON_MAPSCRIPT="python_mapscript"
+ MAKE_PYTHON_MAPSCRIPT_CLEAN="python_mapscript_clean"
+ MAKE_PYTHON_MAPSCRIPT_INSTALL="python_mapscript_install"
+
+ AC_MSG_RESULT([ Python/MapScript module configured.])
+else
+ AC_MSG_RESULT([ Python/MapScript module not configured.])
+fi
+
+AC_SUBST(MAKE_PYTHON_MAPSCRIPT,$MAKE_PYTHON_MAPSCRIPT)
+AC_SUBST(MAKE_PYTHON_MAPSCRIPT_CLEAN,$MAKE_PYTHON_MAPSCRIPT_CLEAN)
+AC_SUBST(MAKE_PYTHON_MAPSCRIPT_INSTALL,$MAKE_PYTHON_MAPSCRIPT_INSTALL)
+
AC_SUBST(OS_INCLUDE_DIR, $OS_INCLUDE_DIR)
dnl ---------------------------------------------------------------------
@@ -2743,7 +2792,7 @@
AC_SUBST(ALL_STATIC_LIB, $ALL_STATIC_LIB)
AC_SUBST(RPATHS, [$RPATHS])
-AC_OUTPUT(Makefile $PHPMS_MAKEFILE mapscript/python/Makefile mapscript/java/Makefile mapscript/csharp/Makefile mapscript/perl/Makefile.PL)
+AC_OUTPUT(Makefile mapscript/php/Makefile mapscript/python/Makefile mapscript/java/Makefile mapscript/csharp/Makefile mapscript/perl/Makefile.PL)
dnl ---------------------------------------------------------------------------
dnl Display configuration status
@@ -2811,5 +2860,10 @@
else
AC_MSG_RESULT([ PHP MapScript: no])
fi
+if test -n "${MAKE_PYTHON_MAPSCRIPT}"; then
+ AC_MSG_RESULT([ Python MapScript: yes])
+else
+ AC_MSG_RESULT([ Python MapScript: no])
+fi
AC_MSG_RESULT()
Added: trunk/mapserver/m4/ax_pkg_swig.m4
===================================================================
--- trunk/mapserver/m4/ax_pkg_swig.m4 (rev 0)
+++ trunk/mapserver/m4/ax_pkg_swig.m4 2011-12-23 17:52:13 UTC (rev 12917)
@@ -0,0 +1,135 @@
+# ===========================================================================
+# http://www.gnu.org/software/autoconf-archive/ax_pkg_swig.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_PKG_SWIG([major.minor.micro], [action-if-found], [action-if-not-found])
+#
+# DESCRIPTION
+#
+# This macro searches for a SWIG installation on your system. If found,
+# then SWIG is AC_SUBST'd; if not found, then $SWIG is empty. If SWIG is
+# found, then SWIG_LIB is set to the SWIG library path, and AC_SUBST'd.
+#
+# You can use the optional first argument to check if the version of the
+# available SWIG is greater than or equal to the value of the argument. It
+# should have the format: N[.N[.N]] (N is a number between 0 and 999. Only
+# the first N is mandatory.) If the version argument is given (e.g.
+# 1.3.17), AX_PKG_SWIG checks that the swig package is this version number
+# or higher.
+#
+# As usual, action-if-found is executed if SWIG is found, otherwise
+# action-if-not-found is executed.
+#
+# In configure.in, use as:
+#
+# AX_PKG_SWIG(1.3.17, [], [ AC_MSG_ERROR([SWIG is required to build..]) ])
+# AX_SWIG_ENABLE_CXX
+# AX_SWIG_MULTI_MODULE_SUPPORT
+# AX_SWIG_PYTHON
+#
+# LICENSE
+#
+# Copyright (c) 2008 Sebastian Huber <sebastian-huber at web.de>
+# Copyright (c) 2008 Alan W. Irwin <irwin at beluga.phys.uvic.ca>
+# Copyright (c) 2008 Rafael Laboissiere <rafael at laboissiere.net>
+# Copyright (c) 2008 Andrew Collier <colliera at ukzn.ac.za>
+# Copyright (c) 2011 Murray Cumming <murrayc at openismus.com>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+
+#serial 8
+
+AC_DEFUN([AX_PKG_SWIG],[
+ # Ubuntu has swig 2.0 as /usr/bin/swig2.0
+ AC_PATH_PROGS([SWIG],[swig swig2.0])
+ if test -z "$SWIG" ; then
+ m4_ifval([$3],[$3],[:])
+ elif test -n "$1" ; then
+ AC_MSG_CHECKING([SWIG version])
+ [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'`]
+ AC_MSG_RESULT([$swig_version])
+ if test -n "$swig_version" ; then
+ # Calculate the required version number components
+ [required=$1]
+ [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
+ AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version.])
+ SWIG=''
+ m4_ifval([$3],[$3],[])
+ else
+ AC_MSG_CHECKING([for SWIG library])
+ SWIG_LIB=`$SWIG -swiglib`
+ AC_MSG_RESULT([$SWIG_LIB])
+ m4_ifval([$2],[$2],[])
+ fi
+ else
+ AC_MSG_WARN([cannot determine SWIG version])
+ SWIG=''
+ m4_ifval([$3],[$3],[])
+ fi
+ fi
+ AC_SUBST([SWIG_LIB])
+])
Modified: trunk/mapserver/mapscript/python/Makefile.in
===================================================================
--- trunk/mapserver/mapscript/python/Makefile.in 2011-12-23 16:45:22 UTC (rev 12916)
+++ trunk/mapserver/mapscript/python/Makefile.in 2011-12-23 17:52:13 UTC (rev 12917)
@@ -12,8 +12,8 @@
LD= @CXX@
LIBTOOL=@LIBTOOL@
INSTALL=@INSTALL@
-PYTHON=python
-SWIG=swig
+PYTHON=@PYTHON@
+SWIG=@SWIG@
LTCC=$(LIBTOOL) --mode=compile --tag=CC
LTCXX=$(LIBTOOL) --mode=compile --tag=CXX
@@ -55,5 +55,5 @@
$(INSTALL) -c mapscript.py $(PYLIBDIR)
clean:
- -rm -rf .libs *.lo *.la *.so *.o pygdioctx/*.o pygdioctx/*.lo
+ -rm -rf .libs *.lo *.la *.so *.o pygdioctx/*.o pygdioctx/*.lo mapscript_wrap.c mapscript.py
More information about the mapserver-commits
mailing list