Remove all the optional dependencies on Boost.

This commit is contained in:
Tsuda Kageyu 2016-12-20 11:54:06 +09:00
parent ffa32b19a7
commit 14c3ce5737
3 changed files with 32 additions and 59 deletions

View File

@ -103,69 +103,57 @@ endif()
# Determine which kind of byte swap functions your compiler supports.
check_cxx_source_compiles("
#include <boost/endian/conversion.hpp>
int main() {
boost::endian::endian_reverse(static_cast<uint16_t>(1));
boost::endian::endian_reverse(static_cast<uint32_t>(1));
boost::endian::endian_reverse(static_cast<uint64_t>(1));
__builtin_bswap16(0);
__builtin_bswap32(0);
__builtin_bswap64(0);
return 0;
}
" HAVE_BOOST_BYTESWAP)
" HAVE_GCC_BYTESWAP)
if(NOT HAVE_BOOST_BYTESWAP)
if(NOT HAVE_GCC_BYTESWAP)
check_cxx_source_compiles("
#include <byteswap.h>
int main() {
__builtin_bswap16(0);
__builtin_bswap32(0);
__builtin_bswap64(0);
__bswap_16(0);
__bswap_32(0);
__bswap_64(0);
return 0;
}
" HAVE_GCC_BYTESWAP)
" HAVE_GLIBC_BYTESWAP)
if(NOT HAVE_GCC_BYTESWAP)
if(NOT HAVE_GLIBC_BYTESWAP)
check_cxx_source_compiles("
#include <byteswap.h>
#include <stdlib.h>
int main() {
__bswap_16(0);
__bswap_32(0);
__bswap_64(0);
_byteswap_ushort(0);
_byteswap_ulong(0);
_byteswap_uint64(0);
return 0;
}
" HAVE_GLIBC_BYTESWAP)
" HAVE_MSC_BYTESWAP)
if(NOT HAVE_GLIBC_BYTESWAP)
if(NOT HAVE_MSC_BYTESWAP)
check_cxx_source_compiles("
#include <stdlib.h>
#include <libkern/OSByteOrder.h>
int main() {
_byteswap_ushort(0);
_byteswap_ulong(0);
_byteswap_uint64(0);
OSSwapInt16(0);
OSSwapInt32(0);
OSSwapInt64(0);
return 0;
}
" HAVE_MSC_BYTESWAP)
" HAVE_MAC_BYTESWAP)
if(NOT HAVE_MSC_BYTESWAP)
if(NOT HAVE_MAC_BYTESWAP)
check_cxx_source_compiles("
#include <libkern/OSByteOrder.h>
#include <sys/endian.h>
int main() {
OSSwapInt16(0);
OSSwapInt32(0);
OSSwapInt64(0);
swap16(0);
swap32(0);
swap64(0);
return 0;
}
" HAVE_MAC_BYTESWAP)
if(NOT HAVE_MAC_BYTESWAP)
check_cxx_source_compiles("
#include <sys/endian.h>
int main() {
swap16(0);
swap32(0);
swap64(0);
return 0;
}
" HAVE_OPENBSD_BYTESWAP)
endif()
" HAVE_OPENBSD_BYTESWAP)
endif()
endif()
endif()

View File

@ -4,7 +4,6 @@
#define TAGLIB_CONFIG_H
/* Defined if your compiler supports some byte swap functions */
#cmakedefine HAVE_BOOST_BYTESWAP 1
#cmakedefine HAVE_GCC_BYTESWAP 1
#cmakedefine HAVE_GLIBC_BYTESWAP 1
#cmakedefine HAVE_MSC_BYTESWAP 1

View File

@ -34,9 +34,7 @@
# include <config.h>
#endif
#if defined(HAVE_BOOST_BYTESWAP)
# include <boost/endian/conversion.hpp>
#elif defined(HAVE_MSC_BYTESWAP)
#if defined(HAVE_MSC_BYTESWAP)
# include <stdlib.h>
#elif defined(HAVE_GLIBC_BYTESWAP)
# include <byteswap.h>
@ -63,11 +61,7 @@ namespace TagLib
*/
inline unsigned short byteSwap(unsigned short x)
{
#if defined(HAVE_BOOST_BYTESWAP)
return boost::endian::endian_reverse(static_cast<uint16_t>(x));
#elif defined(HAVE_GCC_BYTESWAP)
#if defined(HAVE_GCC_BYTESWAP)
return __builtin_bswap16(x);
@ -99,11 +93,7 @@ namespace TagLib
*/
inline unsigned int byteSwap(unsigned int x)
{
#if defined(HAVE_BOOST_BYTESWAP)
return boost::endian::endian_reverse(static_cast<uint32_t>(x));
#elif defined(HAVE_GCC_BYTESWAP)
#if defined(HAVE_GCC_BYTESWAP)
return __builtin_bswap32(x);
@ -138,11 +128,7 @@ namespace TagLib
*/
inline unsigned long long byteSwap(unsigned long long x)
{
#if defined(HAVE_BOOST_BYTESWAP)
return boost::endian::endian_reverse(static_cast<uint64_t>(x));
#elif defined(HAVE_GCC_BYTESWAP)
#if defined(HAVE_GCC_BYTESWAP)
return __builtin_bswap64(x);