cmake: remove _FUNC and _SYM variable suffix
This commit is contained in:
parent
94dd70b86c
commit
8e4c556ba6
@ -251,24 +251,24 @@ endif()
|
||||
if(CMAKE_C_COMPILER_IS_GCC_COMPATIBLE)
|
||||
list(APPEND CMAKE_REQUIRED_LIBRARIES m) # -lm
|
||||
endif()
|
||||
check_symbol_exists(powf math.h GMIO_HAVE_POWF_FUNC)
|
||||
check_symbol_exists(sqrtf math.h GMIO_HAVE_SQRTF_FUNC)
|
||||
check_symbol_exists(strtof stdlib.h GMIO_HAVE_STRTOF_FUNC)
|
||||
check_symbol_exists(isfinite math.h GMIO_HAVE_ISFINITE_SYM)
|
||||
check_symbol_exists(isnan math.h GMIO_HAVE_ISNAN_SYM)
|
||||
check_symbol_exists(snprintf "stdio.h;stdlib.h" GMIO_HAVE_SNPRINTF_FUNC)
|
||||
check_symbol_exists(vsnprintf stdio.h GMIO_HAVE_VSNPRINTF_FUNC)
|
||||
if(WIN32 AND NOT GMIO_HAVE_ISNAN_SYM)
|
||||
check_symbol_exists(_finite float.h GMIO_HAVE_WIN__FINITE_SYM)
|
||||
check_symbol_exists(powf math.h GMIO_HAVE_POWF)
|
||||
check_symbol_exists(sqrtf math.h GMIO_HAVE_SQRTF)
|
||||
check_symbol_exists(strtof stdlib.h GMIO_HAVE_STRTOF)
|
||||
check_symbol_exists(isfinite math.h GMIO_HAVE_ISFINITE)
|
||||
check_symbol_exists(isnan math.h GMIO_HAVE_ISNAN)
|
||||
check_symbol_exists(snprintf "stdio.h;stdlib.h" GMIO_HAVE_SNPRINTF)
|
||||
check_symbol_exists(vsnprintf stdio.h GMIO_HAVE_VSNPRINTF)
|
||||
if(WIN32 AND NOT GMIO_HAVE_ISNAN)
|
||||
check_symbol_exists(_finite float.h GMIO_HAVE_WIN__FINITE)
|
||||
endif()
|
||||
if(WIN32 AND NOT GMIO_HAVE_ISNAN_SYM)
|
||||
check_symbol_exists(_isnan float.h GMIO_HAVE_WIN__ISNAN_SYM)
|
||||
if(WIN32 AND NOT GMIO_HAVE_ISNAN)
|
||||
check_symbol_exists(_isnan float.h GMIO_HAVE_WIN__ISNAN)
|
||||
endif()
|
||||
if(WIN32 AND NOT GMIO_HAVE_SNPRINTF_FUNC)
|
||||
check_symbol_exists(_snprintf stdio.h GMIO_HAVE_WIN__SNPRINTF_FUNC)
|
||||
if(WIN32 AND NOT GMIO_HAVE_SNPRINTF)
|
||||
check_symbol_exists(_snprintf stdio.h GMIO_HAVE_WIN__SNPRINTF)
|
||||
endif()
|
||||
if(WIN32 AND NOT GMIO_HAVE_VSNPRINTF_FUNC)
|
||||
check_symbol_exists(_vsnprintf stdio.h GMIO_HAVE_WIN__VSNPRINTF_FUNC)
|
||||
if(WIN32 AND NOT GMIO_HAVE_VSNPRINTF)
|
||||
check_symbol_exists(_vsnprintf stdio.h GMIO_HAVE_WIN__VSNPRINTF)
|
||||
endif()
|
||||
|
||||
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)
|
||||
endif()
|
||||
|
||||
check_function_exists(fileno GMIO_HAVE_POSIX_FILENO_FUNC)
|
||||
check_function_exists(fileno GMIO_HAVE_POSIX_FILENO)
|
||||
|
||||
# Have fstat64() ?
|
||||
check_c_source_compiles(
|
||||
"#include <sys/stat.h>
|
||||
int main() { fstat64(0, NULL); return 0; }"
|
||||
GMIO_HAVE_POSIX_FSTAT64_FUNC)
|
||||
GMIO_HAVE_POSIX_FSTAT64)
|
||||
if(WIN32)
|
||||
check_function_exists(_fstat64 GMIO_HAVE_WIN__FSTAT64_FUNC)
|
||||
check_function_exists(_fstat64 GMIO_HAVE_WIN__FSTAT64)
|
||||
endif()
|
||||
|
||||
# Check size(in bytes) of stat::st_size
|
||||
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)
|
||||
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)
|
||||
else()
|
||||
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
|
||||
check_c_source_compiles(
|
||||
"int main() { return (int)__builtin_bswap16(0x1122); }"
|
||||
GMIO_HAVE_GCC_BUILTIN_BSWAP16_FUNC)
|
||||
GMIO_HAVE_GCC_BUILTIN_BSWAP16)
|
||||
check_c_source_compiles(
|
||||
"int main() { return (int)__builtin_bswap32(0x11223344); }"
|
||||
GMIO_HAVE_GCC_BUILTIN_BSWAP32_FUNC)
|
||||
GMIO_HAVE_GCC_BUILTIN_BSWAP32)
|
||||
elseif(MSVC)
|
||||
check_c_source_compiles(
|
||||
"#include <stdlib.h>
|
||||
int main() { return (int)_byteswap_ulong(0x11223344); }"
|
||||
GMIO_HAVE_MSVC_BUILTIN_BSWAP_FUNC)
|
||||
GMIO_HAVE_MSVC_BUILTIN_BSWAP)
|
||||
endif()
|
||||
|
||||
#set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
|
@ -53,30 +53,30 @@
|
||||
#cmakedefine GMIO_HAVE_C99_BOOL
|
||||
#endif
|
||||
|
||||
#cmakedefine GMIO_HAVE_STRTOF_FUNC
|
||||
#cmakedefine GMIO_HAVE_POWF_FUNC
|
||||
#cmakedefine GMIO_HAVE_SNPRINTF_FUNC
|
||||
#cmakedefine GMIO_HAVE_WIN__SNPRINTF_FUNC
|
||||
#cmakedefine GMIO_HAVE_VSNPRINTF_FUNC
|
||||
#cmakedefine GMIO_HAVE_WIN__VSNPRINTF_FUNC
|
||||
#cmakedefine GMIO_HAVE_STRTOF
|
||||
#cmakedefine GMIO_HAVE_POWF
|
||||
#cmakedefine GMIO_HAVE_SNPRINTF
|
||||
#cmakedefine GMIO_HAVE_WIN__SNPRINTF
|
||||
#cmakedefine GMIO_HAVE_VSNPRINTF
|
||||
#cmakedefine GMIO_HAVE_WIN__VSNPRINTF
|
||||
|
||||
#cmakedefine GMIO_HAVE_ISFINITE_SYM
|
||||
#cmakedefine GMIO_HAVE_WIN__FINITE_SYM
|
||||
#cmakedefine GMIO_HAVE_ISNAN_SYM
|
||||
#cmakedefine GMIO_HAVE_WIN__ISNAN_SYM
|
||||
#cmakedefine GMIO_HAVE_ISFINITE
|
||||
#cmakedefine GMIO_HAVE_WIN__FINITE
|
||||
#cmakedefine GMIO_HAVE_ISNAN
|
||||
#cmakedefine GMIO_HAVE_WIN__ISNAN
|
||||
|
||||
/* POSIX */
|
||||
#cmakedefine GMIO_HAVE_SYS_TYPES_H
|
||||
#cmakedefine GMIO_HAVE_SYS_STAT_H
|
||||
#cmakedefine GMIO_HAVE_POSIX_FILENO_FUNC
|
||||
#cmakedefine GMIO_HAVE_POSIX_FSTAT64_FUNC
|
||||
#cmakedefine GMIO_HAVE_WIN__FSTAT64_FUNC
|
||||
#cmakedefine GMIO_HAVE_POSIX_FILENO
|
||||
#cmakedefine GMIO_HAVE_POSIX_FSTAT64
|
||||
#cmakedefine GMIO_HAVE_WIN__FSTAT64
|
||||
|
||||
/* Compiler byte-swap functions */
|
||||
#cmakedefine GMIO_HAVE_GCC_BUILTIN_BSWAP16_FUNC
|
||||
#cmakedefine GMIO_HAVE_GCC_BUILTIN_BSWAP32_FUNC
|
||||
#cmakedefine GMIO_HAVE_GCC_BUILTIN_BSWAP16
|
||||
#cmakedefine GMIO_HAVE_GCC_BUILTIN_BSWAP32
|
||||
|
||||
#cmakedefine GMIO_HAVE_MSVC_BUILTIN_BSWAP_FUNC
|
||||
#cmakedefine GMIO_HAVE_MSVC_BUILTIN_BSWAP
|
||||
|
||||
/* Target architecture */
|
||||
#cmakedefine GMIO_HOST_IS_BIG_ENDIAN
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
#include "../global.h"
|
||||
|
||||
#ifdef GMIO_HAVE_MSVC_BUILTIN_BSWAP_FUNC
|
||||
#ifdef GMIO_HAVE_MSVC_BUILTIN_BSWAP
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
@ -39,9 +39,9 @@
|
||||
* functions if available */
|
||||
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);
|
||||
#elif defined(GMIO_HAVE_MSVC_BUILTIN_BSWAP_FUNC)
|
||||
#elif defined(GMIO_HAVE_MSVC_BUILTIN_BSWAP)
|
||||
return _byteswap_ushort(val);
|
||||
#else
|
||||
return ((val & 0x00FF) << 8) | ((val >> 8) & 0x00FF);
|
||||
@ -52,9 +52,9 @@ GMIO_INLINE uint16_t gmio_uint16_bswap(uint16_t val)
|
||||
* functions if available */
|
||||
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);
|
||||
#elif defined(GMIO_HAVE_MSVC_BUILTIN_BSWAP_FUNC)
|
||||
#elif defined(GMIO_HAVE_MSVC_BUILTIN_BSWAP)
|
||||
return _byteswap_ulong(val);
|
||||
#else
|
||||
return ((val & 0x000000FF) << 24)
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "../global.h"
|
||||
#include <math.h>
|
||||
|
||||
#ifdef GMIO_HAVE_POWF_FUNC
|
||||
#ifdef GMIO_HAVE_POWF
|
||||
# define gmio_powf powf
|
||||
#else
|
||||
/* 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); }
|
||||
#endif
|
||||
|
||||
#ifdef GMIO_HAVE_SQRTF_FUNC
|
||||
#ifdef GMIO_HAVE_SQRTF
|
||||
# define gmio_sqrtf sqrtf
|
||||
#else
|
||||
/* No sqrtf() function, call sqrt(double) as fallback */
|
||||
@ -48,9 +48,9 @@ GMIO_INLINE float gmio_sqrtf(float x)
|
||||
{ return (float)sqrt((double)x); }
|
||||
#endif
|
||||
|
||||
#if defined(GMIO_HAVE_ISFINITE_SYM)
|
||||
#if defined(GMIO_HAVE_ISFINITE)
|
||||
# define gmio_isfinite(x) isfinite(x)
|
||||
#elif defined(GMIO_HAVE_WIN__FINITE_SYM)
|
||||
#elif defined(GMIO_HAVE_WIN__FINITE)
|
||||
# include <float.h>
|
||||
# define gmio_isfinite(x) _finite(x)
|
||||
#else
|
||||
@ -58,9 +58,9 @@ GMIO_INLINE float gmio_sqrtf(float x)
|
||||
# define gmio_isfinite(x) (((x) != NAN) && ((x) != INFINITY))
|
||||
#endif
|
||||
|
||||
#if defined(GMIO_HAVE_ISNAN_SYM)
|
||||
#if defined(GMIO_HAVE_ISNAN)
|
||||
# define gmio_isnan(x) isnan(x)
|
||||
#elif defined(GMIO_HAVE_WIN__ISNAN_SYM)
|
||||
#elif defined(GMIO_HAVE_WIN__ISNAN)
|
||||
# include <float.h>
|
||||
# define gmio_isnan(x) _isnan(x)
|
||||
#else
|
||||
|
@ -41,9 +41,9 @@
|
||||
*
|
||||
* vsnprintf() appeared in C99
|
||||
*/
|
||||
#ifdef GMIO_HAVE_VSNPRINTF_FUNC
|
||||
#ifdef GMIO_HAVE_VSNPRINTF
|
||||
# define gmio_vsnprintf vsnprintf
|
||||
#elif defined(GMIO_HAVE_WIN__VSNPRINTF_FUNC)
|
||||
#elif defined(GMIO_HAVE_WIN__VSNPRINTF)
|
||||
# define gmio_vsnprintf _vsnprintf
|
||||
#else
|
||||
/* No vsnprintf()-like function, call unsafe vsprintf() as fallback */
|
||||
@ -61,9 +61,9 @@ GMIO_INLINE int gmio_vsnprintf(
|
||||
*
|
||||
* snprintf() appeared in C99
|
||||
*/
|
||||
#ifdef GMIO_HAVE_SNPRINTF_FUNC
|
||||
#ifdef GMIO_HAVE_SNPRINTF
|
||||
# define gmio_snprintf snprintf
|
||||
#elif defined(GMIO_HAVE_WIN__SNPRINTF_FUNC)
|
||||
#elif defined(GMIO_HAVE_WIN__SNPRINTF)
|
||||
# define gmio_snprintf _snprintf
|
||||
#else
|
||||
/* No snprintf()-like function, translate to gmio_vsnprintf() call */
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef GMIO_HAVE_STRTOF_FUNC
|
||||
#ifdef GMIO_HAVE_STRTOF
|
||||
# define gmio_strtof strtof
|
||||
#else
|
||||
/* No strtof() function, call strtod() as fallback */
|
||||
|
@ -40,10 +40,10 @@
|
||||
/* gmio_stat_t: type alias on the stat structure
|
||||
* 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;
|
||||
# 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;
|
||||
# define GMIO_FSTAT_FUNC_NAME fstat64
|
||||
# else
|
||||
@ -93,7 +93,7 @@ static gmio_streamsize_t gmio_stream_stdio_size(void* cookie)
|
||||
|
||||
#if defined(GMIO_HAVE_SYS_TYPES_H) \
|
||||
&& defined(GMIO_HAVE_SYS_STAT_H) \
|
||||
&& defined(GMIO_HAVE_POSIX_FILENO_FUNC)
|
||||
&& defined(GMIO_HAVE_POSIX_FILENO)
|
||||
|
||||
const int fd = fileno(file);
|
||||
if (fd != -1) {
|
||||
|
Loading…
Reference in New Issue
Block a user