fix clang cmake build left broken for arches other than aarch64 by #2f0de58717 (...
[termux-packages] / packages / fftw / cross-compilation.patch
1 From https://github.com/FFTW/fftw3/issues/73
2
3 diff --git a/configure.ac b/configure.ac
4 index 83a295f..51d290a 100644
5 --- a/configure.ac
6 +++ b/configure.ac
7 @@ -212,11 +212,21 @@ if test "$have_neon" = "yes"; then
8 fi
9 AM_CONDITIONAL(HAVE_NEON, test "$have_neon" = "yes")
10
11 -AC_ARG_ENABLE(armv8cyclecounter, [AC_HELP_STRING([--enable-armv8cyclecounter],[enable the cycle counter on ARMv8 ; require enabling in kernel mode, see <https://github.com/rdolbeau/enable_arm_pmu>])], have_armv8cyclecounter=$enableval)
12 +AC_ARG_ENABLE(armv8cyclecounter, [AC_HELP_STRING([--enable-armv8cyclecounter],[enable the cycle counter on ARMv8 via the PMCCNTR_EL0 register. Requires enabling in kernel mode, see <https://github.com/rdolbeau/enable_arm_pmu>])], have_armv8cyclecounter=$enableval)
13 if test "$have_armv8cyclecounter"x = "yes"x; then
14 AC_DEFINE(HAVE_ARMV8CC,1,[Define if you have enabled the cycle counter on ARMv8])
15 fi
16
17 +AC_ARG_ENABLE(armv8-cntvct-el0, [AC_HELP_STRING([--enable-armv8-cntvct-el0],[enable the cycle counter on ARMv8 via the CNTVCT_EL0 register])], have_armv8cntvctel0=$enableval)
18 +if test "$have_armv8cntvctel0"x = "yes"x; then
19 + AC_DEFINE(HAVE_ARMV8_CNTVCT_EL0,1,[Define if you have enabled the CNTVCT_EL0 cycle counter on ARMv8])
20 +fi
21 +
22 +AC_ARG_ENABLE(armv7a-cntvct, [AC_HELP_STRING([--enable-armv7a-cntvct],[enable the cycle counter on Armv7a via the CNTVCT register])], have_armv7acntvct=$enableval)
23 +if test "$have_armv7acntvct"x = "yes"x; then
24 + AC_DEFINE(HAVE_ARMV7A_CNTVCT,1,[Define if you have enabled the CNTVCT cycle counter on ARMv7a])
25 +fi
26 +
27 AC_ARG_ENABLE(generic-simd128, [AC_HELP_STRING([--enable-generic-simd128],[enable generic (gcc) 128-bit SIMD optimizations])], have_generic_simd128=$enableval, have_generic_simd128=no)
28 if test "$have_generic_simd128" = "yes"; then
29 AC_DEFINE(HAVE_GENERIC_SIMD128,1,[Define to enable generic (gcc) 128-bit SIMD optimizations.])
30 @@ -719,36 +729,6 @@ AM_CONDITIONAL(OPENMP, test "$enable_openmp" = "yes")
31 AM_CONDITIONAL(SMP, test "$enable_threads" = "yes" -o "$enable_openmp" = "yes")
32 AM_CONDITIONAL(COMBINED_THREADS, test x"$with_combined_threads" = xyes)
33
34 -
35 -dnl -----------------------------------------------------------------------
36 -dnl Check for not-always-available (not quite) cycle counters
37 -case "${host_cpu}" in
38 - armv7*)
39 - AC_MSG_CHECKING([armv7a has 64 bits readable CNTVCT])
40 - AC_RUN_IFELSE(
41 - [AC_LANG_PROGRAM([[#include <stdint.h>]],
42 - [[uint32_t Rt, Rt2 = 0;asm volatile("mrrc p15, 1, %0, %1, c14" : "=r"(Rt), "=r"(Rt2));]]
43 - )],
44 - [AC_DEFINE(ARMV7A_HAS_CNTCVT,1,[Define if CNTVCT is 64 bits readable on armv7a ])
45 - AC_MSG_RESULT([yes])],
46 - [AC_MSG_RESULT([no])]
47 - )
48 - ;;
49 - aarch64)
50 - AC_MSG_CHECKING([armv8 has 64 bits readable CNTVCT_EL0])
51 - AC_RUN_IFELSE(
52 - [AC_LANG_PROGRAM([[#include <stdint.h>]],
53 - [[uint64_t Rt;asm volatile("mrs %0, CNTVCT_EL0" : "=r" (Rt));]]
54 - )],
55 - [AC_DEFINE(ARMV8_HAS_CNTCVT_EL0,1,[Define if CNTVCT_EL0 is 64 bits readable on armv8 ])
56 - AC_MSG_RESULT([yes])],
57 - [AC_MSG_RESULT([no])]
58 - )
59 - ;;
60 - *)
61 - ;;
62 -esac
63 -
64 dnl -----------------------------------------------------------------------
65
66 AC_MSG_CHECKING([whether a cycle counter is available])
67 diff --git a/kernel/cycle.h b/kernel/cycle.h
68 index 873e92e..781792c 100644
69 --- a/kernel/cycle.h
70 +++ b/kernel/cycle.h
71 @@ -515,7 +515,7 @@ INLINE_ELAPSED(inline)
72 #endif
73 #endif /* HAVE_MIPS_ZBUS_TIMER */
74
75 -#if defined(__ARM_ARCH_7A__) && defined(ARMV7A_HAS_CNTCVT)
76 +#if defined(__ARM_ARCH_7A__) && defined(ARMV7A_HAS_CNTVCT)
77 typedef uint64_t ticks;
78 static inline ticks getticks(void)
79 {
80 @@ -527,7 +527,7 @@ INLINE_ELAPSED(inline)
81 #define HAVE_TICK_COUNTER
82 #endif
83
84 -#if defined(__aarch64__) && defined(ARMV8_HAS_CNTCVT_EL0) && !defined(HAVE_ARMV8CC)
85 +#if defined(__aarch64__) && defined(HAVE_ARMV8_CNTVCT_EL0) && !defined(HAVE_ARMV8CC)
86 typedef uint64_t ticks;
87 static inline ticks getticks(void)
88 {