diff --git a/config.m4 b/config.m4 index e63353a..3233e11 100644 --- a/config.m4 +++ b/config.m4 @@ -1,21 +1,10 @@ dnl $Id$ dnl config.m4 for extension phpy -PHP_ARG_WITH([python_dir], - [dir of python], - [AS_HELP_STRING([[--with-python-dir[=DIR]]], - [Specify python installation dir, default is /opt/anaconda3])], [no], [no]) - - PHP_ARG_WITH([python_version], [version of python], [AS_HELP_STRING([[--with-python-version[=VERSION]]], - [Specify version of python, default is 3.11])], [no], [no]) - -PHP_ARG_WITH([python_config], - [path of python_config], - [AS_HELP_STRING([[--with-python-config[=PATH]]], - [Specify path of python_config])], [no], [no]) + [Specify version of python, or use default (ex: 3.12)])], [no], [no]) PHP_ARG_ENABLE([phpy], [whether to enable phpy support], @@ -24,28 +13,13 @@ PHP_ARG_ENABLE([phpy], [no]) if test "$PHP_PHPY" != "no"; then - if test "$PHP_PYTHON_CONFIG" != "no"; then - INCLUDES="$INCLUDES $($PHP_PYTHON_CONFIG --includes)" - LDFLAGS="$LDFLAGS $($PHP_PYTHON_CONFIG --embed --ldflags)" + if test "$PHP_PYTHON_VERSION" = "no"; then + PKG_CHECK_MODULES([PYTHON], [python3-embed >= 3.8]) else - if test "$PHP_PYTHON_DIR" = "no"; then - PHP_PYTHON_DIR="/opt/anaconda3" - fi - if test "$PHP_PYTHON_VERSION" = "no"; then - if test -f "${PHP_PYTHON_DIR}/bin/python"; then - PHP_PYTHON_VERSION=$("${PHP_PYTHON_DIR}/bin/python" -c "import sys; print('%d.%d'%(sys.version_info.major, sys.version_info.minor))") - elif test -f "${PHP_PYTHON_DIR}/python"; then - PHP_PYTHON_VERSION=$("${PHP_PYTHON_DIR}/python" -c "import sys; print('%d.%d'%(sys.version_info.major, sys.version_info.minor))") - else - PHP_PYTHON_VERSION="3.11" - fi - fi - AC_MSG_RESULT([PYTHON_DIR=${PHP_PYTHON_DIR}]) - AC_MSG_RESULT([PYTHON_VERSION=${PHP_PYTHON_VERSION}]) - - PHP_ADD_INCLUDE("${PHP_PYTHON_DIR}/include/python${PHP_PYTHON_VERSION}") - PHP_ADD_LIBRARY_WITH_PATH("python${PHP_PYTHON_VERSION}", "${PHP_PYTHON_DIR}/lib", PHPY_SHARED_LIBADD) + PKG_CHECK_MODULES([PYTHON], [python-${PHP_PYTHON_VERSION}-embed >= 3.8]) fi + PHP_EVAL_LIBLINE($PYTHON_LIBS, PHPY_SHARED_LIBADD) + PHP_EVAL_INCLINE($PYTHON_CFLAGS) PHP_REQUIRE_CXX() @@ -53,8 +27,8 @@ if test "$PHP_PHPY" != "no"; then AC_DEFINE(HAVE_PHPY, 1, [ Have phpy support ]) - CXXFLAGS="$CXXFLAGS -Wall -Wno-unused-function -Wno-deprecated -Wno-deprecated-declarations -z now" - CXXFLAGS="$CXXFLAGS -std=c++14" + EXTRAS_CXXFLAGS="-Wall -Wno-unused-function -Wno-deprecated -Wno-deprecated-declarations -z now" + EXTRAS_CXXFLAGS="$EXTRAS_CXXFLAGS -std=c++14" if test -f "$abs_srcdir/phpy.cc"; then phpy_source_dir=$abs_srcdir @@ -68,7 +42,7 @@ if test "$PHP_PHPY" != "no"; then phpy_source_files=$(cd $phpy_source_dir && find src -type f -name "*.cc") phpy_source_files="phpy.cc $phpy_source_files" - PHP_NEW_EXTENSION(phpy, $phpy_source_files , $ext_shared,,, cxx) + PHP_NEW_EXTENSION(phpy, $phpy_source_files , $ext_shared,, $EXTRAS_CXXFLAGS, cxx) AC_MSG_RESULT([$ext_builddir]) diff --git a/package.xml b/package.xml index 90cd4a0..3bbc9fe 100644 --- a/package.xml +++ b/package.xml @@ -104,6 +104,6 @@ http://pear.php.net/dtd/package-2.0.xsd"> phpy - +