1 AC_CHECK_TYPE(uint_t, unsigned int)
2 AC_CHECK_TYPE(int8_t, signed char)
3 AC_CHECK_TYPE(uint8_t, unsigned char)
4 AC_CHECK_TYPE(int16_t, short)
5 AC_CHECK_TYPE(uint16_t, unsigned short)
6 AC_CHECK_TYPE(int32_t, long)
7 AC_CHECK_TYPE(uint32_t, unsigned long)
8 AC_CHECK_TYPE(int64_t, long long)
9 AC_CHECK_TYPE(uint64_t, unsigned long long)
10 AC_CHECK_TYPE(u_int32_t, unsigned long)
11 AC_CHECK_TYPE(u_int16_t, unsigned short)
12 AC_CHECK_TYPE(u_int8_t, unsigned char)
13 AC_CHECK_TYPE(ssize_t, int)
15 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
18 #include <sys/types.h>
19 #include <netinet/in.h>
20 #ifdef HAVE_ARPA_INET_H
21 #include <arpa/inet.h>
23 main() { struct in_addr ip; ip.s_addr = 0x12345678;
24 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
25 strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); }
27 samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
28 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
29 AC_DEFINE(REPLACE_INET_NTOA,1,[Whether inet_ntoa should be replaced])
32 dnl Provided by replace.c:
33 AC_CHECK_TYPE([socklen_t], int)
34 AC_CHECK_HEADERS(sys/syslog.h syslog.h)
35 AC_CHECK_FUNCS(strtoull __strtoull strtouq strtoll __strtoll strtoq)
36 AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror)
37 AC_CHECK_FUNCS(timegm setenv vsyslog setlinebuf mktime ftruncate chsize rename)
38 AC_CHECK_FUNCS(waitpid strnlen strlcpy strlcat innetgr initgroups memmove strdup)
39 AC_CHECK_FUNCS(pread pwrite strndup)
40 AC_HAVE_DECL(setresuid, [#include <unistd.h>])
41 AC_HAVE_DECL(setresgid, [#include <unistd.h>])
42 AC_HAVE_DECL(errno, [#include <errno.h>])
44 AC_CACHE_CHECK([for secure mkstemp],samba_cv_HAVE_SECURE_MKSTEMP,[
45 AC_TRY_RUN([#include <stdlib.h>
46 #include <sys/types.h>
51 char tpl[20]="/tmp/test.XXXXXX";
52 int fd = mkstemp(tpl);
53 if (fd == -1) exit(1);
55 if (fstat(fd, &st) != 0) exit(1);
56 if ((st.st_mode & 0777) != 0600) exit(1);
59 samba_cv_HAVE_SECURE_MKSTEMP=yes,
60 samba_cv_HAVE_SECURE_MKSTEMP=no,
61 samba_cv_HAVE_SECURE_MKSTEMP=cross)])
62 if test x"$samba_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
63 AC_DEFINE(HAVE_SECURE_MKSTEMP,1,[Whether mkstemp is secure])
66 dnl Provided by snprintf.c:
67 AC_HAVE_DECL(asprintf, [#include <stdio.h>])
68 AC_HAVE_DECL(vasprintf, [#include <stdio.h>])
69 AC_HAVE_DECL(vsnprintf, [#include <stdio.h>])
70 AC_HAVE_DECL(snprintf, [#include <stdio.h>])
71 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
73 AC_CACHE_CHECK([for C99 vsnprintf],samba_cv_HAVE_C99_VSNPRINTF,[
75 #include <sys/types.h>
77 void foo(const char *format, ...) {
81 long long l = 1234567890;
85 len = vsnprintf(buf, 0, format, ap);
87 if (len != 5) exit(1);
90 len = vsnprintf(0, 0, format, ap);
92 if (len != 5) exit(1);
94 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
96 if (snprintf(buf, 20, "%lld", l) != 12 || strcmp(buf, "123456789000") != 0) exit(1);
100 main() { foo("hello"); }
102 samba_cv_HAVE_C99_VSNPRINTF=yes,samba_cv_HAVE_C99_VSNPRINTF=no,samba_cv_HAVE_C99_VSNPRINTF=cross)])
103 if test x"$samba_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
104 AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Whether there is a C99 compliant vsnprintf])
107 dnl Provided by dlfcn.c:
108 AC_SEARCH_LIBS_EXT(dlopen, [dl], DL_LIBS)
109 SMB_EXT_LIB(DL,[${DL_LIBS}],[${DL_CFLAGS}],[${DL_CPPFLAGS}],[${DL_LDFLAGS}])
111 LIBS="$LIBS $DL_LIBS"
112 AC_CHECK_HEADERS(dlfcn.h)
113 AC_CHECK_FUNCS(dlopen dlsym dlerror dlclose)
116 AC_CHECK_FUNCS([syslog memset setnetgrent getnetgrent endnetgrent memcpy],,
117 [AC_MSG_ERROR([Required function not found])])