Changeset 11556

Show
Ignore:
Timestamp:
05/18/07 13:19:12 (2 years ago)
Author:
mloskot
Message:

Applied fix checking for Python.h in configure script (Ticket #1508) to the stable 1.4.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.4/gdal/GDALmake.opt.in

    r11210 r11556  
    4242PYTHON_CFLAGS = @PYTHON_CFLAGS@ @NUMPY_FLAG@ 
    4343PYTHON = @PYTHON@ 
     44PYTHON_DEV = @PYTHON_DEV@ 
    4445PY_LD_SHARED = @PY_LD_SHARED@ 
    4546PY_SO_EXT = @PY_SO_EXT@ 
  • branches/1.4/gdal/GNUmakefile

    r10609 r11556  
    7676#       We only make python a default target if we think python is installed. 
    7777# 
    78 ifeq ($(PYTHON),no) 
     78ifeq ($(PYTHON_DEV),no) 
    7979py-target: ; 
    8080else 
     
    180180        (cd apps; $(MAKE) install) 
    181181        (cd man; $(MAKE) install) 
    182 ifneq ($(PYTHON),no) 
     182ifneq ($(PYTHON_DEV),no) 
    183183        (cd pymod; $(MAKE) install) 
    184184endif 
  • branches/1.4/gdal/autogen.sh

    r10609 r11556  
    55autoheader 
    66autoconf 
    7  
  • branches/1.4/gdal/configure.in

    r10609 r11556  
    19861986fi 
    19871987 
    1988 AC_SUBST(BINDINGS
     1988AC_SUBST([BINDINGS]
    19891989 
    19901990dnl --------------------------------------------------------------------------- 
     
    20072007dnl --------------------------------------------------------------------------- 
    20082008 
    2009 if test "$PYTHON" != "no" ; then 
     2009if test "$PYTHON" != "no" -a "$PYTHON_DEV" != "no" ; then 
    20102010  HAVE_PYTHON=yes 
    20112011else 
     
    20642064LOC_MSG() 
    20652065LOC_MSG([  Traditional Python:        ${HAVE_PYTHON}]) 
    2066 LOC_MSG([  NG SWIG Bindings:          ${BINDINGS}]) 
     2066if test -z "$BINDINGS"; then 
     2067    WHAT_BINDINGS="no" 
     2068else 
     2069    WHAT_BINDINGS="$BINDINGS" 
     2070fi 
     2071LOC_MSG([  NG SWIG Bindings:          ${WHAT_BINDINGS}]) 
    20672072LOC_MSG() 
    20682073LOC_MSG([  enable OGR building:       ${OGR_ENABLED}]) 
  • branches/1.4/gdal/m4/acinclude.m4

    r9751 r11556  
    3232dnl --------------------------------------------------------------------------- 
    3333 
    34 AC_DEFUN(AC_HAVE_LONG_LONG
     34AC_DEFUN([AC_HAVE_LONG_LONG]
    3535[ 
    3636  AC_MSG_CHECKING([for 64bit integer type]) 
     
    430430 
    431431AC_DEFUN(AM_PATH_PYTHON, 
    432   [AC_CHECK_PROGS(PYTHON, python python1.5 python1.4 python1.3,no) 
    433   if test "$with_python" = no ; then 
    434      echo "python support disabled" 
    435      PYTHON=no 
    436   fi 
    437  
    438   if test "x$with_ngpython" != xno -a "x$with_ngpython" != "x" ; then 
    439      echo "python support disabled since ngpython enabled." 
    440      PYTHON=no 
    441   fi 
    442  
    443   ARCH=`uname -i 2>/dev/null` 
    444   PYLIB=lib 
    445   if test "$ARCH" = "x86_64" ; then 
    446     PYLIB=lib64 
    447   fi 
    448  
    449   if test "$PYTHON" != no ; then 
    450     AC_MSG_CHECKING([where python Makefiles are]) 
    451 changequote(,)dnl 
    452     python_prefix="`$PYTHON -c ' 
     432
     433    dnl 
     434    dnl Check for Python executable in PATH 
     435    dnl 
     436    AC_CHECK_PROGS([PYTHON], [python python1.5 python1.4 python1.3], [no]) 
     437 
     438    if test "$with_python" = no ; then 
     439        echo "Python support disabled" 
     440        PYTHON=no 
     441    fi 
     442 
     443    if test "x$with_ngpython" != xno -a "x$with_ngpython" != "x" ; then 
     444        echo "Python support disabled since ngpython enabled." 
     445        PYTHON=no 
     446    fi 
     447 
     448    ARCH=`uname -i 2>/dev/null` 
     449    PYLIB=lib 
     450    if test "$ARCH" = "x86_64" ; then 
     451        PYLIB=lib64 
     452    fi 
     453 
     454    if test "$PYTHON" != no ; then 
     455        AC_MSG_CHECKING([for location of Python Makefiles]) 
     456 
     457        changequote(,)dnl 
     458        python_prefix="`$PYTHON -c ' 
    453459import sys 
    454460print sys.prefix'`" 
    455 changequote([, ])dnl 
    456 changequote(,)dnl 
    457     python_execprefix="`$PYTHON -c ' 
     461        changequote([, ])dnl 
     462         
     463        changequote(,)dnl 
     464        python_execprefix="`$PYTHON -c ' 
    458465import sys 
    459466print sys.prefix'`" 
    460 changequote([, ])dnl 
    461 changequote(,)dnl 
    462     python_version="`$PYTHON -c ' 
     467        changequote([, ])dnl 
     468 
     469        changequote(,)dnl 
     470        python_version="`$PYTHON -c ' 
    463471import sys 
    464472print sys.version[:3]'`" 
    465 changequote([, ])dnl 
    466  
    467     pythondir=$python_prefix/$PYLIB/python${python_version}/site-packages 
    468     pyexecdir=$python_execprefix/$PYLIB/python${python_version}/site-packages 
    469  
    470     AC_MSG_RESULT(found) 
    471  
    472     dnl Verify that we have the makefile needed later. 
     473        changequote([, ])dnl 
     474 
     475        pythondir=$python_prefix/$PYLIB/python${python_version}/site-packages 
     476        pyexecdir=$python_execprefix/$PYLIB/python${python_version}/site-packages 
     477 
     478        AC_MSG_RESULT(found) 
     479 
     480        dnl Verify that we have the makefile needed later. 
    473481     
    474     AC_MSG_CHECKING([Python makefile]) 
    475     py_mf=$python_execprefix/$PYLIB/python${python_version}/config/Makefile 
    476     if test -f $py_mf ; then 
    477       AC_MSG_RESULT(found) 
     482        AC_MSG_CHECKING([for top-level Makefile for Python]) 
     483        py_mf=$python_execprefix/$PYLIB/python${python_version}/config/Makefile 
     484        if test -f $py_mf ; then 
     485            AC_MSG_RESULT(found) 
     486        else 
     487            AC_MSG_RESULT([missing, Python disabled.]) 
     488            PYTHON=no 
     489        fi 
    478490    else 
    479       AC_MSG_RESULT([missing, python disabled.]) 
    480       PYTHON=no 
    481     fi 
    482   else 
    483     # these defaults are version independent ... 
    484     pythondir='$(prefix)/lib/site-python' 
    485     pyexecdir='$(exec_prefix)/lib/site-python' 
    486   fi 
    487  
    488   AC_ARG_WITH(pymoddir,[  --with-pymoddir=ARG   Override Python package install dir],,) 
    489  
    490   if test "$PYTHON" != "no" ; then 
    491     AC_MSG_CHECKING([where .py files should go]) 
    492  
    493     if test "$with_pymoddir" = "" ; then 
    494        pymoddir=$pyexecdir 
    495     else 
    496        pymoddir=$with_pymoddir 
    497     fi 
    498  
    499     export pymoddir 
    500     AC_MSG_RESULT($pymoddir) 
    501   fi   
    502  
    503   AC_SUBST(pythondir) 
    504   AC_SUBST(pyexecdir) 
    505   AC_SUBST(pymoddir) 
    506 ]) 
     491        dnl These defaults are version independent 
     492        pythondir='$(prefix)/lib/site-python' 
     493        pyexecdir='$(exec_prefix)/lib/site-python' 
     494    fi 
     495 
     496    dnl TODO: Add HELP_STRING 
     497    AC_ARG_WITH([pymoddir],[  --with-pymoddir=ARG   Override Python package install dir],,) 
     498 
     499    if test "$PYTHON" != "no" ; then 
     500        AC_MSG_CHECKING([where to install Python modules]) 
     501 
     502        if test "$with_pymoddir" = "" ; then 
     503            pymoddir=$pyexecdir 
     504        else 
     505            pymoddir=$with_pymoddir 
     506        fi 
     507 
     508        export pymoddir 
     509        AC_MSG_RESULT([$pymoddir]) 
     510    fi 
     511 
     512    AC_SUBST([pythondir]) 
     513    AC_SUBST([pyexecdir]) 
     514    AC_SUBST([pymoddir]) 
     515 
     516]) dnl AM_PATH_PYTHON 
    507517 
    508518 
     
    512522 
    513523AC_DEFUN(AM_INIT_PYEXEC_MOD, 
    514   [AC_REQUIRE([AM_PATH_PYTHON]) 
    515  
    516 PYTHON_LIBS="" 
    517 if test "$PYTHON" != no ; then 
    518   AC_MSG_CHECKING([for python headers]) 
    519   AC_CACHE_VAL(am_cv_python_includes, 
    520     [changequote(,)dnl 
    521     am_cv_python_includes="`$PYTHON -c ' 
     524
     525    AC_REQUIRE([AM_PATH_PYTHON]) 
     526    PYTHON_LIBS="" 
     527    PYTHON_DEV="no" 
     528 
     529    if test "$PYTHON" != no ; then 
     530        AC_MSG_CHECKING([for location of Python headers]) 
     531 
     532        AC_CACHE_VAL(am_cv_python_includes, 
     533        [ 
     534        changequote(,)dnl 
     535        am_cv_python_includes="`$PYTHON -c ' 
    522536import sys 
    523537includepy = \"%s/include/python%s\" % (sys.prefix, sys.version[:3]) 
    524538if sys.version[0] > \"1\" or sys.version[2] > \"4\": 
    525   libpl = \"%s/include/python%s\" % (sys.exec_prefix, sys.version[:3]) 
     539    libpl = \"%s/include/python%s\" % (sys.exec_prefix, sys.version[:3]) 
    526540else: 
    527   libpl = \"%s/'$PYLIB'/python%s/config\" % (sys.exec_prefix, sys.version[:3]) 
     541    libpl = \"%s/'$PYLIB'/python%s/config\" % (sys.exec_prefix, sys.version[:3]) 
    528542print \"-I%s -I%s\" % (includepy, libpl)'`" 
    529     changequote([, ])]) 
    530   PYTHON_INCLUDES="$am_cv_python_includes" 
    531   AC_MSG_RESULT(found) 
    532   AC_SUBST(PYTHON_INCLUDES) 
    533  
    534   AC_MSG_CHECKING([definitions from Python makefile]) 
    535   AC_CACHE_VAL(am_cv_python_makefile, 
    536     [changequote(,)dnl 
    537     if test ! -z "`uname -a | grep CYGWIN`" ; then  
    538       PYTHON_LIBS="`$PYTHON -c ' 
     543        changequote([, ]) 
     544        ]) 
     545 
     546        PYTHON_INCLUDES="$am_cv_python_includes" 
     547        AC_MSG_RESULT(found) 
     548        AC_SUBST(PYTHON_INCLUDES) 
     549 
     550        AC_MSG_CHECKING([definitions from top-level Python Makefile]) 
     551        AC_CACHE_VAL(am_cv_python_makefile, 
     552        [ 
     553        changequote(,)dnl 
     554        if test ! -z "`uname -a | grep CYGWIN`" ; then  
     555            PYTHON_LIBS="`$PYTHON -c ' 
    539556import sys 
    540557print \"-L%s/'$PYLIB'/python%s/config -lpython%s.dll\" % (sys.prefix, sys.version[:3], sys.version[:3])'`" 
    541     fi  
    542     py_makefile="`$PYTHON -c ' 
     558        fi  
     559         
     560        py_makefile="`$PYTHON -c ' 
    543561import sys 
    544562print \"%s/'$PYLIB'/python%s/config/Makefile\"%(sys.exec_prefix, sys.version[:3])'`" 
    545     if test ! -f "$py_makefile"; then 
    546       echo Could not find the python config makefile.  Maybe you are; 
    547       echo missing the development portion of the python installation; 
    548       exit; 
    549     fi 
    550     eval `sed -n \ 
    551 -e "s/^CC=[     ]*\(.*\)/am_cv_python_CC='\1'/p" \ 
    552 -e "s/^OPT=[    ]*\(.*\)/am_cv_python_OPT='\1'/p" \ 
    553 -e "s/^CCSHARED=[       ]*\(.*\)/am_cv_python_CCSHARED='\1'/p" \ 
    554 -e "s/^LDSHARED=[       ]*\(.*\)/am_cv_python_LDSHARED='\1'/p" \ 
    555 -e "s/^SO=[     ]*\(.*\)/am_cv_python_SO='\1'/p" \ 
    556     $py_makefile` 
    557     am_cv_python_makefile=found 
    558     changequote([, ])]) 
    559   AC_MSG_RESULT(done) 
    560   PYTHON_CC="$am_cv_python_CC" 
    561   PYTHON_OPT="$am_cv_python_OPT" 
    562   PYTHON_SO="$am_cv_python_SO" 
    563   PYTHON_CFLAGS="$am_cv_python_CCSHARED \$(OPT)" 
    564   PYTHON_LINK="$am_cv_python_LDSHARED -o \[$]@" 
    565  
    566 else 
    567   PYTHON_CC="" 
    568   PYTHON_OPT="" 
    569   PYTHON_SO="" 
    570   PYTHON_CFLAGS="" 
    571   PYTHON_LINK="" 
    572 fi 
    573  
    574 AC_MSG_CHECKING([for special pymod link hacks]) 
    575 if test ! -z "`uname | grep Darwin`" -a ${with_libtool} == no ; then 
    576     AC_MSG_RESULT(darwin-nonlibtool) 
    577  
    578     PY_LD_SHARED='g++ -bundle -framework Python' 
    579     PY_SO_EXT='so' 
    580 elif test ! -z "`uname | grep Darwin`" -a ${with_libtool} == yes ; then 
    581     AC_MSG_RESULT(darwin-libtool) 
    582  
    583     PYTHON_LIBS='-XCClinker -framework -XCClinker Python $(LIBS)' 
    584     PY_LD_SHARED='$(LD_SHARED)' 
    585     PY_SO_EXT='$(SO_EXT)' 
    586 else 
    587     AC_MSG_RESULT(default) 
    588  
    589     PY_LD_SHARED='$(LD_SHARED)' 
    590     PY_SO_EXT='$(SO_EXT)' 
    591 fi 
    592  
    593 export PY_LD_SHARED PY_SO_EXT 
    594  
    595 AC_SUBST(PY_LD_SHARED) 
    596 AC_SUBST(PY_SO_EXT)]) 
    597  
    598 AC_SUBST(PYTHON_CC)dnl 
    599 AC_SUBST(PYTHON_OPT)dnl 
    600 AC_SUBST(PYTHON_SO)dnl 
    601 AC_SUBST(PYTHON_CFLAGS)dnl 
    602 AC_SUBST(PYTHON_LIBS)dnl 
    603 AC_SUBST(PYTHON_LINK)]) 
     563 
     564        if test ! -f "$py_makefile"; then 
     565            echo Could not find the python config makefile.  Maybe you are; 
     566            echo missing the development portion of the python installation; 
     567            exit; 
     568        fi 
     569 
     570        eval `sed -n \ 
     571            -e "s/^CC=[         ]*\(.*\)/am_cv_python_CC='\1'/p" \ 
     572            -e "s/^OPT=[        ]*\(.*\)/am_cv_python_OPT='\1'/p" \ 
     573            -e "s/^CCSHARED=[   ]*\(.*\)/am_cv_python_CCSHARED='\1'/p" \ 
     574            -e "s/^LDSHARED=[   ]*\(.*\)/am_cv_python_LDSHARED='\1'/p" \ 
     575            -e "s/^SO=[         ]*\(.*\)/am_cv_python_SO='\1'/p" \ 
     576            $py_makefile` 
     577         
     578        am_cv_python_makefile=found 
     579        changequote([, ]) 
     580 
     581        AC_MSG_RESULT([$am_cv_python_makefile]) 
     582        ]) dnl AC_CACHE_VAL 
     583 
     584        dnl Check if everything compiles well 
     585        AC_MSG_CHECKING([for Python.h header]) 
     586        AC_LANG_PUSH([C]) 
     587 
     588        saved_CPPFLAGS="$CPPFLAGS" 
     589        CPPFLAGS="$PYTHON_INCLUDES" 
     590         
     591        AC_COMPILE_IFELSE( 
     592            [#include <Python.h>], 
     593            [ac_cv_python_dev_exists=yes], 
     594            [ac_cv_python_dev_exists=no] 
     595        ) 
     596 
     597        AC_LANG_POP() 
     598        CPPFLAGS="$saved_CPPFLAGS" 
     599 
     600        if test ! "$ac_cv_python_dev_exists" = "yes"; then 
     601            AC_MSG_RESULT([not found]) 
     602            PYTHON_DEV="no" 
     603 
     604            AC_MSG_WARN([ 
     605*** Could not compile test program with Python.h included, so Python bindings for GDAL will not be built. 
     606*** Check if you have installed development version of the Python package for your distribution.]) 
     607 
     608        else 
     609            AC_MSG_RESULT([found]) 
     610            PYTHON_DEV="yes" 
     611 
     612            PYTHON_CC="$am_cv_python_CC" 
     613            PYTHON_OPT="$am_cv_python_OPT" 
     614            PYTHON_SO="$am_cv_python_SO" 
     615            PYTHON_CFLAGS="$am_cv_python_CCSHARED \$(OPT)" 
     616            PYTHON_LINK="$am_cv_python_LDSHARED -o \[$]@" 
     617        fi 
     618    fi 
     619 
     620    if test "$PYTHON_DEV" = "yes"; then 
     621        AC_MSG_CHECKING([for special pymod link hacks]) 
     622        if test ! -z "`uname | grep Darwin`" -a ${with_libtool} == no ; then 
     623            AC_MSG_RESULT([darwin-nonlibtool]) 
     624            PY_LD_SHARED='g++ -bundle -framework Python' 
     625            PY_SO_EXT='so' 
     626        elif test ! -z "`uname | grep Darwin`" -a ${with_libtool} == yes ; then 
     627            AC_MSG_RESULT([darwin-libtool]) 
     628            PYTHON_LIBS='-XCClinker -framework -XCClinker Python $(LIBS)' 
     629            PY_LD_SHARED='$(LD_SHARED)' 
     630            PY_SO_EXT='$(SO_EXT)' 
     631        else 
     632            AC_MSG_RESULT([default]) 
     633            PY_LD_SHARED='$(LD_SHARED)' 
     634            PY_SO_EXT='$(SO_EXT)' 
     635        fi 
     636    else 
     637        PYTHON_CC="" 
     638        PYTHON_OPT="" 
     639        PYTHON_SO="" 
     640        PYTHON_CFLAGS="" 
     641        PYTHON_LINK="" 
     642        PYTHON_LIBS="" 
     643        PY_LD_SHARED="" 
     644        PY_SO_EXT="" 
     645    fi 
     646 
     647 
     648    export PY_LD_SHARED PY_SO_EXT 
     649 
     650    AC_SUBST([PYTHON_CC]) 
     651    AC_SUBST([PYTHON_OPT]) 
     652    AC_SUBST([PYTHON_SO]) 
     653    AC_SUBST([PYTHON_CFLAGS]) 
     654    AC_SUBST([PYTHON_LIBS]) 
     655    AC_SUBST([PYTHON_LINK]) 
     656    AC_SUBST([PY_LD_SHARED]) 
     657    AC_SUBST([PY_SO_EXT]) 
     658 
     659    dnl Main flag indicating if Python development package has been found. 
     660    dnl PYTHON and PYTHON_DEV are used together to decide about building Python bindings for GDAL. 
     661    AC_SUBST([PYTHON_DEV]) 
     662 
     663]) dnl AM_INIT_PYEXEC_MOD 
     664 
    604665 
    605666dnl 
     
    608669 
    609670AC_DEFUN(AM_CHECK_NUMPY, 
    610   [ 
    611   AC_MSG_CHECKING([for NumPy include files]) 
     671
     672  AC_MSG_CHECKING([for Python NumPy headers]) 
     673 
    612674  echo '#include "Python.h"' > conftest.c 
    613675  echo '#include "Numeric/arrayobject.h"' >> conftest.c 
    614676  if test -z "`${CC-cc} $PYTHON_INCLUDES -c conftest.c 2>&1`"; then 
    615677    HAVE_NUMPY=yes 
    616     AC_MSG_RESULT(found
     678    AC_MSG_RESULT([found]
    617679  else 
    618680    HAVE_NUMPY=no 
    619     AC_MSG_RESULT(missing
     681    AC_MSG_RESULT([not found]
    620682  fi 
    621683  export HAVE_NUMPY 
    622684  rm -f conftest.c 
    623685 
    624   AC_SUBST(HAVE_NUMPY
     686  AC_SUBST([HAVE_NUMPY]
    625687  if test "$HAVE_NUMPY" = "yes" ; then 
    626688    NUMPY_FLAG=-DHAVE_NUMPY 
    627689  else 
    628     NUMPY_FLAG= 
     690    NUMPY_FLAG=-UHAVE_NUMPY 
    629691  fi 
    630692  export NUMPY_FLAG 
    631   AC_SUBST(NUMPY_FLAG)]) 
     693  AC_SUBST([NUMPY_FLAG]) 
     694]) 
    632695 
    633696