summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/python3-sipsimple/pjsip-0001-NEON.patch
blob: 69b87f101a0f77d7f4a03dc90d0a89323854d6aa (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
From c18466834e4f845dfc9383c6944a72f31a78fafc Mon Sep 17 00:00:00 2001
From: Andrey <loukhnov@lotes-tm.ru>
Date: Thu, 14 Nov 2024 05:51:54 +0300
Subject: [PATCH 1/3] Correct cpu features detection during cross-compiation
 (#4151)

---
 aconfigure    | 48 +++++++++++++++++++++++++++++++++++++++++++++---
 aconfigure.ac | 35 ++++++++++++++++++++++++++++++++---
 2 files changed, 77 insertions(+), 6 deletions(-)

diff --git a/aconfigure b/aconfigure
index 57716969d..eac120472 100755
--- a/aconfigure
+++ b/aconfigure
@@ -8997,6 +8997,36 @@ $as_echo "Checking if libyuv is disabled...no" >&6; }
 fi
 
 
+SAVED_CFLAGS="$CFLAGS"
+case $target_cpu in
+	arm*)
+        CFLAGS="-mfpu=neon $CFLAGS"
+	;;
+	aarch64*)
+        CFLAGS="-march=armv8-a+simd $CFLAGS"
+	;;
+esac
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main (void)
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+  ax_cv_support_neon_ext=yes
+else $as_nop
+  ax_cv_support_neon_ext=no
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+CFLAGS="$SAVED_CFLAGS"
+
 
 
 
@@ -9064,9 +9094,21 @@ $as_echo "Checking if libwebrtc is disabled...no" >&6; }
 			;;
 		     *win32* | *w32* | *darwin* | *linux*)
                          case $target in
-                             armv7l*gnueabihf)
-                                 ac_webrtc_instset=neon
-                                 ac_webrtc_cflags="-DWEBRTC_ARCH_ARMV7 -mfloat-abi=hard -mfpu=neon"
+                             arm*gnueabihf)
+                                 if test "x$ax_cv_support_neon_ext" = "xyes"; then
+                                     ac_webrtc_instset=neon
+                                     ac_webrtc_cflags="-DWEBRTC_ARCH_ARMV7 -mfloat-abi=hard -mfpu=neon"
+                                 else
+                                     ac_webrtc_instset=generic
+                                 fi
+                                 ;;
+                             aarch64*)
+                                 if test "x$ax_cv_support_neon_ext" = "xyes"; then
+                                     ac_webrtc_instset=neon
+                                     ac_webrtc_cflags="-DWEBRTC_ARCH_ARM64"
+                                 else
+                                     ac_webrtc_instset=generic
+                                 fi
                                  ;;
                              arm-apple-darwin*)
                                  ac_webrtc_instset=neon
diff --git a/aconfigure.ac b/aconfigure.ac
index 48ff9f18e..fc472c7de 100644
--- a/aconfigure.ac
+++ b/aconfigure.ac
@@ -2057,6 +2057,23 @@ AC_ARG_ENABLE(libyuv,
 	      AC_MSG_RESULT([Checking if libyuv is disabled...no]))
 
 
+dnl proper neon detector
+SAVED_CFLAGS="$CFLAGS"
+case $target_cpu in
+	arm*)
+        CFLAGS="-mfpu=neon $CFLAGS"
+	;;
+	aarch64*)
+        CFLAGS="-march=armv8-a+simd $CFLAGS"
+	;;
+esac
+AC_COMPILE_IFELSE(
+    [AC_LANG_PROGRAM()],
+    [ax_cv_support_neon_ext=yes],
+    [ax_cv_support_neon_ext=no]
+)
+CFLAGS="$SAVED_CFLAGS"
+
 dnl # Include webrtc
 AC_SUBST(ac_no_webrtc)
 AC_SUBST(ac_webrtc_instset)
@@ -2121,9 +2138,21 @@ AC_ARG_ENABLE(libwebrtc,
 			;;
 		     *win32* | *w32* | *darwin* | *linux*)
                          case $target in
-                             armv7l*gnueabihf)
-                                 ac_webrtc_instset=neon
-                                 ac_webrtc_cflags="-DWEBRTC_ARCH_ARMV7 -mfloat-abi=hard -mfpu=neon"
+                             arm*gnueabihf)
+                                 if test "x$ax_cv_support_neon_ext" = "xyes"; then
+                                     ac_webrtc_instset=neon
+                                     ac_webrtc_cflags="-DWEBRTC_ARCH_ARMV7 -mfloat-abi=hard -mfpu=neon"
+                                 else
+                                     ac_webrtc_instset=generic
+                                 fi
+                                 ;;
+                             aarch64*)
+                                 if test "x$ax_cv_support_neon_ext" = "xyes"; then
+                                     ac_webrtc_instset=neon
+                                     ac_webrtc_cflags="-DWEBRTC_ARCH_ARM64"
+                                 else
+                                     ac_webrtc_instset=generic
+                                 fi
                                  ;;
                              *)
                                  ac_webrtc_instset=sse2
-- 
2.50.1