diff options
author | Volker Lendecke <vlendec@samba.org> | 2006-09-13 09:32:24 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:51:42 -0500 |
commit | 6f47ed234a743772e72fa7985f5fb8559f23dbb4 (patch) | |
tree | 5c222db16fe8cd502e327f4dd3f01b46b0628af6 | |
parent | 8c2c5c5d1d3ccbb9f3bab9136c23d1020e4e20f1 (diff) | |
download | samba-6f47ed234a743772e72fa7985f5fb8559f23dbb4.tar.gz samba-6f47ed234a743772e72fa7985f5fb8559f23dbb4.tar.bz2 samba-6f47ed234a743772e72fa7985f5fb8559f23dbb4.zip |
r18449: Attempt to fix the build on non-linux platforms: Many of those don't have
strtoull. This is a copy of the stuff in samba4 libreplace, which is GPL. I
hope it is ok to copy&paste it into a GPL file. Tridge, we could also create a
replace_lpgl.c if needed.
Volker
(This used to be commit f8346687d950ed643e8fa7d0b1a9c27f2880cc85)
-rw-r--r-- | source3/configure.in | 2 | ||||
-rw-r--r-- | source3/lib/replace.c | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/source3/configure.in b/source3/configure.in index 160791eff7..fe994e2ece 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -1274,7 +1274,7 @@ if test x"$ac_cv_func_execl" = x"no"; then fi AC_CHECK_FUNCS(dlopen dlclose dlsym dlerror waitpid getcwd strdup strndup strnlen strerror chown fchown chmod fchmod chroot link mknod mknod64) -AC_CHECK_FUNCS(strtol strtoll strtoul strtoull) +AC_CHECK_FUNCS(strtol strtoll strtoul strtoull strtouq __strtoull) AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync memset strlcpy strlcat setpgid) AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid) AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent) diff --git a/source3/lib/replace.c b/source3/lib/replace.c index 19b37af938..38f0af24d9 100644 --- a/source3/lib/replace.c +++ b/source3/lib/replace.c @@ -415,6 +415,21 @@ char *rep_inet_ntoa(struct in_addr ip) } #endif /* HAVE_STRTOUL */ +#ifndef HAVE_STRTOULL +unsigned long long int rep_strtoull(const char *str, char **endptr, int base) +{ +#ifdef HAVE_STRTOUQ + return strtouq(str, endptr, base); +#elif defined(HAVE___STRTOULL) + return __strtoull(str, endptr, base); +#elif SIZEOF_LONG == SIZEOF_LONG_LONG + return (unsigned long long int) strtoul(str, endptr, base); +#else +# error "You need a strtoull function" +#endif +} +#endif + #ifndef HAVE_SETLINEBUF int setlinebuf(FILE *stream) { |