Skip to content

Commit 63c56d3

Browse files
committed
Only include complex.h since Android 5.0
1 parent 70642fe commit 63c56d3

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

common.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ extern "C" {
9898

9999
#ifdef OS_ANDROID
100100
#define NO_SYSV_IPC
101+
//Android NDK only supports complex.h since Android 5.0
102+
#if __ANDROID_API__ < 21
103+
#define FORCE_OPENBLAS_COMPLEX_STRUCT
104+
#endif
101105
#endif
102106

103107
#ifdef OS_WINDOWS
@@ -501,12 +505,12 @@ static void __inline blas_lock(volatile BLASULONG *address){
501505
/* C99 supports complex floating numbers natively, which GCC also offers as an
502506
extension since version 3.0. If neither are available, use a compatible
503507
structure as fallback (see Clause 6.2.5.13 of the C99 standard). */
504-
#if (defined(__STDC_IEC_559_COMPLEX__) || __STDC_VERSION__ >= 199901L || \
505-
(__GNUC__ >= 3 && !defined(__cplusplus)) )
508+
#if ((defined(__STDC_IEC_559_COMPLEX__) || __STDC_VERSION__ >= 199901L || \
509+
(__GNUC__ >= 3 && !defined(__cplusplus))) && !(defined(FORCE_OPENBLAS_COMPLEX_STRUCT)))
506510
#define OPENBLAS_COMPLEX_C99
507-
#ifndef __cplusplus
508-
#include <complex.h>
509-
#endif
511+
#ifndef __cplusplus
512+
#include <complex.h>
513+
#endif
510514
typedef float _Complex openblas_complex_float;
511515
typedef double _Complex openblas_complex_double;
512516
typedef xdouble _Complex openblas_complex_xdouble;

0 commit comments

Comments
 (0)