[Xen-devel] [XEN PATCH for-4.13] configure: Fix test for python 3.8

Anthony PERARD posted 1 patch 4 years, 5 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/xen tags/patchew/20191115161532.1231811-1-anthony.perard@citrix.com
configure          | 14 +-------------
docs/configure     | 14 +-------------
m4/python_devel.m4 | 11 +++++++++--
stubdom/configure  | 14 +-------------
tools/configure    | 33 +++++++++++++--------------------
5 files changed, 25 insertions(+), 61 deletions(-)
[Xen-devel] [XEN PATCH for-4.13] configure: Fix test for python 3.8
Posted by Anthony PERARD 4 years, 5 months ago
https://docs.python.org/3.8/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build

> To embed Python into an application, a new --embed option must be
> passed to python3-config --libs --embed to get -lpython3.8 (link the
> application to libpython). To support both 3.8 and older, try
> python3-config --libs --embed first and fallback to python3-config
> --libs (without --embed) if the previous command fails.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---

Notes:
    You may want to rerun ./autogen.sh on commit.

 configure          | 14 +-------------
 docs/configure     | 14 +-------------
 m4/python_devel.m4 | 11 +++++++++--
 stubdom/configure  | 14 +-------------
 tools/configure    | 33 +++++++++++++--------------------
 5 files changed, 25 insertions(+), 61 deletions(-)

diff --git a/configure b/configure
index 4d258eb61534..6ddcf52d9c1b 100755
--- a/configure
+++ b/configure
@@ -644,7 +644,6 @@ infodir
 docdir
 oldincludedir
 includedir
-runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -723,7 +722,6 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
-runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -976,15 +974,6 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
-  -runstatedir | --runstatedir | --runstatedi | --runstated \
-  | --runstate | --runstat | --runsta | --runst | --runs \
-  | --run | --ru | --r)
-    ac_prev=runstatedir ;;
-  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
-  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
-  | --run=* | --ru=* | --r=*)
-    runstatedir=$ac_optarg ;;
-
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1122,7 +1111,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir runstatedir
+		libdir localedir mandir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1275,7 +1264,6 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
-  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
diff --git a/docs/configure b/docs/configure
index e81644752f43..ca5e28264634 100755
--- a/docs/configure
+++ b/docs/configure
@@ -634,7 +634,6 @@ infodir
 docdir
 oldincludedir
 includedir
-runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -711,7 +710,6 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
-runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -964,15 +962,6 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
-  -runstatedir | --runstatedir | --runstatedi | --runstated \
-  | --runstate | --runstat | --runsta | --runst | --runs \
-  | --run | --ru | --r)
-    ac_prev=runstatedir ;;
-  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
-  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
-  | --run=* | --ru=* | --r=*)
-    runstatedir=$ac_optarg ;;
-
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1110,7 +1099,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir runstatedir
+		libdir localedir mandir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1263,7 +1252,6 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
-  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
diff --git a/m4/python_devel.m4 b/m4/python_devel.m4
index e365cd658e0e..bbf1e0354b2b 100644
--- a/m4/python_devel.m4
+++ b/m4/python_devel.m4
@@ -23,8 +23,15 @@ AS_IF([test x"$pyconfig" = x"no"], [
 ], [
     dnl If python-config is found use it
     CPPFLAGS="$CFLAGS `$PYTHON-config --cflags`"
-    LDFLAGS="$LDFLAGS `$PYTHON-config --ldflags`"
-    LIBS="$LIBS `$PYTHON-config --libs`"
+    dnl We need to use --embed with python 3.8 but not with earlier version so
+    dnl check if it is recognized.
+    python_devel_embed=""
+    if $PYTHON-config --embed >/dev/null 2>/dev/null; then
+      python_devel_embed="--embed"
+    fi
+    LDFLAGS="$LDFLAGS `$PYTHON-config --ldflags $python_devel_embed`"
+    LIBS="$LIBS `$PYTHON-config --libs $python_devel_embed`"
+    unset python_devel_embed
 ])
 
 AC_CHECK_HEADER([Python.h], [],
diff --git a/stubdom/configure b/stubdom/configure
index beeb8db2e1fc..95ed9810efc9 100755
--- a/stubdom/configure
+++ b/stubdom/configure
@@ -661,7 +661,6 @@ infodir
 docdir
 oldincludedir
 includedir
-runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -751,7 +750,6 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
-runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1004,15 +1002,6 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
-  -runstatedir | --runstatedir | --runstatedi | --runstated \
-  | --runstate | --runstat | --runsta | --runst | --runs \
-  | --run | --ru | --r)
-    ac_prev=runstatedir ;;
-  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
-  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
-  | --run=* | --ru=* | --r=*)
-    runstatedir=$ac_optarg ;;
-
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1150,7 +1139,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir runstatedir
+		libdir localedir mandir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1303,7 +1292,6 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
-  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
diff --git a/tools/configure b/tools/configure
index 82947ad30834..c43c8c21be12 100755
--- a/tools/configure
+++ b/tools/configure
@@ -770,7 +770,6 @@ infodir
 docdir
 oldincludedir
 includedir
-runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -896,7 +895,6 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
-runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1149,15 +1147,6 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
-  -runstatedir | --runstatedir | --runstatedi | --runstated \
-  | --runstate | --runstat | --runsta | --runst | --runs \
-  | --run | --ru | --r)
-    ac_prev=runstatedir ;;
-  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
-  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
-  | --run=* | --ru=* | --r=*)
-    runstatedir=$ac_optarg ;;
-
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1295,7 +1284,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir runstatedir
+		libdir localedir mandir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1448,7 +1437,6 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
-  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -3378,7 +3366,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -3424,7 +3412,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -3448,7 +3436,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -3493,7 +3481,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -3517,7 +3505,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
 		       && LARGE_OFF_T % 2147483647 == 1)
 		      ? 1 : -1];
@@ -7460,8 +7448,13 @@ if test x"$pyconfig" = x"no"; then :
 else
 
         CPPFLAGS="$CFLAGS `$PYTHON-config --cflags`"
-    LDFLAGS="$LDFLAGS `$PYTHON-config --ldflags`"
-    LIBS="$LIBS `$PYTHON-config --libs`"
+            python_devel_embed=""
+    if $PYTHON-config --embed >/dev/null 2>/dev/null; then
+      python_devel_embed="--embed"
+    fi
+    LDFLAGS="$LDFLAGS `$PYTHON-config --ldflags $python_devel_embed`"
+    LIBS="$LIBS `$PYTHON-config --libs $python_devel_embed`"
+    unset python_devel_embed
 
 fi
 
-- 
Anthony PERARD


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH for-4.13] configure: Fix test for python 3.8
Posted by Wei Liu 4 years, 5 months ago
On Fri, Nov 15, 2019 at 04:15:32PM +0000, Anthony PERARD wrote:
> https://docs.python.org/3.8/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build
> 
> > To embed Python into an application, a new --embed option must be
> > passed to python3-config --libs --embed to get -lpython3.8 (link the
> > application to libpython). To support both 3.8 and older, try
> > python3-config --libs --embed first and fallback to python3-config
> > --libs (without --embed) if the previous command fails.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> ---
> 
> Notes:
>     You may want to rerun ./autogen.sh on commit.

Indeed. This patch introduces a lot of unrelated changes, presumably due
to the difference in autoconf.

> diff --git a/m4/python_devel.m4 b/m4/python_devel.m4
> index e365cd658e0e..bbf1e0354b2b 100644
> --- a/m4/python_devel.m4
> +++ b/m4/python_devel.m4
> @@ -23,8 +23,15 @@ AS_IF([test x"$pyconfig" = x"no"], [
>  ], [
>      dnl If python-config is found use it
>      CPPFLAGS="$CFLAGS `$PYTHON-config --cflags`"
> -    LDFLAGS="$LDFLAGS `$PYTHON-config --ldflags`"
> -    LIBS="$LIBS `$PYTHON-config --libs`"
> +    dnl We need to use --embed with python 3.8 but not with earlier version so
> +    dnl check if it is recognized.
> +    python_devel_embed=""
> +    if $PYTHON-config --embed >/dev/null 2>/dev/null; then
> +      python_devel_embed="--embed"
> +    fi
> +    LDFLAGS="$LDFLAGS `$PYTHON-config --ldflags $python_devel_embed`"
> +    LIBS="$LIBS `$PYTHON-config --libs $python_devel_embed`"
> +    unset python_devel_embed
>  ])

Acked-by: Wei Liu <wl@xen.org>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH for-4.13] configure: Fix test for python 3.8
Posted by Wei Liu 4 years, 5 months ago
On Fri, Nov 15, 2019 at 04:22:15PM +0000, Wei Liu wrote:
> On Fri, Nov 15, 2019 at 04:15:32PM +0000, Anthony PERARD wrote:
> > https://docs.python.org/3.8/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build
> > 
> > > To embed Python into an application, a new --embed option must be
> > > passed to python3-config --libs --embed to get -lpython3.8 (link the
> > > application to libpython). To support both 3.8 and older, try
> > > python3-config --libs --embed first and fallback to python3-config
> > > --libs (without --embed) if the previous command fails.
> > 
> > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> > ---
> > 
> > Notes:
> >     You may want to rerun ./autogen.sh on commit.
> 
> Indeed. This patch introduces a lot of unrelated changes, presumably due
> to the difference in autoconf.
> 
> > diff --git a/m4/python_devel.m4 b/m4/python_devel.m4
> > index e365cd658e0e..bbf1e0354b2b 100644
> > --- a/m4/python_devel.m4
> > +++ b/m4/python_devel.m4
> > @@ -23,8 +23,15 @@ AS_IF([test x"$pyconfig" = x"no"], [
> >  ], [
> >      dnl If python-config is found use it
> >      CPPFLAGS="$CFLAGS `$PYTHON-config --cflags`"
> > -    LDFLAGS="$LDFLAGS `$PYTHON-config --ldflags`"
> > -    LIBS="$LIBS `$PYTHON-config --libs`"
> > +    dnl We need to use --embed with python 3.8 but not with earlier version so
> > +    dnl check if it is recognized.
> > +    python_devel_embed=""
> > +    if $PYTHON-config --embed >/dev/null 2>/dev/null; then
> > +      python_devel_embed="--embed"
> > +    fi
> > +    LDFLAGS="$LDFLAGS `$PYTHON-config --ldflags $python_devel_embed`"
> > +    LIBS="$LIBS `$PYTHON-config --libs $python_devel_embed`"
> > +    unset python_devel_embed
> >  ])
> 
> Acked-by: Wei Liu <wl@xen.org>

Juergen, since we're going to announce Xen to be python 3 compatible for
this release, it would be good to get this patch in.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH for-4.13] configure: Fix test for python 3.8
Posted by Jürgen Groß 4 years, 5 months ago
On 15.11.19 17:15, Anthony PERARD wrote:
> https://docs.python.org/3.8/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build
> 
>> To embed Python into an application, a new --embed option must be
>> passed to python3-config --libs --embed to get -lpython3.8 (link the
>> application to libpython). To support both 3.8 and older, try
>> python3-config --libs --embed first and fallback to python3-config
>> --libs (without --embed) if the previous command fails.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Release-acked-by: Juergen Gross <jgross@suse.com>


Juergen

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [XEN PATCH for-4.13] configure: Fix test for python 3.8
Posted by Wei Liu 4 years, 5 months ago
On Wed, Nov 20, 2019 at 11:41:24AM +0100, Jürgen Groß wrote:
> On 15.11.19 17:15, Anthony PERARD wrote:
> > https://docs.python.org/3.8/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build
> > 
> > > To embed Python into an application, a new --embed option must be
> > > passed to python3-config --libs --embed to get -lpython3.8 (link the
> > > application to libpython). To support both 3.8 and older, try
> > > python3-config --libs --embed first and fallback to python3-config
> > > --libs (without --embed) if the previous command fails.
> > 
> > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> 
> Release-acked-by: Juergen Gross <jgross@suse.com>
> 

Thanks.

Unfortunately I forgot to add in this tag when I pushed the patch...

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel