Python 2.7, and 3.2 and higher support querying compilation
flags through pkg-config. This makes python support follow
rules similar to various other optional compilation-time
libraries. New flags are called PYTHON_DEVEL_CFLAGS and
PYTHON_DEVEL_LIBS, because PYTHON (without _DEVEL), is
already used for the python binary name, and things would
be confusing if the same prefix was used for two things.
configure has --disable-python-devel to disable python modules.
One advantage is that CFLAGS for modules gets smaller:
- -I/usr/include/python3.3m -I/usr/include/python3.3m -Wno-unused-result -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv
+ -I/usr/include/python3.3m
as does LIBS:
- -lpthread -ldl -lutil -lm -lpython3.3m
+ -lpython3.3m
Support for Python 2.6 is removed, but can be easily
restored by using
PYTHON_DEVEL_CFLAGS="$(python2.6-config --cflags)",
etc., as ./configure parameters.
https://bugs.freedesktop.org/show_bug.cgi?id=57800
_journal_la_CFLAGS = \
$(AM_CFLAGS) \
-fvisibility=default \
_journal_la_CFLAGS = \
$(AM_CFLAGS) \
-fvisibility=default \
_journal_la_LDFLAGS = \
$(AM_LDFLAGS) \
_journal_la_LDFLAGS = \
$(AM_LDFLAGS) \
-avoid-version
_journal_la_LIBADD = \
-avoid-version
_journal_la_LIBADD = \
libsystemd-journal.la
id128_la_SOURCES = \
libsystemd-journal.la
id128_la_SOURCES = \
id128_la_CFLAGS = \
$(AM_CFLAGS) \
-fvisibility=default \
id128_la_CFLAGS = \
$(AM_CFLAGS) \
-fvisibility=default \
+ $(PYTHON_DEVEL_CFLAGS) \
-I$(top_builddir)/src/python-systemd
id128_la_LDFLAGS = \
-I$(top_builddir)/src/python-systemd
id128_la_LDFLAGS = \
-avoid-version
id128_la_LIBADD = \
-avoid-version
id128_la_LIBADD = \
libsystemd-id128.la
_daemon_la_SOURCES = \
libsystemd-id128.la
_daemon_la_SOURCES = \
_daemon_la_CFLAGS = \
$(AM_CFLAGS) \
-fvisibility=default \
_daemon_la_CFLAGS = \
$(AM_CFLAGS) \
-fvisibility=default \
+ $(PYTHON_DEVEL_CFLAGS) \
-I$(top_builddir)/src/python-systemd
_daemon_la_LDFLAGS = \
-I$(top_builddir)/src/python-systemd
_daemon_la_LDFLAGS = \
-avoid-version
_daemon_la_LIBADD = \
-avoid-version
_daemon_la_LIBADD = \
libsystemd-daemon.la
_reader_la_SOURCES = \
libsystemd-daemon.la
_reader_la_SOURCES = \
_reader_la_CFLAGS = \
$(AM_CFLAGS) \
-fvisibility=default \
_reader_la_CFLAGS = \
$(AM_CFLAGS) \
-fvisibility=default \
_reader_la_LDFLAGS = \
$(AM_LDFLAGS) \
_reader_la_LDFLAGS = \
$(AM_LDFLAGS) \
-avoid-version
_reader_la_LIBADD = \
-avoid-version
_reader_la_LIBADD = \
libsystemd-journal.la \
libsystemd-id128.la \
libsystemd-shared.la \
libsystemd-journal.la \
libsystemd-id128.la \
libsystemd-shared.la \
login_la_CFLAGS = \
$(AM_CFLAGS) \
-fvisibility=default \
login_la_CFLAGS = \
$(AM_CFLAGS) \
-fvisibility=default \
login_la_LDFLAGS = \
$(AM_LDFLAGS) \
login_la_LDFLAGS = \
$(AM_LDFLAGS) \
-avoid-version
login_la_LIBADD = \
-avoid-version
login_la_LIBADD = \
libsystemd-journal.la \
libsystemd-login.la \
libsystemd-shared.la \
libsystemd-journal.la \
libsystemd-login.la \
libsystemd-shared.la \
--param=ssp-buffer-size=4])
AC_SUBST([OUR_CFLAGS], $with_cflags)
--param=ssp-buffer-size=4])
AC_SUBST([OUR_CFLAGS], $with_cflags)
-AS_CASE([$CFLAGS], [*-O[[12345g\ ]]*], [
- CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
- -Wp,-D_FORTIFY_SOURCE=2])], [
- python_extra_cflags=-Wp,-U_FORTIFY_SOURCE
- AC_MSG_RESULT([skipping -D_FORTIFY_SOURCE, optimization not enabled])])
+AS_CASE([$CFLAGS], [*-O[[12345g\ ]]*],
+ [CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
+ -Wp,-D_FORTIFY_SOURCE=2])],
+ [AC_MSG_RESULT([skipping -D_FORTIFY_SOURCE, optimization not enabled])])
AC_SUBST([OUR_CPPFLAGS], $with_cppflags)
CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
AC_SUBST([OUR_CPPFLAGS], $with_cppflags)
CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
# ------------------------------------------------------------------------------
# we use python to build the man page index, and for systemd-python
have_python=no
# ------------------------------------------------------------------------------
# we use python to build the man page index, and for systemd-python
have_python=no
AC_ARG_WITH([python],
[AS_HELP_STRING([--without-python], [Disable building the man page index and systemd-python (default: test)])])
AC_ARG_WITH([python],
[AS_HELP_STRING([--without-python], [Disable building the man page index and systemd-python (default: test)])])
[PYTHON_BINARY=/usr/bin/python])])
AC_ARG_VAR(PYTHON_BINARY, [Python binary used to launch installed scripts])
[PYTHON_BINARY=/usr/bin/python])])
AC_ARG_VAR(PYTHON_BINARY, [Python binary used to launch installed scripts])
-AS_IF([test "x$with_python" != "xno"], [
- AC_PATH_PROG(PYTHON_CONFIG, python${PYTHON_VERSION}-config)
- AS_IF([test -n "$PYTHON_CONFIG"], [
- have_python_devel=yes
- PYTHON_CFLAGS="$($PYTHON_CONFIG --cflags) $python_extra_cflags"
- PYTHON_LIBS="$($PYTHON_CONFIG --ldflags)"
- AC_SUBST(PYTHON_CFLAGS)
- AC_SUBST(PYTHON_LIBS)
- AC_PATH_PROGS(SPHINX_BUILD, sphinx-build-${PYTHON_VERSION} sphinx-build)
- ])
+have_python_devel=no
+AC_ARG_ENABLE(python_devel, AS_HELP_STRING([--disable-python-devel], [Do not build python modules]))
+AS_IF([test "x$enable_python_devel" != "xno"], [
+ PKG_CHECK_MODULES([PYTHON_DEVEL], [python-${PYTHON_VERSION}],
+ [have_python_devel=yes],
+ [PKG_CHECK_MODULES([PYTHON_DEVEL], [python],
+ [have_python_devel=yes],
+ [have_python_devel=no])])
+ AS_IF([test "x$have_python_devel" = xno -a "x$enable_python_devel" = xyes],
+ [AC_MSG_ERROR([*** python-devel support requested but libraries not found])])
])
AM_CONDITIONAL([HAVE_PYTHON_DEVEL], [test "$have_python_devel" = "yes"])
])
AM_CONDITIONAL([HAVE_PYTHON_DEVEL], [test "$have_python_devel" = "yes"])
CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
- PYTHON_CFLAGS: ${PYTHON_CFLAGS}
- PYTHON_LIBS: ${PYTHON_LIBS}
+ PYTHON_CFLAGS: ${PYTHON_DEVEL_CFLAGS}
+ PYTHON_LIBS: ${PYTHON_DEVEL_LIBS}