[x264-devel] configure: Check for strtok_r compiler support

Anton Mitrofanov git at videolan.org
Mon Dec 25 20:39:40 CET 2017


x264 | branch: master | Anton Mitrofanov <BugMaster at narod.ru> | Thu Aug 17 23:25:31 2017 +0300| [4e2ed4087ac1621f946b83366e1f53a1326d7424] | committer: Anton Mitrofanov

configure: Check for strtok_r compiler support

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=4e2ed4087ac1621f946b83366e1f53a1326d7424
---

 common/osdep.h | 4 ++--
 configure      | 6 +++++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/common/osdep.h b/common/osdep.h
index ca2455d0..7596e842 100644
--- a/common/osdep.h
+++ b/common/osdep.h
@@ -72,11 +72,11 @@ int x264_vsnprintf( char *s, size_t n, const char *fmt, va_list arg );
 #define isfinite finite
 #endif
 
-#ifdef _WIN32
-#ifndef strtok_r
+#if !HAVE_STRTOK_R && !defined(strtok_r)
 #define strtok_r(str,delim,save) strtok(str,delim)
 #endif
 
+#ifdef _WIN32
 #define utf8_to_utf16( utf8, utf16 )\
     MultiByteToWideChar( CP_UTF8, MB_ERR_INVALID_CHARS, utf8, -1, utf16, sizeof(utf16)/sizeof(wchar_t) )
 FILE *x264_fopen( const char *filename, const char *mode );
diff --git a/configure b/configure
index f72ccc79..da4d1abc 100755
--- a/configure
+++ b/configure
@@ -377,7 +377,7 @@ NL="
 # list of all preprocessor HAVE values we can define
 CONFIG_HAVE="MALLOC_H ALTIVEC ALTIVEC_H MMX ARMV6 ARMV6T2 NEON BEOSTHREAD POSIXTHREAD WIN32THREAD THREAD LOG2F SWSCALE \
              LAVF FFMS GPAC AVS GPL VECTOREXT INTERLACED CPU_COUNT OPENCL THP LSMASH X86_INLINE_ASM AS_FUNC INTEL_DISPATCHER \
-             MSA MMAP WINRT VSX ARM_INLINE_ASM"
+             MSA MMAP WINRT VSX ARM_INLINE_ASM STRTOK_R"
 
 # parse options
 
@@ -1044,6 +1044,10 @@ if cc_check "math.h" "-Werror" "return log2f(2);" ; then
     define HAVE_LOG2F
 fi
 
+if cc_check 'string.h' '' 'strtok_r(0, 0, 0);' ; then
+    define HAVE_STRTOK_R
+fi
+
 if [ "$SYS" != "WINDOWS" ] && cpp_check "sys/mman.h unistd.h" "" "defined(MAP_PRIVATE)"; then
     define HAVE_MMAP
 fi



More information about the x264-devel mailing list