| 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 ' |
|---|
| 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 |
|---|
| 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 | |
|---|