Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix python detection #123

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ HOWTO
boost.m4 (set it to `.' if you put boost.m4 in the same, top-level
directory).
3. If you don't use GNU Libtool already, then time has come to do the switch.
Add AC_PROG_LIBTOOL to your configure.ac then, in all the Makefile.am of
Add LT_INIT to your configure.ac then, in all the Makefile.am of
your project, change *_LIBRARIES to *_LTLIBRARIES (notice the extra `LT')
for each of your library that depends on Boost. This way, Automake will
delegate the build of your libraries to Libtool which will do the necessary
Expand Down
30 changes: 21 additions & 9 deletions build-aux/boost.m4
Original file line number Diff line number Diff line change
Expand Up @@ -1216,31 +1216,43 @@ BOOST_DEFUN([Program_Options],



# _BOOST_PYTHON_CONFIG(VARIABLE, FLAG)
# _BOOST_PYTHON_CONFIG(PYTHON_CONFIG, VARIABLE, FLAG, EXTRA)
# ------------------------------------
# Save VARIABLE, and define it via `python-config --FLAG`.
# Substitute BOOST_PYTHON_VARIABLE.
m4_define([_BOOST_PYTHON_CONFIG],
[AC_SUBST([BOOST_PYTHON_$1],
[`python-config --$2 2>/dev/null`])dnl
boost_python_save_$1=$$1
$1="$$1 $BOOST_PYTHON_$1"])
[AC_SUBST([BOOST_PYTHON_$2],
[`$1 --$3 2>/dev/null`])dnl
boost_python_save_$2=$$2
$2="$$2 $BOOST_PYTHON_$2 $4"])


# BOOST_PYTHON([PREFERRED-RT-OPT], [ERROR_ON_UNUSABLE])
# --------------------------------
# Look for Boost.Python. For the documentation of PREFERRED-RT-OPT,
# see the documentation of BOOST_FIND_LIB above.
BOOST_DEFUN([Python],
[_BOOST_PYTHON_CONFIG([CPPFLAGS], [includes])
_BOOST_PYTHON_CONFIG([LDFLAGS], [ldflags])
_BOOST_PYTHON_CONFIG([LIBS], [libs])
[
boost_python_version=''
boost_python_config_prog=''

for python_version in 3.9 3.8 3.7 3.6 3.5 3 ''; do
AC_CHECK_PROGS(PYTHON_CONFIG_BIN, [python$python_version-config])
boost_python_config_prog=$PYTHON_CONFIG_BIN
boost_python_version=$python_version
AS_IF([test -n "$boost_python_config_prog"], [break])
done
AS_IF([test -z "$boost_python_config_prog"], AC_MSG_ERROR([Could not find a python-config executable]))

_BOOST_PYTHON_CONFIG([$boost_python_config_prog], [CPPFLAGS], [includes])
_BOOST_PYTHON_CONFIG([$boost_python_config_prog], [LDFLAGS], [ldflags], [-lpython$boost_python_version])
_BOOST_PYTHON_CONFIG([$boost_python_config_prog], [LIBS], [libs])
m4_pattern_allow([^BOOST_PYTHON_MODULE$])dnl
BOOST_FIND_LIBS([python], [python python3], [$1],
[boost/python.hpp],
[], [BOOST_PYTHON_MODULE(empty) {}], [], [$2])
CPPFLAGS=$boost_python_save_CPPFLAGS
LDFLAGS=$boost_python_save_LDFLAGS
LDFLAGS=$boost_python_save_LDFLAGS -lpython$boost_python_version
LIBS=$boost_python_save_LIBS
])# BOOST_PYTHON

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ AM_INIT_AUTOMAKE

AC_CANONICAL_HOST

AC_PROG_LIBTOOL
LT_INIT

AC_PROG_GREP
AC_PROG_EGREP
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite.at
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ done
AT_DATA([configure.ac],
[[AC_INIT
AC_CONFIG_AUX_DIR([$top_srcdir/build-aux])]
AC_PROG_LIBTOOL
LT_INIT
AC_PROG_CXX
$1
[AC_OUTPUT
Expand Down