[GRASS-SVN] r30525 - in grass/trunk: . gui/wxpython/vdigit include/Make swig swig/python

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Mar 10 19:28:24 EDT 2008


Author: hamish
Date: 2008-03-10 19:28:24 -0400 (Mon, 10 Mar 2008)
New Revision: 30525

Modified:
   grass/trunk/configure
   grass/trunk/configure.in
   grass/trunk/gui/wxpython/vdigit/Makefile
   grass/trunk/include/Make/Platform.make.in
   grass/trunk/swig/Makefile
   grass/trunk/swig/python/Makefile.in
   grass/trunk/swig/python/README
Log:
Makefile fixes for SWIG/Python

Modified: grass/trunk/configure
===================================================================
--- grass/trunk/configure	2008-03-10 22:46:57 UTC (rev 30524)
+++ grass/trunk/configure	2008-03-10 23:28:24 UTC (rev 30525)
@@ -67,7 +67,7 @@
 ac_help="$ac_help
   --with-curses           support Curses functionality (default: yes)"
 ac_help="$ac_help
-  --with-python[=path/python-config] enable Python support (python-config with path, \
+  --with-python[=path/python-config] enable support for Python SWIG bindings (python-config with path, \
 e.g. '--with-python=/usr/bin/python2.5-config', default: no)"
 ac_help="$ac_help
   --with-wxwidgets[=path/wx-config] enable wxWidgets support (wx-config with path, \
@@ -1018,7 +1018,7 @@
   if { (eval echo configure:1019: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
     for file in conftest.*; do
       case $file in
-      *.c | *.o | *.obj) ;;
+      *.$ac_ext | *.c | *.o | *.obj) ;;
       *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
       esac
     done
@@ -15171,6 +15171,7 @@
 PYTHONINC=
 PYTHONCFLAGS=
 PYTHONLDFLAGS=
+SWIG=
 USE_PYTHON=
 
 if test "$with_python" = "no" ; then
@@ -15185,7 +15186,7 @@
   # Extract the first word of "python-config", so it can be a program name with args.
 set dummy python-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:15189: checking for $ac_word" >&5
+echo "configure:15190: checking for $ac_word" >&5
 
 case "$PY_CONFIG" in
   /*)
@@ -15218,7 +15219,7 @@
 
   if test "$PY_CONFIG" = "no" ; then
     { echo "configure: error: *** couldn't find python-config" 1>&2; exit 1; }
- fi
+  fi
 
   # With Python includes directory 
 
@@ -15230,15 +15231,15 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:15234: checking for $ac_hdr" >&5
+echo "configure:15235: checking for $ac_hdr" >&5
 
 cat > conftest.$ac_ext <<EOF
-#line 15237 "configure"
+#line 15238 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:15242: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:15243: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -15266,14 +15267,53 @@
 done
 
 CPPFLAGS=$ac_save_cppflags
- 
 
+
   PYTHONCFLAGS=`"$PY_CONFIG" --cflags`
 
   # With Python library directory
 
   PYTHONLDFLAGS=`"$PY_CONFIG" --ldflags`
 
+  # look for the swig program
+  # Extract the first word of "swig", so it can be a program name with args.
+set dummy swig; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:15283: checking for $ac_word" >&5
+
+case "$SWIG" in
+  /*)
+  ac_cv_path_SWIG="$SWIG" # Let the user override the test with a path.
+  ;;
+  ?:/*)			 
+  ac_cv_path_SWIG="$SWIG" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_SWIG="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_path_SWIG" && ac_cv_path_SWIG="no"
+  ;;
+esac
+SWIG="$ac_cv_path_SWIG"
+if test -n "$SWIG"; then
+  echo "$ac_t""$SWIG" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+  if test "$SWIG" = "no" ; then
+    { echo "configure: error: *** couldn't find swig" 1>&2; exit 1; }
+  fi
+
 fi # Done checking Python
 
 
@@ -15281,10 +15321,11 @@
 
 
 
+
 # Enable wxWidgets support (for wxGUI)
 
 echo $ac_n "checking whether to use wxWidgets""... $ac_c" 1>&6
-echo "configure:15288: checking whether to use wxWidgets" >&5
+echo "configure:15329: checking whether to use wxWidgets" >&5
 
 WXVERSION=
 WXWIDGETSCXXFLAGS= 
@@ -15304,7 +15345,7 @@
   # Extract the first word of "wx-config", so it can be a program name with args.
 set dummy wx-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:15308: checking for $ac_word" >&5
+echo "configure:15349: checking for $ac_word" >&5
 
 case "$WX_CONFIG" in
   /*)
@@ -15352,7 +15393,7 @@
  REQWX="2.8.1"
 
  echo $ac_n "checking wxWidgets version""... $ac_c" 1>&6
-echo "configure:15356: checking wxWidgets version" >&5
+echo "configure:15397: checking wxWidgets version" >&5
  if WXVERSION=`"$WX_CONFIG" --version`; then
    echo "$ac_t""$WXVERSION" 1>&6
  else
@@ -15375,15 +15416,15 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:15379: checking for $ac_hdr" >&5
+echo "configure:15420: checking for $ac_hdr" >&5
 
 cat > conftest.$ac_ext <<EOF
-#line 15382 "configure"
+#line 15423 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:15387: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:15428: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -15419,15 +15460,15 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:15423: checking for $ac_hdr" >&5
+echo "configure:15464: checking for $ac_hdr" >&5
 
 cat > conftest.$ac_ext <<EOF
-#line 15426 "configure"
+#line 15467 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:15431: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:15472: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -15730,6 +15771,7 @@
 s%@USE_OPENDWG@%$USE_OPENDWG%g
 s%@USE_LARGEFILES@%$USE_LARGEFILES%g
 s%@PY_CONFIG@%$PY_CONFIG%g
+s%@SWIG@%$SWIG%g
 s%@PYTHONINC@%$PYTHONINC%g
 s%@PYTHONCFLAGS@%$PYTHONCFLAGS%g
 s%@PYTHONLDFLAGS@%$PYTHONLDFLAGS%g

Modified: grass/trunk/configure.in
===================================================================
--- grass/trunk/configure.in	2008-03-10 22:46:57 UTC (rev 30524)
+++ grass/trunk/configure.in	2008-03-10 23:28:24 UTC (rev 30525)
@@ -194,7 +194,7 @@
 LOC_ARG_WITH(opendwg, openDWG, no)
 LOC_ARG_WITH(curses, Curses, yes)
 AC_ARG_WITH(python,
-[  --with-python[=path/python-config] enable Python support (python-config with path, \
+[  --with-python[=path/python-config] enable support for Python SWIG bindings (python-config with path, \
 e.g. '--with-python=/usr/bin/python2.5-config', default: no)],, with_python="no")
 AC_ARG_WITH(wxwidgets,
 [  --with-wxwidgets[=path/wx-config] enable wxWidgets support (wx-config with path, \
@@ -1633,6 +1633,7 @@
 PYTHONINC=
 PYTHONCFLAGS=
 PYTHONLDFLAGS=
+SWIG=
 USE_PYTHON=
 
 if test "$with_python" = "no" ; then
@@ -1648,12 +1649,12 @@
 
   if test "$PY_CONFIG" = "no" ; then
     AC_MSG_ERROR([*** couldn't find python-config])
- fi
+  fi
 
   # With Python includes directory 
 
   PYTHONINC=`"$PY_CONFIG" --includes`
-  LOC_CHECK_INCLUDES(Python.h,Python,$PYTHONINC) 
+  LOC_CHECK_INCLUDES(Python.h,Python,$PYTHONINC)
 
   PYTHONCFLAGS=`"$PY_CONFIG" --cflags`
 
@@ -1661,11 +1662,19 @@
 
   PYTHONLDFLAGS=`"$PY_CONFIG" --ldflags`
 
+  # look for the swig program
+  AC_PATH_PROG(SWIG, swig, no)
+
+  if test "$SWIG" = "no" ; then
+    AC_MSG_ERROR([*** couldn't find swig])
+  fi
+
 fi # Done checking Python
 
 AC_SUBST(PYTHONINC)
 AC_SUBST(PYTHONCFLAGS)
 AC_SUBST(PYTHONLDFLAGS)
+AC_SUBST(SWIG)
 AC_SUBST(USE_PYTHON)
 
 # Enable wxWidgets support (for wxGUI)

Modified: grass/trunk/gui/wxpython/vdigit/Makefile
===================================================================
--- grass/trunk/gui/wxpython/vdigit/Makefile	2008-03-10 22:46:57 UTC (rev 30524)
+++ grass/trunk/gui/wxpython/vdigit/Makefile	2008-03-10 23:28:24 UTC (rev 30525)
@@ -3,8 +3,6 @@
 include $(MODULE_TOPDIR)/include/Make/Platform.make
 include $(MODULE_TOPDIR)/include/Make/Lib.make
 
-SWIG = swig
-
 CXXFLAGS += $(SHLIB_CFLAGS) $(GDALCFLAGS) $(PYTHONCFLAGS) $(WXWIDGETSCXXFLAGS)
 
 LDFLAGS += $(SHLIB_LDFLAGS) -L$(ARCH_LIBDIR) $(VECTLIB) $(GISLIB) $(GDALLIBS) $(VEDITLIB) $(WXWIDGETSLIB) $(PYTHONLDFLAGS) -lgdi

Modified: grass/trunk/include/Make/Platform.make.in
===================================================================
--- grass/trunk/include/Make/Platform.make.in	2008-03-10 22:46:57 UTC (rev 30524)
+++ grass/trunk/include/Make/Platform.make.in	2008-03-10 23:28:24 UTC (rev 30525)
@@ -212,6 +212,7 @@
 PYTHONINC           = @PYTHONINC@
 PYTHONCFLAGS        = @PYTHONCFLAGS@
 PYTHONLDFLAGS       = @PYTHONLDFLAGS@
+SWIG                = @SWIG@
 USE_PYTHON          = @USE_PYTHON@
 
 #wxWidgets

Modified: grass/trunk/swig/Makefile
===================================================================
--- grass/trunk/swig/Makefile	2008-03-10 22:46:57 UTC (rev 30524)
+++ grass/trunk/swig/Makefile	2008-03-10 23:28:24 UTC (rev 30525)
@@ -1,5 +1,10 @@
 MODULE_TOPDIR = ..
 
+#compile if PYTHON present:
+ifneq ($(USE_PYTHON),)
+    SUBDIRS += python
+endif
+
 # doxygen:
 DOXNAME=swig
 

Modified: grass/trunk/swig/python/Makefile.in
===================================================================
--- grass/trunk/swig/python/Makefile.in	2008-03-10 22:46:57 UTC (rev 30524)
+++ grass/trunk/swig/python/Makefile.in	2008-03-10 23:28:24 UTC (rev 30525)
@@ -1,19 +1,16 @@
-### DEFINITIONS
-
-PYTHONVERSION=@PYVERSION@
-
-### END DEFINITIONS
-
 MODULE_TOPDIR = ../..
 
 include $(MODULE_TOPDIR)/include/Make/Lib.make
 include $(MODULE_TOPDIR)/include/Make/Doxygen.make
-SWIG=swig
 
-CFLAGS=-c -fpic -I/usr/include/python$(PYTHONVERSION) -I./ -I$(ARCH_DISTDIR)/include
+CFLAGS=-c -fpic -I./ -I$(ARCH_DISTDIR)/include $(GDALCFLAGS) $(PYTHONCFLAGS)
 
-LDFLAGS=-shared -L$(ARCH_LIBDIR) -lgrass_I -lgrass_Iortho -lgrass_bitmap -lgrass_btree -lgrass_cdhc -lgrass_datetime -lgrass_dbmibase -lgrass_dbmiclient -lgrass_dbmidriver -lgrass_dbstubs -lgrass_dgl -lgrass_display -lgrass_dspf -lgrass_edit -lgrass_form -lgrass_g3d -lgrass_gis -lgrass_gmath -lgrass_gproj -lgrass_interpdata -lgrass_interpfl -lgrass_linkm -lgrass_qtree -lgrass_raster -lgrass_rowio -lgrass_rtree -lgrass_segment -lgrass_shape -lgrass_sites -lgrass_symb -lgrass_trans -lgrass_vask -lgrass_vect -lgrass_psdriver
+LDFLAGS=-shared -L$(ARCH_LIBDIR) $(GDALLIBS) $(PYTHONLDFLAGS) -lgrass_I -lgrass_Iortho -lgrass_bitmap -lgrass_btree -lgrass_cdhc -lgrass_datetime -lgrass_dbmibase -lgrass_dbmiclient -lgrass_dbmidriver -lgrass_dbstubs -lgrass_dgl -lgrass_display -lgrass_dspf -lgrass_edit -lgrass_form -lgrass_g3d -lgrass_gis -lgrass_gmath -lgrass_gproj -lgrass_interpdata -lgrass_interpfl -lgrass_linkm -lgrass_qtree -lgrass_raster -lgrass_rowio -lgrass_rtree -lgrass_segment -lgrass_shape -lgrass_sites -lgrass_symb -lgrass_trans -lgrass_vask -lgrass_vect -lgrass_psdriver
 
+# TODO: build the NumPtr module. See NumPtr/README.GRASS
+#SUBDIRS = NumPtr
+#include $(MODULE_TOPDIR)/include/Make/Dir.make
+
 default: python_grass6.so
 
 clean:
@@ -23,7 +20,7 @@
 	-rm -f Makefile
 
 python_grass6_wrap.c: python_grass6.i
-	make -C interfaces
+	$(MAKE) -C interfaces
 	$(SWIG) -python -shadow $<
 
 

Modified: grass/trunk/swig/python/README
===================================================================
--- grass/trunk/swig/python/README	2008-03-10 22:46:57 UTC (rev 30524)
+++ grass/trunk/swig/python/README	2008-03-10 23:28:24 UTC (rev 30525)
@@ -8,12 +8,13 @@
 
 How to INSTALL?
 ---------------
-1. Install SWIG
+1. Install SWIG, the Simplified Wrapper and Interface Generator
+     http://www.swig.org
 
-2. Edit the Makefile
-   - set python version
+2. Be sure you configured GRASS with support for Python:
+     ./configure --with-python=/usr/bin/python2.5-config
 
-3. Run make
+3. Run make in the swig/python/ directory
 
 It will create two files, python_grass6.py and _python_grass6.so.
 



More information about the grass-commit mailing list