From: Wei Liu <wei.liu2@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
Anthony PERARD <anthony.perard@citrix.com>,
Wei Liu <wei.liu2@citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>
Subject: [PATCH for-next v2 v2 1/5] build/m4: make python_devel.m4 work with both python 2 and 3
Date: Wed, 6 Mar 2019 17:52:06 +0000 [thread overview]
Message-ID: <20190306175210.28145-2-wei.liu2@citrix.com> (raw)
In-Reply-To: <20190306175210.28145-1-wei.liu2@citrix.com>
Do the following:
1. Change the form of "print".
2. Use AC_CHECK_FUNC to avoid the need to generate library name.
3. Remove unused stuff.
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
I doubt the non-python-config branch works, because the paths generated
seem rather off. It definitely doesn't work on my machine, but I
don't know how other systems could possibly be configured before the
existence of python-config.
---
m4/python_devel.m4 | 23 +++++++-------------
tools/configure | 64 +++++++-----------------------------------------------
2 files changed, 16 insertions(+), 71 deletions(-)
diff --git a/m4/python_devel.m4 b/m4/python_devel.m4
index 05ea4ef7e2..f9cb23aee1 100644
--- a/m4/python_devel.m4
+++ b/m4/python_devel.m4
@@ -1,38 +1,31 @@
AC_DEFUN([AX_CHECK_PYTHON_DEVEL], [
ac_previous_cppflags=$CPPFLAGS
ac_previous_ldflags=$LDFLAGS
-ac_python_version=`$PYTHON -c 'import distutils.sysconfig; \
- print distutils.sysconfig.get_config_var("VERSION")'`
AC_PATH_PROG([pyconfig], [$PYTHON-config], [no])
AS_IF([test x"$pyconfig" = x"no"], [
dnl For those that don't have python-config
CPPFLAGS="$CFLAGS `$PYTHON -c 'import distutils.sysconfig; \
print "-I" + distutils.sysconfig.get_config_var("INCLUDEPY")'`"
CPPFLAGS="$CPPFLAGS `$PYTHON -c 'import distutils.sysconfig; \
- print distutils.sysconfig.get_config_var("CFLAGS")'`"
- PYTHON_LIBS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
- print distutils.sysconfig.get_config_var("LIBS")'`"
- PYTHON_LIBS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
- print distutils.sysconfig.get_config_var("SYSLIBS")'`"
+ print(distutils.sysconfig.get_config_var("CFLAGS"))'`"
LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
- print "-L" + distutils.sysconfig.get_python_lib(plat_specific=1,\
- standard_lib=1) + "/config"'`"
+ print("-L" + distutils.sysconfig.get_python_lib(plat_specific=1,\
+ standard_lib=1) + "/config")'`"
LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
- print distutils.sysconfig.get_config_var("LINKFORSHARED")'`"
+ print(distutils.sysconfig.get_config_var("LINKFORSHARED"))'`"
LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
- print distutils.sysconfig.get_config_var("LDFLAGS")'`"
+ print(distutils.sysconfig.get_config_var("LDFLAGS"))'`"
], [
dnl If python-config is found use it
CPPFLAGS="$CFLAGS `$PYTHON-config --cflags`"
LDFLAGS="$LDFLAGS `$PYTHON-config --ldflags`"
- PYTHON_LIBS="$LIBS `$PYTHON-config --libs`"
])
AC_CHECK_HEADER([Python.h], [],
[AC_MSG_ERROR([Unable to find Python development headers])],)
-AC_CHECK_LIB(python$ac_python_version, PyArg_ParseTuple, [],
- [AC_MSG_ERROR([Unable to find a suitable python development library])],
- [$PYTHON_LIBS])
+AC_CHECK_FUNC([PyArg_ParseTuple], [],
+ [AC_MSG_ERROR([Unable to find a suitable python development library])])
+
CPPFLAGS=$ac_previous_cppflags
LDFLAGS=$ac_previous_ldflags
])
diff --git a/tools/configure b/tools/configure
index acc857510e..632ccce445 100755
--- a/tools/configure
+++ b/tools/configure
@@ -7418,8 +7418,6 @@ if test "$cross_compiling" != yes; then :
ac_previous_cppflags=$CPPFLAGS
ac_previous_ldflags=$LDFLAGS
-ac_python_version=`$PYTHON -c 'import distutils.sysconfig; \
- print distutils.sysconfig.get_config_var("VERSION")'`
# Extract the first word of "$PYTHON-config", so it can be a program name with args.
set dummy $PYTHON-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -7466,24 +7464,19 @@ if test x"$pyconfig" = x"no"; then :
CPPFLAGS="$CFLAGS `$PYTHON -c 'import distutils.sysconfig; \
print "-I" + distutils.sysconfig.get_config_var("INCLUDEPY")'`"
CPPFLAGS="$CPPFLAGS `$PYTHON -c 'import distutils.sysconfig; \
- print distutils.sysconfig.get_config_var("CFLAGS")'`"
- PYTHON_LIBS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
- print distutils.sysconfig.get_config_var("LIBS")'`"
- PYTHON_LIBS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
- print distutils.sysconfig.get_config_var("SYSLIBS")'`"
+ print(distutils.sysconfig.get_config_var("CFLAGS"))'`"
LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
- print "-L" + distutils.sysconfig.get_python_lib(plat_specific=1,\
- standard_lib=1) + "/config"'`"
+ print("-L" + distutils.sysconfig.get_python_lib(plat_specific=1,\
+ standard_lib=1) + "/config")'`"
LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
- print distutils.sysconfig.get_config_var("LINKFORSHARED")'`"
+ print(distutils.sysconfig.get_config_var("LINKFORSHARED"))'`"
LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
- print distutils.sysconfig.get_config_var("LDFLAGS")'`"
+ print(distutils.sysconfig.get_config_var("LDFLAGS"))'`"
else
CPPFLAGS="$CFLAGS `$PYTHON-config --cflags`"
LDFLAGS="$LDFLAGS `$PYTHON-config --ldflags`"
- PYTHON_LIBS="$LIBS `$PYTHON-config --libs`"
fi
@@ -7495,55 +7488,14 @@ else
fi
-as_ac_Lib=`$as_echo "ac_cv_lib_python$ac_python_version''_PyArg_ParseTuple" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PyArg_ParseTuple in -lpython$ac_python_version" >&5
-$as_echo_n "checking for PyArg_ParseTuple in -lpython$ac_python_version... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpython$ac_python_version $PYTHON_LIBS $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char PyArg_ParseTuple ();
-int
-main ()
-{
-return PyArg_ParseTuple ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- eval "$as_ac_Lib=yes"
-else
- eval "$as_ac_Lib=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-eval ac_res=\$$as_ac_Lib
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_LIBpython$ac_python_version" | $as_tr_cpp` 1
-_ACEOF
-
- LIBS="-lpython$ac_python_version $LIBS"
+ac_fn_c_check_func "$LINENO" "PyArg_ParseTuple" "ac_cv_func_PyArg_ParseTuple"
+if test "x$ac_cv_func_PyArg_ParseTuple" = xyes; then :
else
as_fn_error $? "Unable to find a suitable python development library" "$LINENO" 5
fi
+
CPPFLAGS=$ac_previous_cppflags
LDFLAGS=$ac_previous_ldflags
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-03-06 17:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-06 17:52 [PATCH for-next v2 v2 0/5] tools: Python 3 compatibility Wei Liu
2019-03-06 17:52 ` Wei Liu [this message]
2019-03-07 11:14 ` [PATCH for-next v2 v2 1/5] build/m4: make python_devel.m4 work with both python 2 and 3 Anthony PERARD
2019-03-06 17:52 ` [PATCH for-next v2 v2 2/5] libxl: make python scripts work with python 2.6 and up Wei Liu
2019-03-06 18:20 ` Andrew Cooper
2019-03-06 20:58 ` Hans van Kranenburg
2019-03-07 10:37 ` Wei Liu
2019-03-07 11:30 ` Wei Liu
2019-03-06 17:52 ` [PATCH for-next v2 v2 3/5] pygrub: convert python scripts to work with " Wei Liu
2019-03-06 18:23 ` Andrew Cooper
2019-03-06 17:52 ` [PATCH for-next v2 v2 4/5] pygrub: make it build with python 3 Wei Liu
2019-03-06 18:46 ` Andrew Cooper
2019-03-06 17:52 ` [PATCH for-next v2 v2 5/5] Update python requirement Wei Liu
2019-03-07 11:21 ` Anthony PERARD
2019-03-07 11:24 ` Wei Liu
2019-03-06 18:17 ` [PATCH for-next v2 v2 0/5] tools: Python 3 compatibility Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190306175210.28145-2-wei.liu2@citrix.com \
--to=wei.liu2@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@citrix.com \
--cc=george.dunlap@eu.citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.