diff --git a/configure b/configure index c76cb4790f..840d7f894b 100755 --- a/configure +++ b/configure @@ -6806,8 +6806,10 @@ $as_echo "no" >&6; } fi -# Extract the first word of "python", so it can be a program name with args. -set dummy python; ac_word=$2 +for ac_prog in python2.7 python2 python python3 +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PYTHON+:} false; then : @@ -6833,7 +6835,6 @@ done done IFS=$as_save_IFS - test -z "$ac_cv_path_PYTHON" && ac_cv_path_PYTHON=":" ;; esac fi @@ -6847,6 +6848,10 @@ $as_echo "no" >&6; } fi + test -n "$PYTHON" && break +done +test -n "$PYTHON" || PYTHON=":" + # Extract the first word of "find", so it can be a program name with args. set dummy find; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -25944,10 +25949,187 @@ fi fi + + if test "x$PBX_PJPROJECT" = "x1" ; then + if test "x${AST_DEVMODE}" = "xyes" ; then + + + + if test "x${PBX_PYTHONDEV}" != "x1" -a "${USE_PYTHONDEV}" != "no"; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PYTHONDEV" >&5 +$as_echo_n "checking for PYTHONDEV... " >&6; } + +if test -n "$PYTHONDEV_CFLAGS"; then + pkg_cv_PYTHONDEV_CFLAGS="$PYTHONDEV_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python-2.7\""; } >&5 + ($PKG_CONFIG --exists --print-errors "python-2.7") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PYTHONDEV_CFLAGS=`$PKG_CONFIG --cflags "python-2.7" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$PYTHONDEV_LIBS"; then + pkg_cv_PYTHONDEV_LIBS="$PYTHONDEV_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python-2.7\""; } >&5 + ($PKG_CONFIG --exists --print-errors "python-2.7") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PYTHONDEV_LIBS=`$PKG_CONFIG --libs "python-2.7" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried fi +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + PYTHONDEV_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "python-2.7" 2>&1` + else + PYTHONDEV_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "python-2.7" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$PYTHONDEV_PKG_ERRORS" >&5 + + + PBX_PYTHONDEV=0 + + +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + PBX_PYTHONDEV=0 + + +else + PYTHONDEV_CFLAGS=$pkg_cv_PYTHONDEV_CFLAGS + PYTHONDEV_LIBS=$pkg_cv_PYTHONDEV_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + PBX_PYTHONDEV=1 + PYTHONDEV_INCLUDE=$(echo ${PYTHONDEV_CFLAGS} | $SED -e "s|-std=c99||g") + PYTHONDEV_LIB="$PYTHONDEV_LIBS" + +$as_echo "#define HAVE_PYTHONDEV 1" >>confdefs.h + + +fi + fi + + + if test "x${PBX_PYTHONDEV}" != "x1" -a "${USE_PYTHONDEV}" != "no"; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PYTHONDEV" >&5 +$as_echo_n "checking for PYTHONDEV... " >&6; } + +if test -n "$PYTHONDEV_CFLAGS"; then + pkg_cv_PYTHONDEV_CFLAGS="$PYTHONDEV_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "python2") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PYTHONDEV_CFLAGS=`$PKG_CONFIG --cflags "python2" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$PYTHONDEV_LIBS"; then + pkg_cv_PYTHONDEV_LIBS="$PYTHONDEV_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"python2\""; } >&5 + ($PKG_CONFIG --exists --print-errors "python2") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_PYTHONDEV_LIBS=`$PKG_CONFIG --libs "python2" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + PYTHONDEV_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "python2" 2>&1` + else + PYTHONDEV_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "python2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$PYTHONDEV_PKG_ERRORS" >&5 + + + PBX_PYTHONDEV=0 + + +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + PBX_PYTHONDEV=0 + + +else + PYTHONDEV_CFLAGS=$pkg_cv_PYTHONDEV_CFLAGS + PYTHONDEV_LIBS=$pkg_cv_PYTHONDEV_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + PBX_PYTHONDEV=1 + PYTHONDEV_INCLUDE=$(echo ${PYTHONDEV_CFLAGS} | $SED -e "s|-std=c99||g") + PYTHONDEV_LIB="$PYTHONDEV_LIBS" + +$as_echo "#define HAVE_PYTHONDEV 1" >>confdefs.h + + +fi + fi + if test "x${PBX_PYTHONDEV}" != "x1" -a "${USE_PYTHONDEV}" != "no"; then @@ -26036,6 +26218,16 @@ $as_echo "#define HAVE_PYTHONDEV 1" >>confdefs.h fi fi + # The PJProject offers a C extension to Python. That wrapper is used by the + # Asterisk Test Framework, which requires Asterisk to be in Developer Mode. + # However, the used wrapper (called 'PJSUA Python') is deprecated and was not + # ported from Python 2.7 to Python 3.x. This is confirmed; it simply does not + # build. For more see . + # Therefore, the C libraries for Python 3 are of no help in Asterisk: + #AST_PKG_CONFIG_CHECK([PYTHONDEV], [python3]) + fi + fi +fi if test "x${PBX_POPT}" != "x1" -a "${USE_POPT}" != "no"; then diff --git a/configure.ac b/configure.ac index dc94fdd6c5..71d3eb413a 100644 --- a/configure.ac +++ b/configure.ac @@ -264,7 +264,7 @@ AC_PATH_PROG([CAT], [cat], :) AC_PATH_PROG([CUT], [cut], :) AC_PATH_PROG([FLEX], [flex], :) AC_PATH_PROG([GREP], [grep], :) -AC_PATH_PROG([PYTHON], [python], :) +AC_PATH_PROGS([PYTHON], [python2.7 python2 python python3], :) AC_PATH_PROG([FIND], [find], :) AC_PATH_PROG([BASENAME], [basename], :) AC_PATH_PROG([DIRNAME], [dirname], :) @@ -2431,11 +2431,24 @@ if test "$USE_PJPROJECT" != "no" ; then AST_EXT_LIB_CHECK([PJSIP_AUTH_CLT_DEINIT], [pjsip], [pjsip_auth_clt_deinit], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS]) AST_EXT_LIB_CHECK([PJSIP_TSX_LAYER_FIND_TSX2], [pjsip], [pjsip_tsx_layer_find_tsx2], [pjsip.h], [$PJPROJECT_LIB], [$PJPROJECT_CFLAGS]) fi -fi -AC_SUBST([PYTHONDEV_LIB]) -AC_SUBST([PYTHONDEV_INCLUDE]) -AST_PKG_CONFIG_CHECK([PYTHONDEV], [python]) + if test "x$PBX_PJPROJECT" = "x1" ; then + if test "x${AST_DEVMODE}" = "xyes" ; then + AC_SUBST([PYTHONDEV_LIB]) + AC_SUBST([PYTHONDEV_INCLUDE]) + AST_PKG_CONFIG_CHECK([PYTHONDEV], [python-2.7]) + AST_PKG_CONFIG_CHECK([PYTHONDEV], [python2]) + AST_PKG_CONFIG_CHECK([PYTHONDEV], [python]) + # The PJProject offers a C extension to Python. That wrapper is used by the + # Asterisk Test Framework, which requires Asterisk to be in Developer Mode. + # However, the used wrapper (called 'PJSUA Python') is deprecated and was not + # ported from Python 2.7 to Python 3.x. This is confirmed; it simply does not + # build. For more see . + # Therefore, the C libraries for Python 3 are of no help in Asterisk: + #AST_PKG_CONFIG_CHECK([PYTHONDEV], [python3]) + fi + fi +fi AST_EXT_LIB_CHECK([POPT], [popt], [poptStrerror], [popt.h]) diff --git a/contrib/scripts/install_prereq b/contrib/scripts/install_prereq index 3f1f58f57d..323d7a75e1 100755 --- a/contrib/scripts/install_prereq +++ b/contrib/scripts/install_prereq @@ -31,7 +31,7 @@ PACKAGES_DEBIAN="$PACKAGES_DEBIAN libresample1-dev libc-client2007e-dev binutils # Asterisk: for the unpackaged below: PACKAGES_DEBIAN="$PACKAGES_DEBIAN wget subversion" # Asterisk: for ./configure --with-pjproject-bundled: -PACKAGES_DEBIAN="$PACKAGES_DEBIAN bzip2 patch python-dev" +PACKAGES_DEBIAN="$PACKAGES_DEBIAN bzip2 patch" # Basic build system: PACKAGES_RH="make gcc gcc-c++ pkgconfig" @@ -46,7 +46,7 @@ PACKAGES_RH="$PACKAGES_RH libresample-devel uw-imap-devel binutils-devel libsrtp # Asterisk: for the unpackaged below: PACKAGES_RH="$PACKAGES_RH wget subversion" # Asterisk: for ./configure --with-pjproject-bundled: -PACKAGES_RH="$PACKAGES_RH bzip2 patch python-devel" +PACKAGES_RH="$PACKAGES_RH bzip2 patch" # Basic build system: PACKAGES_SUSE="make gcc gcc-c++ pkg-config" @@ -61,7 +61,7 @@ PACKAGES_SUSE="$PACKAGES_SUSE imap-devel libsrtp2-devel libgsm-devel doxygen gra # Asterisk: for the unpackaged below: PACKAGES_SUSE="$PACKAGES_SUSE wget subversion" # Asterisk: for ./configure --with-pjproject-bundled: -PACKAGES_SUSE="$PACKAGES_SUSE bzip2 patch python-devel" +PACKAGES_SUSE="$PACKAGES_SUSE bzip2 patch" # Basic build system: PACKAGES_ARCH="make gcc pkg-config" @@ -76,7 +76,7 @@ PACKAGES_ARCH="$PACKAGES_ARCH c-client binutils libsrtp gsm doxygen graphviz zli # Asterisk: for the unpackaged below: PACKAGES_ARCH="$PACKAGES_ARCH wget subversion" # Asterisk: for ./configure --with-pjproject-bundled: -PACKAGES_ARCH="$PACKAGES_ARCH bzip2 patch python2" +PACKAGES_ARCH="$PACKAGES_ARCH bzip2 patch" # Basic build system: PACKAGES_GENTOO="sys-devel/make sys-devel/gcc dev-util/pkgconfig" @@ -91,7 +91,7 @@ PACKAGES_GENTOO="$PACKAGES_GENTOO net-libs/c-client sys-devel/binutils net-libs/ # Asterisk: for the unpackaged below: PACKAGES_GENTOO="$PACKAGES_GENTOO net-misc/wget dev-vcs/subversion" # Asterisk: for ./configure --with-pjproject-bundled: -PACKAGES_GENTOO="$PACKAGES_GENTOO app-arch/bzip2 sys-devel/patch dev-lang/python:2.7" +PACKAGES_GENTOO="$PACKAGES_GENTOO app-arch/bzip2 sys-devel/patch" # Basic build system: PACKAGES_NBSD="gmake pkg-config" @@ -106,7 +106,7 @@ PACKAGES_NBSD="$PACKAGES_NBSD imap-uw srtp gsm doxygen graphviz libzip openldap- # Asterisk: for the unpackaged below: PACKAGES_NBSD="$PACKAGES_NBSD wget subversion-base" # Asterisk: for ./configure --with-pjproject-bundled: -PACKAGES_NBSD="$PACKAGES_NBSD bzip2 patch python27" +PACKAGES_NBSD="$PACKAGES_NBSD bzip2 patch" # Basic build system: PACKAGES_OBSD="gmake" @@ -121,7 +121,7 @@ PACKAGES_OBSD="$PACKAGES_OBSD c-client libsrtp gsm doxygen graphviz" # Asterisk: for the unpackaged below: PACKAGES_OBSD="$PACKAGES_OBSD wget subversion" # Asterisk: for ./configure --with-pjproject-bundled: -PACKAGES_OBSD="$PACKAGES_OBSD bzip2 python%2" +PACKAGES_OBSD="$PACKAGES_OBSD bzip2" # Basic build system: PACKAGES_FBSD="gmake pkgconf" @@ -136,7 +136,7 @@ PACKAGES_FBSD="$PACKAGES_FBSD cclient libbfd libsrtp gsm libilbc doxygen graphvi # Asterisk: for the unpackaged below: PACKAGES_FBSD="$PACKAGES_FBSD wget subversion" # Asterisk: for ./configure --with-pjproject-bundled: -PACKAGES_FBSD="$PACKAGES_FBSD bzip2 patch python" +PACKAGES_FBSD="$PACKAGES_FBSD bzip2 patch" # Basic build system: PACKAGES_DBSD="gmake pkgconf" @@ -151,7 +151,7 @@ PACKAGES_DBSD="$PACKAGES_DBSD cclient binutils libsrtp gsm libilbc doxygen graph # Asterisk: for the unpackaged below: PACKAGES_DBSD="$PACKAGES_DBSD wget subversion" # Asterisk: for ./configure --with-pjproject-bundled: -PACKAGES_DBSD="$PACKAGES_DBSD bzip2 patch python" +PACKAGES_DBSD="$PACKAGES_DBSD bzip2 patch" KVERS=`uname -r`