Use pkg-config for figuring python cflags and libs
Simplifies things a bit and also makes "PYTHON=python3 ./configure" work, whereas it previously barfed on figuring the library names like "libpython3.6m"
This commit is contained in:
parent
6d610e9b9a
commit
80b5c12eaa
25
configure.ac
25
configure.ac
|
@ -794,32 +794,15 @@ yes|no) ;;
|
|||
esac],
|
||||
[enable_python=no])
|
||||
|
||||
WITH_PYTHON_SUBPACKAGE=0
|
||||
AS_IF([test "$enable_python" = yes],[
|
||||
AM_PATH_PYTHON([2.6],[
|
||||
WITH_PYTHON_INCLUDE=`${PYTHON} -c 'from distutils.sysconfig import *; import sys; sys.stdout.write(get_python_inc())'`
|
||||
WITH_PYTHON_SUBPACKAGE=1
|
||||
save_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS -I$WITH_PYTHON_INCLUDE"
|
||||
AC_CHECK_HEADER([Python.h],[],
|
||||
[AC_MSG_ERROR([missing Python.h])
|
||||
])
|
||||
CPPFLAGS="$save_CPPFLAGS"
|
||||
save_LIBS="$LIBS"
|
||||
AC_SEARCH_LIBS([Py_Main],[python${PYTHON_VERSION} python],[
|
||||
WITH_PYTHON_LIB="$ac_res"
|
||||
],[AC_MSG_ERROR([missing python library])
|
||||
])
|
||||
LIBS="$save_LIBS"
|
||||
PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}], [WITH_PYTHON_SUBPACKAGE=1])
|
||||
AC_SUBST(PYTHON_CFLAGS)
|
||||
AC_SUBST(PYTHON_LIB)
|
||||
])
|
||||
],[
|
||||
WITH_PYTHON_INCLUDE=
|
||||
WITH_PYTHON_LIB=
|
||||
WITH_PYTHON_SUBPACKAGE=0
|
||||
])
|
||||
|
||||
AC_SUBST(WITH_PYTHON_INCLUDE)
|
||||
AC_SUBST(WITH_PYTHON_LIB)
|
||||
|
||||
AM_CONDITIONAL(ENABLE_PYTHON,[test "$WITH_PYTHON_SUBPACKAGE" = 1])
|
||||
|
||||
AC_PATH_PROG(DOXYGEN, doxygen, no)
|
||||
|
|
|
@ -7,7 +7,7 @@ EXTRA_DIST = rpm/__init__.py rpm/transaction.py
|
|||
|
||||
AM_CPPFLAGS = -I$(top_builddir)/include/
|
||||
AM_CPPFLAGS += -I$(top_srcdir)/python
|
||||
AM_CPPFLAGS += -I@WITH_PYTHON_INCLUDE@
|
||||
AM_CPPFLAGS += @PYTHON_CFLAGS@
|
||||
|
||||
pkgpyexec_LTLIBRARIES = _rpm.la _rpmb.la _rpms.la
|
||||
pkgpyexec_DATA = rpm/__init__.py rpm/transaction.py
|
||||
|
@ -16,7 +16,7 @@ _rpm_la_LDFLAGS = -module -avoid-version -shared
|
|||
_rpm_la_LIBADD = \
|
||||
$(top_builddir)/lib/librpm.la \
|
||||
$(top_builddir)/rpmio/librpmio.la \
|
||||
@WITH_PYTHON_LIB@
|
||||
@PYTHON_LIBS@
|
||||
|
||||
_rpm_la_SOURCES = rpmmodule.c rpmsystem-py.h \
|
||||
header-py.c header-py.h \
|
||||
|
@ -40,7 +40,7 @@ _rpmb_la_LIBADD = \
|
|||
$(top_builddir)/build/librpmbuild.la \
|
||||
$(top_builddir)/lib/librpm.la \
|
||||
$(top_builddir)/rpmio/librpmio.la \
|
||||
@WITH_PYTHON_LIB@
|
||||
@PYTHON_LIBS@
|
||||
|
||||
_rpmb_la_SOURCES = rpmbmodule.c rpmsystem-py.h \
|
||||
spec-py.c spec-py.h
|
||||
|
@ -50,7 +50,7 @@ _rpms_la_LIBADD = \
|
|||
$(top_builddir)/sign/librpmsign.la \
|
||||
$(top_builddir)/lib/librpm.la \
|
||||
$(top_builddir)/rpmio/librpmio.la \
|
||||
@WITH_PYTHON_LIB@
|
||||
@PYTHON_LIBS@
|
||||
|
||||
_rpms_la_SOURCES = rpmsmodule.c rpmsystem-py.h
|
||||
|
||||
|
|
Loading…
Reference in New Issue