diff options
-rw-r--r-- | CMakeLists.txt | 28 | ||||
-rw-r--r-- | src/codegen.c | 8 | ||||
-rw-r--r-- | src/ffts.c | 3 | ||||
-rw-r--r-- | src/ffts_internal.h | 7 | ||||
-rw-r--r-- | src/ffts_small.c | 2 | ||||
-rw-r--r-- | src/patterns.c | 3 |
6 files changed, 47 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ef0a9d..383c01f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,33 @@ include(CheckIncludeFile) add_definitions(-DFFTS_CMAKE_GENERATED) +# check existence of various headers +check_include_file(stdint.h HAVE_STDINT_H) +check_include_file(stdlib.h HAVE_STDLIB_H) +check_include_file(string.h HAVE_STRING_H) +check_include_file(sys/mman.h HAVE_SYS_MMAN_H) +check_include_file(unistd.h HAVE_UNISTD_H) + +if(HAVE_STDINT_H) + add_definitions(-DHAVE_STDINT_H) +endif(HAVE_STDINT_H) + +if(HAVE_STDLIB_H) + add_definitions(-DHAVE_STDLIB_H) +endif(HAVE_STDLIB_H) + +if(HAVE_STRING_H) + add_definitions(-DHAVE_STRING_H) +endif(HAVE_STRING_H) + +if(HAVE_SYS_MMAN_H) + add_definitions(-DHAVE_SYS_MMAN_H) +endif(HAVE_SYS_MMAN_H) + +if(HAVE_UNISTD_H) + add_definitions(-DHAVE_UNISTD_H) +endif(HAVE_UNISTD_H) + # check if the platform has support for SSE SIMD extension check_include_file(xmmintrin.h HAVE_XMMINTRIN_H) if(HAVE_XMMINTRIN_H) @@ -43,6 +70,7 @@ else() # check if the platform has support NEON SIMD extension check_include_file(arm_neon.h HAVE_ARM_NEON_H) if(HAVE_ARM_NEON_H) + add_definitions(-DHAVE_NEON) endif(HAVE_ARM_NEON_H) endif(HAVE_XMMINTRIN_H) diff --git a/src/codegen.c b/src/codegen.c index 987d55f..7635875 100644 --- a/src/codegen.c +++ b/src/codegen.c @@ -54,10 +54,16 @@ typedef uint8_t insns_t; #include <errno.h> #include <stddef.h> /* #include <stdio.h> */ + +#ifdef HAVE_STDLIB_H #include <stdlib.h> +#endif + +#ifdef HAVE_STRING_H #include <string.h> +#endif -#ifdef __ANDROID__ +#ifdef HAVE_UNISTD_H #include <unistd.h> #endif @@ -32,6 +32,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "ffts.h" + #include "ffts_internal.h" #include "macros.h" #include "patterns.h" @@ -49,7 +50,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #if _WIN32 #include <windows.h> -#else +#elif HAVE_SYS_MMAN_H #include <sys/mman.h> #endif diff --git a/src/ffts_internal.h b/src/ffts_internal.h index a77fb0d..2007242 100644 --- a/src/ffts_internal.h +++ b/src/ffts_internal.h @@ -42,8 +42,15 @@ #include <malloc.h> #include <math.h> #include <stddef.h> + +#ifdef HAVE_STDINT_H #include <stdint.h> +#endif + +#ifdef HAVE_STDLIB_H #include <stdlib.h> +#endif + #include <stdio.h> #define FFTS_PREFIX ffts diff --git a/src/ffts_small.c b/src/ffts_small.c index 8fa373f..ccc3ab0 100644 --- a/src/ffts_small.c +++ b/src/ffts_small.c @@ -35,8 +35,6 @@ #include "ffts_internal.h" #include "macros.h" -#include <stdlib.h> - void ffts_firstpass_16_f(ffts_plan_t *p, const void *in, void *out) { const data_t *din = (const data_t*) in; diff --git a/src/patterns.c b/src/patterns.c index 91f4250..17133d1 100644 --- a/src/patterns.c +++ b/src/patterns.c @@ -37,7 +37,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <limits.h> #include <malloc.h> #include <math.h> + +#ifdef HAVE_STDLIB_H #include <stdlib.h> +#endif static void ffts_permute_addr(int N, int offset, int stride, int *d) { |