diff --git a/configure b/configure index 23d53eabc167ce4c781f284482ac3999a945221f..4cfdde716637c7e811fef86166b5de3cbebbb3f2 100755 --- a/configure +++ b/configure @@ -13915,6 +13915,28 @@ _ACEOF fi done +# strto[u]ll may exist but not be declared +ac_fn_c_check_decl "$LINENO" "strtoll" "ac_cv_have_decl_strtoll" "$ac_includes_default" +if test "x$ac_cv_have_decl_strtoll" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRTOLL $ac_have_decl +_ACEOF +ac_fn_c_check_decl "$LINENO" "strtoull" "ac_cv_have_decl_strtoull" "$ac_includes_default" +if test "x$ac_cv_have_decl_strtoull" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRTOULL $ac_have_decl +_ACEOF + if test "$with_icu" = yes; then ac_save_CPPFLAGS=$CPPFLAGS diff --git a/configure.in b/configure.in index d9fe56e4f957d3002fa2633c4c7e83e584c56270..2607045ed154360376d5bf38e729d8e0b006518c 100644 --- a/configure.in +++ b/configure.in @@ -1659,6 +1659,8 @@ fi AC_CHECK_FUNCS([strtoll strtoq], [break]) AC_CHECK_FUNCS([strtoull strtouq], [break]) +# strto[u]ll may exist but not be declared +AC_CHECK_DECLS([strtoll, strtoull]) if test "$with_icu" = yes; then ac_save_CPPFLAGS=$CPPFLAGS diff --git a/src/include/c.h b/src/include/c.h index d4dd86636f72d62fee6ffafe004221bf20d4ac15..7b81efad3d6734d7b7e818d01bac27850de440c5 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -1076,6 +1076,14 @@ 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 +extern long long strtoll(const char *str, char **endptr, int base); +#endif + +#if defined(HAVE_LONG_LONG_INT) && defined(HAVE_STRTOULL) && !HAVE_DECL_STRTOULL +extern unsigned long long strtoull(const char *str, char **endptr, int base); +#endif + #if !defined(HAVE_MEMMOVE) && !defined(memmove) #define memmove(d, s, c) bcopy(s, d, c) #endif diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 79986e9241159015ae3f2073989fb762eeb2839c..c976678ee7cb38499824c4a77d365cb4751c1dcb 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -150,6 +150,14 @@ don't. */ #undef HAVE_DECL_STRLCPY +/* Define to 1 if you have the declaration of `strtoll', and to 0 if you + don't. */ +#undef HAVE_DECL_STRTOLL + +/* Define to 1 if you have the declaration of `strtoull', and to 0 if you + don't. */ +#undef HAVE_DECL_STRTOULL + /* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you don't. */ #undef HAVE_DECL_SYS_SIGLIST diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32 index 76617e2ae27b05955333f42c057cd0d77e269ef7..ceffd782a53730e58b44f3f5338343f8a7c5e96b 100644 --- a/src/include/pg_config.h.win32 +++ b/src/include/pg_config.h.win32 @@ -102,6 +102,14 @@ don't. */ #define HAVE_DECL_SNPRINTF 1 +/* Define to 1 if you have the declaration of `strtoll', and to 0 if you + don't. */ +#define HAVE_DECL_STRTOLL 1 + +/* Define to 1 if you have the declaration of `strtoull', and to 0 if you + don't. */ +#define HAVE_DECL_STRTOULL 1 + /* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you don't. */ #define HAVE_DECL_VSNPRINTF 1