check for Python presence

git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2012 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.5
Stéphane Fillod, F8CFE 2005-04-13 18:56:19 +00:00
rodzic 25ab6898d7
commit 2f18531e26
3 zmienionych plików z 55 dodań i 5 usunięć

Wyświetl plik

@ -90,7 +90,7 @@ python_ltlib = _Hamlib.la
pythondir = $(prefix)/lib/python
nodist__Hamlib_la_SOURCES = hamlibpy_wrap.c
_Hamlib_la_LDFLAGS = -no-undefined -module -avoid-version
_Hamlib_la_LDFLAGS = -no-undefined -module -avoid-version @PYTHON_LDFLAGS@
_Hamlib_la_LIBADD = $(top_builddir)/src/libhamlib.la
_Hamlib_ladir = $(pythondir)
@ -114,7 +114,7 @@ uninstall-py:
##########################################
lib_LTLIBRARIES = $(tcl_ltlib) $(python_ltlib)
EXTRA_LTLIBRARIES = $(tcl_ltlib) $(python_ltlib)
all-local: @BINDING_ALL@

Wyświetl plik

@ -270,7 +270,6 @@ SC_PATH_TCLCONFIG
if test x"${no_tcl}" = x; then
SC_LOAD_TCLCONFIG
tcl_save_CPPFLAGS=$CPPFLAGS
echo $TCL_INCLUDE_SPEC
CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC"
AC_CHECK_HEADERS([tcl.h],
[cf_with_tcl=yes])
@ -303,12 +302,11 @@ AC_SUBST(TCL_SHLIB_SUFFIX)
dnl Check for python availability, so we can enable HamlibPy
PYTHON_DEVEL
cf_with_python=yes
AC_MSG_CHECKING(whether to build python binding and demo)
AC_ARG_WITH(python-binding,
[ --with-python-binding build python binding and demo],
[cf_with_python_binding=$withval],
[cf_with_python_binding=$cf_with_python])
[cf_with_python_binding=$cf_with_python_devel])
AC_MSG_RESULT($cf_with_python_binding)
if test "${cf_with_python_binding}" = "yes" ; then

Wyświetl plik

@ -47,6 +47,58 @@ AC_DEFUN([PYTHON_DEVEL],[
AC_MSG_WARN([cannot find Python include path])
else
AC_SUBST(PYTHON_CPPFLAGS,[-I$python_path])
# Check for Python headers usability
python_save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
AC_CHECK_HEADERS([Python.h],, [cf_with_python_devel=no])
CPPFLAGS="$python_save_CPPFLAGS"
if test "$cf_with_python_devel" != "no" ; then
# Check for Python library path
AC_MSG_CHECKING([for Python library path])
python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
for i in "$python_path/lib/python$PYTHON_VERSION/config/" "$python_path/lib/python$PYTHON_VERSION/" "$python_path/lib/python/config/" "$python_path/lib/python/" "$python_path/" ; do
python_path=`find $i -type f -name libpython$PYTHON_VERSION.* -print | sed "1q"`
if test -n "$python_path" ; then
break
fi
done
python_path=`echo $python_path | sed "s,/libpython.*$,,"`
AC_MSG_RESULT([$python_path])
if test -z "$python_path" ; then
AC_MSG_WARN([cannot find Python library path])
fi
AC_SUBST([PYTHON_LDFLAGS],["-L$python_path -lpython$PYTHON_VERSION"])
#
python_site=`echo $python_path | sed "s/config/site-packages/"`
AC_SUBST([PYTHON_SITE_PKG],[$python_site])
#
# libraries which must be linked in when embedding
#
AC_MSG_CHECKING(python extra libraries)
PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
conf = distutils.sysconfig.get_config_var; \
print conf('LOCALMODLIBS')+' '+conf('LIBS')"
AC_MSG_RESULT($PYTHON_EXTRA_LIBS)`
AC_SUBST(PYTHON_EXTRA_LIBS)
# Check for Python library usability
python_save_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS $PYTHON_LDFLAGS"
AC_CHECK_FUNC(PyArg_Parse,
[cf_with_python_devel=yes],
[cf_with_python_devel=no])
LDFLAGS="$python_save_LDFLAGS"
fi
fi
fi
])