Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: 傅继晗 <fjhhz1997@gmail.com>
To: gdb-patches <gdb-patches@sourceware.org>
Cc: Christian Biesinger <cbiesinger@google.com>
Subject: Re: [PATCH] Modify python-config.py or replace it with official one to support python3
Date: Wed, 22 Jan 2020 06:12:00 -0000	[thread overview]
Message-ID: <CAPwS6qO1Ty-GhaCA79YQn4qi41+M1XFVTttA9PJwjG=bepvFdQ@mail.gmail.com> (raw)
In-Reply-To: <CAPwS6qO0bebT3oz-haEEdQ=z8sNheEysbaberg-3xktcGofbvA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2042 bytes --]

add warning to explain that if no python-config found,fall back to
internal copy "gdb/python/python-config.py"


--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -834,29 +834,36 @@ else
     esac
   esac

+  python_config=
   if test "${python_prog}" != missing; then
+    AC_CHECK_FILE([${python_prog}-config],[python_config="${python_prog}-config"],[python_config="${python_prog}
${srcdir}/python/python-config.py"
+AC_MSG_WARN(python-config not found! Fall back to internal copy.)])
     # We have a python program to use, but it may be too old.
     # Don't flag an error for --with-python=auto (the default).
     have_python_config=yes
-    python_includes=`${python_prog} ${srcdir}/python/python-config.py
--includes`
+    python_includes=`${python_config} --includes`
     if test $? != 0; then
       have_python_config=failed
       if test "${with_python}" != auto; then
-        AC_ERROR(failure running python-config --includes)
+        AC_ERROR(failure running ${python_config} --includes)
       fi
     fi
-    python_libs=`${python_prog} ${srcdir}/python/python-config.py --ldflags`
+# For python 3.8+ there must be a "--embed" flag to show lib version.
+    python_libs=`${python_config} --ldflags --embed`
     if test $? != 0; then
-      have_python_config=failed
-      if test "${with_python}" != auto; then
-        AC_ERROR(failure running python-config --ldflags)
+      python_libs=`${python_config} --ldflags`
+      if test $? != 0; then
+        have_python_config=failed
+        if test "${with_python}" != auto; then
+          AC_ERROR(failure running ${python_config} --ldflags)
+        fi
       fi
     fi
-    python_prefix=`${python_prog} ${srcdir}/python/python-config.py
--exec-prefix`
+    python_prefix=`${python_config} --exec-prefix`
     if test $? != 0; then
       have_python_config=failed
       if test "${with_python}" != auto; then
-        AC_ERROR(failure running python-config --exec-prefix)
+        AC_ERROR(failure running ${python_config} --exec-prefix)
       fi
     fi
   else

[-- Attachment #2: python-config.patch --]
[-- Type: application/octet-stream, Size: 1930 bytes --]

--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -834,29 +834,36 @@ else
     esac
   esac
 
+  python_config=
   if test "${python_prog}" != missing; then
+    AC_CHECK_FILE([${python_prog}-config],[python_config="${python_prog}-config"],[python_config="${python_prog} ${srcdir}/python/python-config.py"
+AC_MSG_WARN(python-config not found! Fall back to internal copy.)])
     # We have a python program to use, but it may be too old.
     # Don't flag an error for --with-python=auto (the default).
     have_python_config=yes
-    python_includes=`${python_prog} ${srcdir}/python/python-config.py --includes`
+    python_includes=`${python_config} --includes`
     if test $? != 0; then
       have_python_config=failed
       if test "${with_python}" != auto; then
-        AC_ERROR(failure running python-config --includes)
+        AC_ERROR(failure running ${python_config} --includes)
       fi
     fi
-    python_libs=`${python_prog} ${srcdir}/python/python-config.py --ldflags`
+# For python 3.8+ there must be a "--embed" flag to show lib version.
+    python_libs=`${python_config} --ldflags --embed`
     if test $? != 0; then
-      have_python_config=failed
-      if test "${with_python}" != auto; then
-        AC_ERROR(failure running python-config --ldflags)
+      python_libs=`${python_config} --ldflags`
+      if test $? != 0; then
+        have_python_config=failed
+        if test "${with_python}" != auto; then
+          AC_ERROR(failure running ${python_config} --ldflags)
+        fi
       fi
     fi
-    python_prefix=`${python_prog} ${srcdir}/python/python-config.py --exec-prefix`
+    python_prefix=`${python_config} --exec-prefix`
     if test $? != 0; then
       have_python_config=failed
       if test "${with_python}" != auto; then
-        AC_ERROR(failure running python-config --exec-prefix)
+        AC_ERROR(failure running ${python_config} --exec-prefix)
       fi
     fi
   else

      reply	other threads:[~2020-01-22  5:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-20 14:05 傅继晗
2020-01-20 15:05 ` 傅继晗
2020-01-21  1:31   ` Christian Biesinger via gdb-patches
     [not found]     ` <CAPwS6qOtjH-g88iy7DmUoMyUO1F7O+vZQWoWNZfzZoVkSJ=qtQ@mail.gmail.com>
2020-01-22  2:04       ` 傅继晗
2020-01-22  2:16         ` 傅继晗
2020-01-22  6:12           ` 傅继晗 [this message]

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='CAPwS6qO1Ty-GhaCA79YQn4qi41+M1XFVTttA9PJwjG=bepvFdQ@mail.gmail.com' \
    --to=fjhhz1997@gmail.com \
    --cc=cbiesinger@google.com \
    --cc=gdb-patches@sourceware.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox