aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure4
-rw-r--r--configure.in4
-rw-r--r--src/include/c.h47
-rw-r--r--src/include/pg_config.h.in6
-rw-r--r--src/include/pg_config.h.win326
5 files changed, 39 insertions, 28 deletions
diff --git a/configure b/configure
index 7bedd87da77..ff554b02760 100755
--- a/configure
+++ b/configure
@@ -12556,7 +12556,7 @@ $as_echo "#define HAVE_INT_OPTRESET 1" >>confdefs.h
fi
-for ac_func in strtoll strtoq
+for ac_func in strtoll __strtoll strtoq
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -12568,7 +12568,7 @@ _ACEOF
fi
done
-for ac_func in strtoull strtouq
+for ac_func in strtoull __strtoull strtouq
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/configure.in b/configure.in
index 53890056458..f6ef44da2be 100644
--- a/configure.in
+++ b/configure.in
@@ -1569,8 +1569,8 @@ if test x"$pgac_cv_var_int_optreset" = x"yes"; then
AC_DEFINE(HAVE_INT_OPTRESET, 1, [Define to 1 if you have the global variable 'int optreset'.])
fi
-AC_CHECK_FUNCS([strtoll strtoq], [break])
-AC_CHECK_FUNCS([strtoull strtouq], [break])
+AC_CHECK_FUNCS([strtoll __strtoll strtoq], [break])
+AC_CHECK_FUNCS([strtoull __strtoull strtouq], [break])
# strto[u]ll may exist but not be declared
AC_CHECK_DECLS([strtoll, strtoull])
diff --git a/src/include/c.h b/src/include/c.h
index fb305e80b93..7168113c56e 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -1067,13 +1067,40 @@ extern int snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_p
extern int vsnprintf(char *str, size_t count, const char *fmt, va_list args);
#endif
-#if defined(HAVE_LONG_LONG_INT) && defined(HAVE_STRTOLL) && !HAVE_DECL_STRTOLL
+#if defined(HAVE_FDATASYNC) && !HAVE_DECL_FDATASYNC
+extern int fdatasync(int fildes);
+#endif
+
+#ifdef HAVE_LONG_LONG_INT
+/* Older platforms may provide strto[u]ll functionality under other names */
+#if !defined(HAVE_STRTOLL) && defined(HAVE___STRTOLL)
+#define strtoll __strtoll
+#define HAVE_STRTOLL 1
+#endif
+
+#if !defined(HAVE_STRTOLL) && defined(HAVE_STRTOQ)
+#define strtoll strtoq
+#define HAVE_STRTOLL 1
+#endif
+
+#if !defined(HAVE_STRTOULL) && defined(HAVE___STRTOULL)
+#define strtoull __strtoull
+#define HAVE_STRTOULL 1
+#endif
+
+#if !defined(HAVE_STRTOULL) && defined(HAVE_STRTOUQ)
+#define strtoull strtouq
+#define HAVE_STRTOULL 1
+#endif
+
+#if defined(HAVE_STRTOLL) && !HAVE_DECL_STRTOLL
extern long long strtoll(const char *str, char **endptr, int base);
#endif
-#if defined(HAVE_LONG_LONG_INT) && defined(HAVE_STRTOULL) && !HAVE_DECL_STRTOULL
+#if defined(HAVE_STRTOULL) && !HAVE_DECL_STRTOULL
extern unsigned long long strtoull(const char *str, char **endptr, int base);
#endif
+#endif /* HAVE_LONG_LONG_INT */
#if !defined(HAVE_MEMMOVE) && !defined(memmove)
#define memmove(d, s, c) bcopy(s, d, c)
@@ -1111,22 +1138,6 @@ extern unsigned long long strtoull(const char *str, char **endptr, int base);
#define siglongjmp longjmp
#endif
-#if defined(HAVE_FDATASYNC) && !HAVE_DECL_FDATASYNC
-extern int fdatasync(int fildes);
-#endif
-
-/* If strtoq() exists, rename it to the more standard strtoll() */
-#if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_STRTOLL) && defined(HAVE_STRTOQ)
-#define strtoll strtoq
-#define HAVE_STRTOLL 1
-#endif
-
-/* If strtouq() exists, rename it to the more standard strtoull() */
-#if defined(HAVE_LONG_LONG_INT_64) && !defined(HAVE_STRTOULL) && defined(HAVE_STRTOUQ)
-#define strtoull strtouq
-#define HAVE_STRTOULL 1
-#endif
-
/*
* We assume if we have these two functions, we have their friends too, and
* can use the wide-character functions.
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index 2b24fd185b2..07fd3051c6b 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -718,6 +718,12 @@
/* Define to 1 if your compiler understands __VA_ARGS__ in macros. */
#undef HAVE__VA_ARGS
+/* Define to 1 if you have the `__strtoll' function. */
+#undef HAVE___STRTOLL
+
+/* Define to 1 if you have the `__strtoull' function. */
+#undef HAVE___STRTOULL
+
/* Define to the appropriate snprintf length modifier for 64-bit ints. */
#undef INT64_MODIFIER
diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32
index 924d9f848a5..0473bef3de6 100644
--- a/src/include/pg_config.h.win32
+++ b/src/include/pg_config.h.win32
@@ -382,9 +382,6 @@
#endif
#endif
-/* Define to 1 if you have the `strtoq' function. */
-/* #undef HAVE_STRTOQ */
-
/* Define to 1 if you have the `strtoull' function. */
#ifdef HAVE_LONG_LONG_INT_64
#define HAVE_STRTOULL 1
@@ -394,9 +391,6 @@
#endif
#endif
-/* Define to 1 if you have the `strtouq' function. */
-/* #undef HAVE_STRTOUQ */
-
/* Define to 1 if the system has the type `struct addrinfo'. */
#if (_MSC_VER > 1200)
#define HAVE_STRUCT_ADDRINFO 1