[gdal-dev] Compiling on cygwin

Norman Vine nhv at y...
Wed Nov 7 00:24:32 EST 2001


Frank Warmerdam writes:
>
>Norman,
>
>I have added pymod/cygMakefile to CVS though it isn't likely to be
maintained
>properly.

see below for my way of having configure do this
esp see CCSHARED

>I have also modified configure to set the EXE macro in GDALmake.opt.in
as well as overriding SO_EXT to dll (not that this is set
>by the LD_SHARED macro in aclocal.m4). I also modified the
>apps/GNUmakefile to use $(EXE) to properly name .exe executables (though I
>haven't found this >to be necessary since I added the .exe hack to
install-sh).

Right It isn't necessary to make the files
but it is necessary for make clean

>
>What I can't seem to do with cygwin-1.3.3 (2001-09-12) is to produce shared
>libraries or dlls. How do you do this? What version of Cygwin do I need?

You need to upgrade your 'binutils' and perhaps the 'gcc' package(s)
these have been out of beta for about a month

FYI though not necessary for the dll stuff cygwin 1.3.4 was released this
week
and has a number of 'nice' additions / fixes esp if you are using PostGis.

Cheers

Norman

===== cut =====
dnl @synopsis AC_PROG_PYTHON([version])
dnl
dnl This macro searches for an installed python.
AC_DEFUN([AC_PROG_PYTHON],
[
AC_MSG_CHECKING(if python is wanted)
AC_ARG_WITH(python,
[ --with-python=DIR path to python interpreter])
case "$with_python" in
no) AC_MSG_RESULT(no) ;;
*)
AC_MSG_RESULT(yes)
if test "x$with_python" != x; then
test -f "$with_python" && PYTHON=$with_python
else
AC_PATH_PROG(PYTHON,python)
fi

if test "x$PYTHON" != x; then
_py_version=`$PYTHON -c 'import sys; print sys.version[[0:3]]'`
_py_prefix=`$PYTHON -c 'import sys; print sys.prefix'`
_py_exec_prefix=`$PYTHON -c 'import sys; print sys.exec_prefix'`
_py_linkforshared=`$PYTHON -c 'import distutils.sysconfig; print
distutils.sysconfig.get_config_var("LINKFORSHARED")'`
_py_ccshared=`$PYTHON -c 'import distutils.sysconfig; print
distutils.sysconfig.get_config_var("CCSHARED")'`

_py_include="$_py_prefix/include/python$_py_version"
_py_lib="$_py_exec_prefix/lib/python$_py_version/config"
_py_makefile="$_py_lib/Makefile"

if test $_py_version = 1.5; then
echo
echo "*** WARNING:"
echo "*** Python version 1.5 detected: This version of Python has a
known fatal"
echo "*** bug. Disabling Python interface. If you want the embedded
Python"
echo "*** interface, you will need to get an updated version of
Python."
echo
PYTHON=""
fi

if test -f $_py_makefile; then
_py_libs=`sed -n -e 's/^LIBS=\(.*\)/\1/p' $_py_makefile`
_py_libm=`sed -n -e 's/^LIBM=\(.*\)/\1/p' $_py_makefile`
else
_py_libs='-lpthread -ldl -lutil -ldb'
_py_libm='-lm'
fi

# Now that we think we know where the python include and
# library files are, make sure we can build a small
# program against them.
_save_CPPFLAGS=${CPPFLAGS}
_save_LDFLAGS=${LDFLAGS}
_save_LIBS=${LIBS}

CPPFLAGS="$CPPFLAGS $_py_ccshared -I$_py_include"
LDFLAGS="$LDFLAGS $_py_linkforshared -L$_py_lib"
LIBS="$LIBS -lpython$_py_version $_py_libs $_py_libm"

_have_python=0
AC_CHECK_HEADER(Python.h,[
AC_MSG_CHECKING([for Py_Initialize in -lpython$_py_version])
AC_TRY_LINK([#include "Python.h"],[
Py_Initialize();],[
_have_python=1
M4_DEFS='-DHAVE_PYTHON=1'
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_PYTHON)],
AC_MSG_RESULT(no))])

if test "x$_have_python" = x0; then
CPPFLAGS=$_save_CPPFLAGS
LDFLAGS=$_save_LDFLAGS
LIBS=$_save_LIBS
PYTHON=""
fi
fi
;;
esac
])





More information about the Gdal-dev mailing list