cmake: remove _FUNC and _SYM variable suffix

This commit is contained in:
Hugues Delorme 2017-04-13 17:53:32 +02:00
parent 94dd70b86c
commit 8e4c556ba6
7 changed files with 58 additions and 58 deletions

View File

@ -251,24 +251,24 @@ endif()
if(CMAKE_C_COMPILER_IS_GCC_COMPATIBLE) if(CMAKE_C_COMPILER_IS_GCC_COMPATIBLE)
list(APPEND CMAKE_REQUIRED_LIBRARIES m) # -lm list(APPEND CMAKE_REQUIRED_LIBRARIES m) # -lm
endif() endif()
check_symbol_exists(powf math.h GMIO_HAVE_POWF_FUNC) check_symbol_exists(powf math.h GMIO_HAVE_POWF)
check_symbol_exists(sqrtf math.h GMIO_HAVE_SQRTF_FUNC) check_symbol_exists(sqrtf math.h GMIO_HAVE_SQRTF)
check_symbol_exists(strtof stdlib.h GMIO_HAVE_STRTOF_FUNC) check_symbol_exists(strtof stdlib.h GMIO_HAVE_STRTOF)
check_symbol_exists(isfinite math.h GMIO_HAVE_ISFINITE_SYM) check_symbol_exists(isfinite math.h GMIO_HAVE_ISFINITE)
check_symbol_exists(isnan math.h GMIO_HAVE_ISNAN_SYM) check_symbol_exists(isnan math.h GMIO_HAVE_ISNAN)
check_symbol_exists(snprintf "stdio.h;stdlib.h" GMIO_HAVE_SNPRINTF_FUNC) check_symbol_exists(snprintf "stdio.h;stdlib.h" GMIO_HAVE_SNPRINTF)
check_symbol_exists(vsnprintf stdio.h GMIO_HAVE_VSNPRINTF_FUNC) check_symbol_exists(vsnprintf stdio.h GMIO_HAVE_VSNPRINTF)
if(WIN32 AND NOT GMIO_HAVE_ISNAN_SYM) if(WIN32 AND NOT GMIO_HAVE_ISNAN)
check_symbol_exists(_finite float.h GMIO_HAVE_WIN__FINITE_SYM) check_symbol_exists(_finite float.h GMIO_HAVE_WIN__FINITE)
endif() endif()
if(WIN32 AND NOT GMIO_HAVE_ISNAN_SYM) if(WIN32 AND NOT GMIO_HAVE_ISNAN)
check_symbol_exists(_isnan float.h GMIO_HAVE_WIN__ISNAN_SYM) check_symbol_exists(_isnan float.h GMIO_HAVE_WIN__ISNAN)
endif() endif()
if(WIN32 AND NOT GMIO_HAVE_SNPRINTF_FUNC) if(WIN32 AND NOT GMIO_HAVE_SNPRINTF)
check_symbol_exists(_snprintf stdio.h GMIO_HAVE_WIN__SNPRINTF_FUNC) check_symbol_exists(_snprintf stdio.h GMIO_HAVE_WIN__SNPRINTF)
endif() endif()
if(WIN32 AND NOT GMIO_HAVE_VSNPRINTF_FUNC) if(WIN32 AND NOT GMIO_HAVE_VSNPRINTF)
check_symbol_exists(_vsnprintf stdio.h GMIO_HAVE_WIN__VSNPRINTF_FUNC) check_symbol_exists(_vsnprintf stdio.h GMIO_HAVE_WIN__VSNPRINTF)
endif() endif()
set(CMAKE_REQUIRED_LIBRARIES) # Pop changes set(CMAKE_REQUIRED_LIBRARIES) # Pop changes
@ -304,22 +304,22 @@ if (NOT DEFINED HAVE_SYS_STAT_H)
check_include_files(sys/stat.h GMIO_HAVE_SYS_STAT_H) check_include_files(sys/stat.h GMIO_HAVE_SYS_STAT_H)
endif() endif()
check_function_exists(fileno GMIO_HAVE_POSIX_FILENO_FUNC) check_function_exists(fileno GMIO_HAVE_POSIX_FILENO)
# Have fstat64() ? # Have fstat64() ?
check_c_source_compiles( check_c_source_compiles(
"#include <sys/stat.h> "#include <sys/stat.h>
int main() { fstat64(0, NULL); return 0; }" int main() { fstat64(0, NULL); return 0; }"
GMIO_HAVE_POSIX_FSTAT64_FUNC) GMIO_HAVE_POSIX_FSTAT64)
if(WIN32) if(WIN32)
check_function_exists(_fstat64 GMIO_HAVE_WIN__FSTAT64_FUNC) check_function_exists(_fstat64 GMIO_HAVE_WIN__FSTAT64)
endif() endif()
# Check size(in bytes) of stat::st_size # Check size(in bytes) of stat::st_size
set(CMAKE_EXTRA_INCLUDE_FILES sys/stat.h) set(CMAKE_EXTRA_INCLUDE_FILES sys/stat.h)
if(GMIO_HAVE_WIN__FSTAT64_FUNC) if(GMIO_HAVE_WIN__FSTAT64)
check_type_size("((struct _stat64*)0)->st_size" GMIO_SIZEOF_STRUCT_STAT_ST_SIZE) check_type_size("((struct _stat64*)0)->st_size" GMIO_SIZEOF_STRUCT_STAT_ST_SIZE)
elseif(GMIO_HAVE_POSIX_FSTAT64_FUNC) elseif(GMIO_HAVE_POSIX_FSTAT64)
check_type_size("((struct stat64*)0)->st_size" GMIO_SIZEOF_STRUCT_STAT_ST_SIZE) check_type_size("((struct stat64*)0)->st_size" GMIO_SIZEOF_STRUCT_STAT_ST_SIZE)
else() else()
check_type_size("((struct stat*)0)->st_size" GMIO_SIZEOF_STRUCT_STAT_ST_SIZE) check_type_size("((struct stat*)0)->st_size" GMIO_SIZEOF_STRUCT_STAT_ST_SIZE)
@ -340,15 +340,15 @@ if(CMAKE_C_COMPILER_IS_GCC_COMPATIBLE)
# See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52624 # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52624
check_c_source_compiles( check_c_source_compiles(
"int main() { return (int)__builtin_bswap16(0x1122); }" "int main() { return (int)__builtin_bswap16(0x1122); }"
GMIO_HAVE_GCC_BUILTIN_BSWAP16_FUNC) GMIO_HAVE_GCC_BUILTIN_BSWAP16)
check_c_source_compiles( check_c_source_compiles(
"int main() { return (int)__builtin_bswap32(0x11223344); }" "int main() { return (int)__builtin_bswap32(0x11223344); }"
GMIO_HAVE_GCC_BUILTIN_BSWAP32_FUNC) GMIO_HAVE_GCC_BUILTIN_BSWAP32)
elseif(MSVC) elseif(MSVC)
check_c_source_compiles( check_c_source_compiles(
"#include <stdlib.h> "#include <stdlib.h>
int main() { return (int)_byteswap_ulong(0x11223344); }" int main() { return (int)_byteswap_ulong(0x11223344); }"
GMIO_HAVE_MSVC_BUILTIN_BSWAP_FUNC) GMIO_HAVE_MSVC_BUILTIN_BSWAP)
endif() endif()
#set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) #set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

View File

@ -53,30 +53,30 @@
#cmakedefine GMIO_HAVE_C99_BOOL #cmakedefine GMIO_HAVE_C99_BOOL
#endif #endif
#cmakedefine GMIO_HAVE_STRTOF_FUNC #cmakedefine GMIO_HAVE_STRTOF
#cmakedefine GMIO_HAVE_POWF_FUNC #cmakedefine GMIO_HAVE_POWF
#cmakedefine GMIO_HAVE_SNPRINTF_FUNC #cmakedefine GMIO_HAVE_SNPRINTF
#cmakedefine GMIO_HAVE_WIN__SNPRINTF_FUNC #cmakedefine GMIO_HAVE_WIN__SNPRINTF
#cmakedefine GMIO_HAVE_VSNPRINTF_FUNC #cmakedefine GMIO_HAVE_VSNPRINTF
#cmakedefine GMIO_HAVE_WIN__VSNPRINTF_FUNC #cmakedefine GMIO_HAVE_WIN__VSNPRINTF
#cmakedefine GMIO_HAVE_ISFINITE_SYM #cmakedefine GMIO_HAVE_ISFINITE
#cmakedefine GMIO_HAVE_WIN__FINITE_SYM #cmakedefine GMIO_HAVE_WIN__FINITE
#cmakedefine GMIO_HAVE_ISNAN_SYM #cmakedefine GMIO_HAVE_ISNAN
#cmakedefine GMIO_HAVE_WIN__ISNAN_SYM #cmakedefine GMIO_HAVE_WIN__ISNAN
/* POSIX */ /* POSIX */
#cmakedefine GMIO_HAVE_SYS_TYPES_H #cmakedefine GMIO_HAVE_SYS_TYPES_H
#cmakedefine GMIO_HAVE_SYS_STAT_H #cmakedefine GMIO_HAVE_SYS_STAT_H
#cmakedefine GMIO_HAVE_POSIX_FILENO_FUNC #cmakedefine GMIO_HAVE_POSIX_FILENO
#cmakedefine GMIO_HAVE_POSIX_FSTAT64_FUNC #cmakedefine GMIO_HAVE_POSIX_FSTAT64
#cmakedefine GMIO_HAVE_WIN__FSTAT64_FUNC #cmakedefine GMIO_HAVE_WIN__FSTAT64
/* Compiler byte-swap functions */ /* Compiler byte-swap functions */
#cmakedefine GMIO_HAVE_GCC_BUILTIN_BSWAP16_FUNC #cmakedefine GMIO_HAVE_GCC_BUILTIN_BSWAP16
#cmakedefine GMIO_HAVE_GCC_BUILTIN_BSWAP32_FUNC #cmakedefine GMIO_HAVE_GCC_BUILTIN_BSWAP32
#cmakedefine GMIO_HAVE_MSVC_BUILTIN_BSWAP_FUNC #cmakedefine GMIO_HAVE_MSVC_BUILTIN_BSWAP
/* Target architecture */ /* Target architecture */
#cmakedefine GMIO_HOST_IS_BIG_ENDIAN #cmakedefine GMIO_HOST_IS_BIG_ENDIAN

View File

@ -31,7 +31,7 @@
#include "../global.h" #include "../global.h"
#ifdef GMIO_HAVE_MSVC_BUILTIN_BSWAP_FUNC #ifdef GMIO_HAVE_MSVC_BUILTIN_BSWAP
# include <stdlib.h> # include <stdlib.h>
#endif #endif
@ -39,9 +39,9 @@
* functions if available */ * functions if available */
GMIO_INLINE uint16_t gmio_uint16_bswap(uint16_t val) GMIO_INLINE uint16_t gmio_uint16_bswap(uint16_t val)
{ {
#ifdef GMIO_HAVE_GCC_BUILTIN_BSWAP16_FUNC #ifdef GMIO_HAVE_GCC_BUILTIN_BSWAP16
return __builtin_bswap16(val); return __builtin_bswap16(val);
#elif defined(GMIO_HAVE_MSVC_BUILTIN_BSWAP_FUNC) #elif defined(GMIO_HAVE_MSVC_BUILTIN_BSWAP)
return _byteswap_ushort(val); return _byteswap_ushort(val);
#else #else
return ((val & 0x00FF) << 8) | ((val >> 8) & 0x00FF); return ((val & 0x00FF) << 8) | ((val >> 8) & 0x00FF);
@ -52,9 +52,9 @@ GMIO_INLINE uint16_t gmio_uint16_bswap(uint16_t val)
* functions if available */ * functions if available */
GMIO_INLINE uint32_t gmio_uint32_bswap(uint32_t val) GMIO_INLINE uint32_t gmio_uint32_bswap(uint32_t val)
{ {
#ifdef GMIO_HAVE_GCC_BUILTIN_BSWAP32_FUNC #ifdef GMIO_HAVE_GCC_BUILTIN_BSWAP32
return __builtin_bswap32(val); return __builtin_bswap32(val);
#elif defined(GMIO_HAVE_MSVC_BUILTIN_BSWAP_FUNC) #elif defined(GMIO_HAVE_MSVC_BUILTIN_BSWAP)
return _byteswap_ulong(val); return _byteswap_ulong(val);
#else #else
return ((val & 0x000000FF) << 24) return ((val & 0x000000FF) << 24)

View File

@ -32,7 +32,7 @@
#include "../global.h" #include "../global.h"
#include <math.h> #include <math.h>
#ifdef GMIO_HAVE_POWF_FUNC #ifdef GMIO_HAVE_POWF
# define gmio_powf powf # define gmio_powf powf
#else #else
/* No powf() function, call pow(double) as fallback */ /* No powf() function, call pow(double) as fallback */
@ -40,7 +40,7 @@ GMIO_INLINE float gmio_powf(float base, float exponent)
{ return (float)pow((double)base, (double)exponent); } { return (float)pow((double)base, (double)exponent); }
#endif #endif
#ifdef GMIO_HAVE_SQRTF_FUNC #ifdef GMIO_HAVE_SQRTF
# define gmio_sqrtf sqrtf # define gmio_sqrtf sqrtf
#else #else
/* No sqrtf() function, call sqrt(double) as fallback */ /* No sqrtf() function, call sqrt(double) as fallback */
@ -48,9 +48,9 @@ GMIO_INLINE float gmio_sqrtf(float x)
{ return (float)sqrt((double)x); } { return (float)sqrt((double)x); }
#endif #endif
#if defined(GMIO_HAVE_ISFINITE_SYM) #if defined(GMIO_HAVE_ISFINITE)
# define gmio_isfinite(x) isfinite(x) # define gmio_isfinite(x) isfinite(x)
#elif defined(GMIO_HAVE_WIN__FINITE_SYM) #elif defined(GMIO_HAVE_WIN__FINITE)
# include <float.h> # include <float.h>
# define gmio_isfinite(x) _finite(x) # define gmio_isfinite(x) _finite(x)
#else #else
@ -58,9 +58,9 @@ GMIO_INLINE float gmio_sqrtf(float x)
# define gmio_isfinite(x) (((x) != NAN) && ((x) != INFINITY)) # define gmio_isfinite(x) (((x) != NAN) && ((x) != INFINITY))
#endif #endif
#if defined(GMIO_HAVE_ISNAN_SYM) #if defined(GMIO_HAVE_ISNAN)
# define gmio_isnan(x) isnan(x) # define gmio_isnan(x) isnan(x)
#elif defined(GMIO_HAVE_WIN__ISNAN_SYM) #elif defined(GMIO_HAVE_WIN__ISNAN)
# include <float.h> # include <float.h>
# define gmio_isnan(x) _isnan(x) # define gmio_isnan(x) _isnan(x)
#else #else

View File

@ -41,9 +41,9 @@
* *
* vsnprintf() appeared in C99 * vsnprintf() appeared in C99
*/ */
#ifdef GMIO_HAVE_VSNPRINTF_FUNC #ifdef GMIO_HAVE_VSNPRINTF
# define gmio_vsnprintf vsnprintf # define gmio_vsnprintf vsnprintf
#elif defined(GMIO_HAVE_WIN__VSNPRINTF_FUNC) #elif defined(GMIO_HAVE_WIN__VSNPRINTF)
# define gmio_vsnprintf _vsnprintf # define gmio_vsnprintf _vsnprintf
#else #else
/* No vsnprintf()-like function, call unsafe vsprintf() as fallback */ /* No vsnprintf()-like function, call unsafe vsprintf() as fallback */
@ -61,9 +61,9 @@ GMIO_INLINE int gmio_vsnprintf(
* *
* snprintf() appeared in C99 * snprintf() appeared in C99
*/ */
#ifdef GMIO_HAVE_SNPRINTF_FUNC #ifdef GMIO_HAVE_SNPRINTF
# define gmio_snprintf snprintf # define gmio_snprintf snprintf
#elif defined(GMIO_HAVE_WIN__SNPRINTF_FUNC) #elif defined(GMIO_HAVE_WIN__SNPRINTF)
# define gmio_snprintf _snprintf # define gmio_snprintf _snprintf
#else #else
/* No snprintf()-like function, translate to gmio_vsnprintf() call */ /* No snprintf()-like function, translate to gmio_vsnprintf() call */

View File

@ -33,7 +33,7 @@
#include <stdlib.h> #include <stdlib.h>
#ifdef GMIO_HAVE_STRTOF_FUNC #ifdef GMIO_HAVE_STRTOF
# define gmio_strtof strtof # define gmio_strtof strtof
#else #else
/* No strtof() function, call strtod() as fallback */ /* No strtof() function, call strtod() as fallback */

View File

@ -40,10 +40,10 @@
/* gmio_stat_t: type alias on the stat structure /* gmio_stat_t: type alias on the stat structure
* GMIO_FSTAT_FUNC_NAME: alias on the fstat() function * GMIO_FSTAT_FUNC_NAME: alias on the fstat() function
*/ */
# if defined(GMIO_HAVE_WIN__FSTAT64_FUNC) # if defined(GMIO_HAVE_WIN__FSTAT64)
typedef struct __stat64 gmio_stat_t; typedef struct __stat64 gmio_stat_t;
# define GMIO_FSTAT_FUNC_NAME _fstat64 # define GMIO_FSTAT_FUNC_NAME _fstat64
# elif defined(GMIO_HAVE_POSIX_FSTAT64_FUNC) # elif defined(GMIO_HAVE_POSIX_FSTAT64)
typedef struct stat64 gmio_stat_t; typedef struct stat64 gmio_stat_t;
# define GMIO_FSTAT_FUNC_NAME fstat64 # define GMIO_FSTAT_FUNC_NAME fstat64
# else # else
@ -93,7 +93,7 @@ static gmio_streamsize_t gmio_stream_stdio_size(void* cookie)
#if defined(GMIO_HAVE_SYS_TYPES_H) \ #if defined(GMIO_HAVE_SYS_TYPES_H) \
&& defined(GMIO_HAVE_SYS_STAT_H) \ && defined(GMIO_HAVE_SYS_STAT_H) \
&& defined(GMIO_HAVE_POSIX_FILENO_FUNC) && defined(GMIO_HAVE_POSIX_FILENO)
const int fd = fileno(file); const int fd = fileno(file);
if (fd != -1) { if (fd != -1) {