sngrep: fix error if gnutls and openssl are both enabled
[buildroot-gz.git] / package / jack2 / 0001-Improve-check-for-ucontext.patch
blobb8aa1da7218dd49149386788999c5096d2857aad
1 From ad79670d6d1e7ef2aad6935715921e5317cbe618 Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Mon, 23 May 2016 22:28:12 +0200
4 Subject: [PATCH] Improve check for ucontext
6 The ucontext functionality is not available on all CPUs with all C
7 libraries. Instead of making just assumptions based on the CPU
8 architecture, this commit adds the necessary checks in wscript to verify
9 the availability of the ucontext functionality, before using it in
10 dbus/sigsegv.c.
12 This avoids the long list of architecture exclusions, and make it more
13 robust when building jack2 for new CPU architectures.
15 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
16 ---
17 dbus/sigsegv.c | 12 ++++++------
18 wscript | 16 +++++++++++++++-
19 2 files changed, 21 insertions(+), 7 deletions(-)
21 diff --git a/dbus/sigsegv.c b/dbus/sigsegv.c
22 index df2c42c..00a62b5 100644
23 --- a/dbus/sigsegv.c
24 +++ b/dbus/sigsegv.c
25 @@ -106,20 +106,20 @@ static void signal_segv(int signum, siginfo_t* info, void*ptr) {
26 jack_error("info.si_errno = %d", info->si_errno);
27 jack_error("info.si_code = %d (%s)", info->si_code, si_code_str);
28 jack_error("info.si_addr = %p", info->si_addr);
29 -#if !defined(__alpha__) && !defined(__ia64__) && !defined(__FreeBSD_kernel__) && !defined(__arm__) && !defined(__hppa__) && !defined(__sh__) && !defined(__aarch64__)
30 +#if defined(HAVE_UCONTEXT) && defined(HAVE_NGREG)
31 for(i = 0; i < NGREG; i++)
32 jack_error("reg[%02d] = 0x" REGFORMAT, i,
33 -#if defined(__powerpc64__)
34 +#if defined(HAVE_UCONTEXT_GP_REGS)
35 ucontext->uc_mcontext.gp_regs[i]
36 -#elif defined(__powerpc__)
37 +#elif defined(HAVE_UCONTEXT_UC_REGS)
38 ucontext->uc_mcontext.uc_regs[i]
39 -#elif defined(__sparc__) && defined(__arch64__)
40 +#elif defined(HAVE_UCONTEXT_MC_GREGS)
41 ucontext->uc_mcontext.mc_gregs[i]
42 -#else
43 +#elif defined(HAVE_UCONTEXT_GREGS)
44 ucontext->uc_mcontext.gregs[i]
45 #endif
47 -#endif /* alpha, ia64, kFreeBSD, arm, hppa */
48 +#endif /* defined(HAVE_UCONTEXT) && defined(HAVE_NGREG) */
50 #if defined(SIGSEGV_STACK_X86) || defined(SIGSEGV_STACK_IA64)
51 # if defined(SIGSEGV_STACK_IA64)
52 diff --git a/wscript b/wscript
53 index 63ba3aa..34a56fc 100644
54 --- a/wscript
55 +++ b/wscript
56 @@ -168,10 +168,24 @@ def configure(conf):
58 conf.check_cc(header_name='execinfo.h', define_name="HAVE_EXECINFO_H", mandatory=False)
59 conf.check_cc(header_name='samplerate.h', define_name="HAVE_SAMPLERATE")
61 if conf.is_defined('HAVE_SAMPLERATE'):
62 conf.env['LIB_SAMPLERATE'] = ['samplerate']
64 + # test for the availability of ucontext, and how it should be used
65 + for t in ("gp_regs", "uc_regs", "mc_gregs", "gregs"):
66 + fragment = "#include <ucontext.h>\n"
67 + fragment += "int main() { ucontext_t *ucontext; return (int) ucontext->uc_mcontext.%s[0]; }" % t
68 + confvar = "HAVE_UCONTEXT_%s" % t.upper()
69 + conf.check_cc(fragment=fragment, define_name=confvar, mandatory=False,
70 + msg="Checking for ucontext->uc_mcontext.%s" % t)
71 + if conf.is_defined(confvar):
72 + conf.define('HAVE_UCONTEXT', 1)
74 + fragment = "#include <ucontext.h>\n"
75 + fragment += "int main() { return NGREG; }"
76 + conf.check_cc(fragment=fragment, define_name="HAVE_NGREG", mandatory=False,
77 + msg="Checking for NGREG")
79 conf.sub_config('example-clients')
81 if conf.check_cfg(package='celt', atleast_version='0.11.0', args='--cflags --libs', mandatory=False):
82 --
83 2.7.4