summaryrefslogtreecommitdiff
path: root/debian/patches/python-config.patch
blob: baf49545976cd797669bc2217cb9f165cf53690a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
From: Matthias Klose <doko@ubuntu.com>
Date: Wed, 20 Feb 2019 13:25:36 +0100
Subject: Use system python-config if available

Forwarded: https://sourceware.org/ml/gdb-patches/2012-12/msg00751.html
---
 gdb/configure    | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++----
 gdb/configure.ac |  14 ++++----
 2 files changed, 108 insertions(+), 12 deletions(-)

Index: gdb/gdb/configure
===================================================================
--- gdb.orig/gdb/configure	2019-02-22 11:22:07.547598653 +0100
+++ gdb/gdb/configure	2019-02-22 11:22:07.543598605 +0100
@@ -715,6 +715,7 @@
 PYTHON_LIBS
 PYTHON_CPPFLAGS
 PYTHON_CFLAGS
+python_config
 python_prog_path
 LTLIBMPFR
 LIBMPFR
@@ -10478,29 +10479,122 @@
     esac
   esac
 
+  python_config=
   if test "${python_prog}" != missing; then
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}${python_prog}-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}${python_prog}-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_python_config+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$python_config"; then
+  ac_cv_prog_python_config="$python_config" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_python_config="${ac_tool_prefix}${python_prog}-config"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+python_config=$ac_cv_prog_python_config
+if test -n "$python_config"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $python_config" >&5
+$as_echo "$python_config" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_python_config"; then
+  ac_ct_python_config=$python_config
+  # Extract the first word of "${python_prog}-config", so it can be a program name with args.
+set dummy ${python_prog}-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_python_config+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_python_config"; then
+  ac_cv_prog_ac_ct_python_config="$ac_ct_python_config" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_python_config="${python_prog}-config"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_python_config=$ac_cv_prog_ac_ct_python_config
+if test -n "$ac_ct_python_config"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_python_config" >&5
+$as_echo "$ac_ct_python_config" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_python_config" = x; then
+    python_config="${python_prog} ${srcdir}/python/python-config.py"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    python_config=$ac_ct_python_config
+  fi
+else
+  python_config="$ac_cv_prog_python_config"
+fi
+
     # 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
-        as_fn_error $? "failure running python-config --includes" "$LINENO" 5
+        as_fn_error $? "failure running ${python-config} --includes" "$LINENO" 5
       fi
     fi
-    python_libs=`${python_prog} ${srcdir}/python/python-config.py --ldflags`
+    python_libs=`${python_config} --ldflags`
     if test $? != 0; then
       have_python_config=failed
       if test "${with_python}" != auto; then
-        as_fn_error $? "failure running python-config --ldflags" "$LINENO" 5
+        as_fn_error $? "failure running ${python-config} --ldflags" "$LINENO" 5
       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
-        as_fn_error $? "failure running python-config --exec-prefix" "$LINENO" 5
+        as_fn_error $? "failure running ${python-config} --exec-prefix" "$LINENO" 5
       fi
     fi
   else
Index: gdb/gdb/configure.ac
===================================================================
--- gdb.orig/gdb/configure.ac	2019-02-22 11:22:07.547598653 +0100
+++ gdb/gdb/configure.ac	2019-02-22 11:22:07.547598653 +0100
@@ -834,29 +834,31 @@
     esac
   esac
 
+  python_config=
   if test "${python_prog}" != missing; then
+    AC_CHECK_TOOL(python_config,[${python_prog}-config],[${python_prog} ${srcdir}/python/python-config.py])
     # 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`
+    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)
+        AC_ERROR(failure running ${python_config} --ldflags)
       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