1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-05 20:58:40 +03:00

- added AC_HAVE_DECL() macro to aclocal.m4, so we can easily add

tests for a fn or variable being defined in headers
- used this to add prototypes for asprintf and vasprintf on systems
  that don't have them
This commit is contained in:
Andrew Tridgell -
parent 200b682e9b
commit ab24652394
6 changed files with 728 additions and 571 deletions

View File

@ -149,3 +149,7 @@
#undef HAVE_AIX_ACLS
#undef HAVE_NO_ACLS
#undef HAVE_LIBPAM
#undef HAVE_ASPRINTF_DECL
#undef HAVE_VASPRINTF_DECL
#undef HAVE_SNPRINTF_DECL
#undef HAVE_VSNPRINTF_DECL

14
source/aclocal.m4 vendored
View File

@ -49,6 +49,20 @@ fi
rm -f conftest*
])])
dnl see if a declaration exists for a function or variable
dnl defines HAVE_function_DECL if it exists
dnl AC_HAVE_DECL(var, includes)
AC_DEFUN(AC_HAVE_DECL,
[
AC_CACHE_CHECK([for $1 declaration],ac_cv_have_$1_decl,[
AC_TRY_COMPILE([$2],[int i = (int)$1],
ac_cv_have_$1_decl=yes,ac_cv_have_$1_decl=no)])
if test x"$ac_cv_have_$1_decl" = x"yes"; then
AC_DEFINE([HAVE_]translit([$1], [a-z], [A-Z])[_DECL])
fi
])
dnl check for a function in a library, but don't
dnl keep adding the same library to the LIBS variable.
dnl AC_LIBTESTFUNC(lib,func)

1241
source/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -322,28 +322,14 @@ if test x"$samba_cv_sig_atomic_t" = x"yes"; then
AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE)
fi
AC_CACHE_CHECK([for errno in errno.h],samba_cv_errno, [
AC_TRY_COMPILE([#include <errno.h>],[int i = errno],
samba_cv_errno=yes,samba_cv_have_errno=no)])
if test x"$samba_cv_errno" = x"yes"; then
AC_DEFINE(HAVE_ERRNO_DECL)
fi
# stupid glibc has the functions but no declaration. grrrr.
AC_CACHE_CHECK([for setresuid declaration],samba_cv_have_setresuid_decl,[
AC_TRY_COMPILE([#include <unistd.h>],[int i = (int)setresuid],
samba_cv_have_setresuid_decl=yes,samba_cv_have_setresuid_decl=no)])
if test x"$samba_cv_have_setresuid_decl" = x"yes"; then
AC_DEFINE(HAVE_SETRESUID_DECL)
fi
# stupid glibc has the functions but no declaration. grrrr.
AC_CACHE_CHECK([for setresgid declaration],samba_cv_have_setresgid_decl,[
AC_TRY_COMPILE([#include <unistd.h>],[int i = (int)setresgid],
samba_cv_have_setresgid_decl=yes,samba_cv_have_setresgid_decl=no)])
if test x"$samba_cv_have_setresgid_decl" = x"yes"; then
AC_DEFINE(HAVE_SETRESGID_DECL)
fi
# stupid headers have the functions but no declaration. grrrr.
AC_HAVE_DECL(errno, [#include <errno.h>])
AC_HAVE_DECL(setresuid, [#include <unistd.h>])
AC_HAVE_DECL(setresgid, [#include <unistd.h>])
AC_HAVE_DECL(asprintf, [#include <stdio.h>])
AC_HAVE_DECL(vasprintf, [#include <stdio.h>])
AC_HAVE_DECL(vsnprintf, [#include <stdio.h>])
AC_HAVE_DECL(snprintf, [#include <stdio.h>])
# and glibc has setresuid under linux but the function does
# nothing until kernel 2.1.44! very dumb.

View File

@ -212,6 +212,10 @@
#undef HAVE_AIX_ACLS
#undef HAVE_NO_ACLS
#undef HAVE_LIBPAM
#undef HAVE_ASPRINTF_DECL
#undef HAVE_VASPRINTF_DECL
#undef HAVE_SNPRINTF_DECL
#undef HAVE_VSNPRINTF_DECL
/* The number of bytes in a int. */
#undef SIZEOF_INT

View File

@ -865,6 +865,12 @@ int setresuid(uid_t ruid, uid_t euid, uid_t suid);
#if (defined(USE_SETRESUID) && !defined(HAVE_SETRESGID_DECL))
int setresgid(gid_t rgid, gid_t egid, gid_t sgid);
#endif
#ifndef HAVE_ASPRINTF_DECL
int asprintf(char **ptr, const char *format, ...);
#endif
#ifndef HAVE_VASPRINTF_DECL
int vasprintf(char **ptr, const char *format, va_list ap);
#endif
#if !defined(HAVE_BZERO) && defined(HAVE_MEMSET)
#define bzero(a,b) memset((a),'\0',(b))