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)
14 AC_CHECK_TYPE(comparison_fn_t,
15 [AC_DEFINE(HAVE_COMPARISON_FN_T, 1,[Whether or not we have comparison_fn_t])])
17 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
20 #include <sys/types.h>
21 #include <netinet/in.h>
22 #ifdef HAVE_ARPA_INET_H
23 #include <arpa/inet.h>
25 main() { struct in_addr ip; ip.s_addr = 0x12345678;
26 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
27 strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); }
29 samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
30 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
31 AC_DEFINE(REPLACE_INET_NTOA,1,[Whether inet_ntoa should be replaced])
34 dnl Provided by replace.c:
36 #include <sys/types.h>
41 #include <sys/socket.h>],
43 [AC_DEFINE(socklen_t, int,[Socket length type])])
45 AC_CHECK_HEADERS(sys/syslog.h syslog.h)
46 AC_CHECK_FUNCS(strtoull __strtoull strtouq strtoll __strtoll strtoq)
47 AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror)
48 AC_CHECK_FUNCS(timegm setenv vsyslog setlinebuf mktime ftruncate chsize rename)
49 AC_CHECK_FUNCS(waitpid strnlen strlcpy strlcat innetgr initgroups memmove strdup)
50 AC_CHECK_FUNCS(pread pwrite strndup strcasestr)
51 AC_HAVE_DECL(setresuid, [#include <unistd.h>])
52 AC_HAVE_DECL(setresgid, [#include <unistd.h>])
53 AC_HAVE_DECL(errno, [#include <errno.h>])
55 AC_CACHE_CHECK([for secure mkstemp],samba_cv_HAVE_SECURE_MKSTEMP,[
56 AC_TRY_RUN([#include <stdlib.h>
57 #include <sys/types.h>
62 char tpl[20]="/tmp/test.XXXXXX";
63 int fd = mkstemp(tpl);
64 if (fd == -1) exit(1);
66 if (fstat(fd, &st) != 0) exit(1);
67 if ((st.st_mode & 0777) != 0600) exit(1);
70 samba_cv_HAVE_SECURE_MKSTEMP=yes,
71 samba_cv_HAVE_SECURE_MKSTEMP=no,
72 samba_cv_HAVE_SECURE_MKSTEMP=cross)])
73 if test x"$samba_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
74 AC_DEFINE(HAVE_SECURE_MKSTEMP,1,[Whether mkstemp is secure])
77 dnl Provided by snprintf.c:
78 AC_HAVE_DECL(asprintf, [#include <stdio.h>])
79 AC_HAVE_DECL(vasprintf, [#include <stdio.h>])
80 AC_HAVE_DECL(vsnprintf, [#include <stdio.h>])
81 AC_HAVE_DECL(snprintf, [#include <stdio.h>])
82 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
84 AC_CACHE_CHECK([for C99 vsnprintf],samba_cv_HAVE_C99_VSNPRINTF,[
86 #include <sys/types.h>
88 void foo(const char *format, ...) {
92 long long l = 1234567890;
96 len = vsnprintf(buf, 0, format, ap);
98 if (len != 5) exit(1);
100 va_start(ap, format);
101 len = vsnprintf(0, 0, format, ap);
103 if (len != 5) exit(1);
105 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
107 if (snprintf(buf, 20, "%lld", l) != 12 || strcmp(buf, "123456789000") != 0) exit(1);
111 main() { foo("hello"); }
113 samba_cv_HAVE_C99_VSNPRINTF=yes,samba_cv_HAVE_C99_VSNPRINTF=no,samba_cv_HAVE_C99_VSNPRINTF=cross)])
114 if test x"$samba_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
115 AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Whether there is a C99 compliant vsnprintf])
118 dnl Provided by dlfcn.c:
119 AC_SEARCH_LIBS_EXT(dlopen, [dl], DL_LIBS)
120 SMB_EXT_LIB(DL,[${DL_LIBS}],[${DL_CFLAGS}],[${DL_CPPFLAGS}],[${DL_LDFLAGS}])
122 LIBS="$LIBS $DL_LIBS"
123 AC_CHECK_HEADERS(dlfcn.h)
124 AC_CHECK_FUNCS(dlopen dlsym dlerror dlclose)
127 AC_CHECK_FUNCS([syslog memset setnetgrent getnetgrent endnetgrent memcpy],,
128 [AC_MSG_ERROR([Required function not found])])
130 sinclude(lib/replace/readline.m4)
131 sinclude(lib/replace/getpass.m4)