]> granicus.if.org Git - json-c/commitdiff
Issue #568: fix the strtoll and strtoull handing so config.h ends up creating defines...
authorEric Haszlakiewicz <erh+git@nimenees.com>
Thu, 9 Apr 2020 20:58:28 +0000 (20:58 +0000)
committerEric Haszlakiewicz <erh+git@nimenees.com>
Thu, 9 Apr 2020 20:58:28 +0000 (20:58 +0000)
CMakeLists.txt
cmake/config.h.in
json_util.c

index 898974dbedd4eb06db83eed637e036bbb815a5eb..6b70fa6112239b0e864717a11523d6fc63c56021 100644 (file)
@@ -166,30 +166,27 @@ if (HAVE_SYSLOG_H)
     check_symbol_exists(vsyslog     "syslog.h" HAVE_VSYSLOG)
 endif()
 
-if (MSVC)
-    check_symbol_exists(strtoll     "stdlib.h" HAVE_STRTOLL)
-    check_symbol_exists(strtoull    "stdlib.h" HAVE_STRTOULL)
-
-    set(json_c_strtoll "strtoll")
-    if (NOT HAVE_STRTOLL)
-        # Use _strtoi64 if strtoll is not available.
-        check_symbol_exists(_strtoi64 "stdlib.h" __have_strtoi64)
-        if (__have_strtoi64)
-            set(HAVE_STRTOLL 1)
-            set(json_c_strtoll "_strtoi64")
-            # could do the same for strtoull, if needed
-        endif()
-    endif()
-
-    set(json_c_strtoull "strtoull")
-    if (NOT HAVE_STRTOULL)
-        # Use _strtoui64 if strtoull is not available.
-        check_symbol_exists(_strtoui64 "stdlib.h" __have_strtoui64)
-        if (__have_strtoui64)
-            set(HAVE_STRTOULL 1)
-            set(json_c_strtoull "_strtoui64")
-        endif()
-    endif()
+check_symbol_exists(strtoll     "stdlib.h" HAVE_STRTOLL)
+check_symbol_exists(strtoull    "stdlib.h" HAVE_STRTOULL)
+
+set(json_c_strtoll "strtoll")
+if (NOT HAVE_STRTOLL)
+# Use _strtoi64 if strtoll is not available.
+check_symbol_exists(_strtoi64 "stdlib.h" __have_strtoi64)
+if (__have_strtoi64)
+    #set(HAVE_STRTOLL 1)
+    set(json_c_strtoll "_strtoi64")
+endif()
+endif()
+
+set(json_c_strtoull "strtoull")
+if (NOT HAVE_STRTOULL)
+# Use _strtoui64 if strtoull is not available.
+check_symbol_exists(_strtoui64 "stdlib.h" __have_strtoui64)
+if (__have_strtoui64)
+    #set(HAVE_STRTOULL 1)
+    set(json_c_strtoull "_strtoui64")
+endif()
 endif()
 
 
index 3539d6f28daaab9987cbf398d350ca7e7bbe1edc..5e64e58bd134bcd824487fb3fa13a570fe1813e3 100644 (file)
 #cmakedefine HAVE_VSYSLOG @HAVE_VSYSLOG@
 
 #cmakedefine HAVE_STRTOLL
-#cmakedefine strtoll @json_c_strtoll@
+#if !defined(HAVE_STRTOLL)
+#define strtoll @json_c_strtoll@
+/* #cmakedefine json_c_strtoll @json_c_strtoll@*/
+#endif
+
 #cmakedefine HAVE_STRTOULL
-#cmakedefine strtoull @json_c_strtoull@
+#if !defined(HAVE_STRTOULL)
+#define strtoull @json_c_strtoull@
+/* #cmakedefine json_c_strtoull @json_c_strtoull@ */
+#endif
 
 /* Have __thread */
 #cmakedefine HAVE___THREAD
index abbabd3bc20f42309e3408d6bf7dbc4eb640d7ed..24dd7686e8b71899cbe4aaa26904ca3b127d5f45 100644 (file)
 #endif /* HAVE_UNISTD_H */
 
 #ifdef WIN32
-#if MSC_VER < 1800
-/* strtoll/strtoull is available only since Visual Studio 2013 */
-#define strtoll _strtoi64
-#define strtoull _strtoui64
-#endif
 #define WIN32_LEAN_AND_MEAN
 #include <io.h>
 #include <windows.h>