1 AC_CHECK_HEADERS([stdint.h inttypes.h])
2 AC_CHECK_TYPE(uint_t, unsigned int)
3 AC_CHECK_TYPE(int8_t, signed char)
4 AC_CHECK_TYPE(uint8_t, unsigned char)
5 AC_CHECK_TYPE(int16_t, short)
6 AC_CHECK_TYPE(uint16_t, unsigned short)
7 AC_CHECK_TYPE(int32_t, long)
8 AC_CHECK_TYPE(uint32_t, unsigned long)
9 AC_CHECK_TYPE(int64_t, long long)
10 AC_CHECK_TYPE(uint64_t, unsigned long long)
11 AC_CHECK_TYPE(u_int32_t, unsigned long)
12 AC_CHECK_TYPE(u_int16_t, unsigned short)
13 AC_CHECK_TYPE(u_int8_t, unsigned char)
14 AC_CHECK_TYPE(ssize_t, int)
15 AC_CHECK_TYPE(comparison_fn_t,
16 [AC_DEFINE(HAVE_COMPARISON_FN_T, 1,[Whether or not we have comparison_fn_t])])
18 AC_CACHE_CHECK([for broken inet_ntoa],samba_cv_REPLACE_INET_NTOA,[
21 #include <sys/types.h>
22 #include <netinet/in.h>
23 #ifdef HAVE_ARPA_INET_H
24 #include <arpa/inet.h>
26 main() { struct in_addr ip; ip.s_addr = 0x12345678;
27 if (strcmp(inet_ntoa(ip),"18.52.86.120") &&
28 strcmp(inet_ntoa(ip),"120.86.52.18")) { exit(0); }
30 samba_cv_REPLACE_INET_NTOA=yes,samba_cv_REPLACE_INET_NTOA=no,samba_cv_REPLACE_INET_NTOA=cross)])
31 if test x"$samba_cv_REPLACE_INET_NTOA" = x"yes"; then
32 AC_DEFINE(REPLACE_INET_NTOA,1,[Whether inet_ntoa should be replaced])
35 dnl Provided by replace.c:
37 #include <sys/types.h>
42 #include <sys/socket.h>],
44 [AC_DEFINE(socklen_t, int,[Socket length type])])
46 AC_CHECK_HEADERS(sys/syslog.h syslog.h)
47 AC_CHECK_FUNCS(strtoull __strtoull strtouq strtoll __strtoll strtoq)
48 AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror)
49 AC_CHECK_FUNCS(timegm setenv vsyslog setlinebuf mktime ftruncate chsize rename)
50 AC_CHECK_FUNCS(waitpid strnlen strlcpy strlcat innetgr initgroups memmove strdup)
51 AC_CHECK_FUNCS(pread pwrite strndup strcasestr)
52 AC_HAVE_DECL(setresuid, [#include <unistd.h>])
53 AC_HAVE_DECL(setresgid, [#include <unistd.h>])
54 AC_HAVE_DECL(errno, [#include <errno.h>])
56 AC_CACHE_CHECK([for secure mkstemp],samba_cv_HAVE_SECURE_MKSTEMP,[
57 AC_TRY_RUN([#include <stdlib.h>
58 #include <sys/types.h>
63 char tpl[20]="/tmp/test.XXXXXX";
64 int fd = mkstemp(tpl);
65 if (fd == -1) exit(1);
67 if (fstat(fd, &st) != 0) exit(1);
68 if ((st.st_mode & 0777) != 0600) exit(1);
71 samba_cv_HAVE_SECURE_MKSTEMP=yes,
72 samba_cv_HAVE_SECURE_MKSTEMP=no,
73 samba_cv_HAVE_SECURE_MKSTEMP=cross)])
74 if test x"$samba_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
75 AC_DEFINE(HAVE_SECURE_MKSTEMP,1,[Whether mkstemp is secure])
78 dnl Provided by snprintf.c:
79 AC_HAVE_DECL(asprintf, [#include <stdio.h>])
80 AC_HAVE_DECL(vasprintf, [#include <stdio.h>])
81 AC_HAVE_DECL(vsnprintf, [#include <stdio.h>])
82 AC_HAVE_DECL(snprintf, [#include <stdio.h>])
83 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
85 AC_CACHE_CHECK([for C99 vsnprintf],samba_cv_HAVE_C99_VSNPRINTF,[
87 #include <sys/types.h>
89 void foo(const char *format, ...) {
93 long long l = 1234567890;
97 len = vsnprintf(buf, 0, format, ap);
99 if (len != 5) exit(1);
101 va_start(ap, format);
102 len = vsnprintf(0, 0, format, ap);
104 if (len != 5) exit(1);
106 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
108 if (snprintf(buf, 20, "%lld", l) != 12 || strcmp(buf, "123456789000") != 0) exit(1);
112 main() { foo("hello"); }
114 samba_cv_HAVE_C99_VSNPRINTF=yes,samba_cv_HAVE_C99_VSNPRINTF=no,samba_cv_HAVE_C99_VSNPRINTF=cross)])
115 if test x"$samba_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
116 AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Whether there is a C99 compliant vsnprintf])
119 dnl Provided by dlfcn.c:
120 AC_SEARCH_LIBS_EXT(dlopen, [dl], DL_LIBS)
121 SMB_EXT_LIB(DL,[${DL_LIBS}],[${DL_CFLAGS}],[${DL_CPPFLAGS}],[${DL_LDFLAGS}])
123 LIBS="$LIBS $DL_LIBS"
124 AC_CHECK_HEADERS(dlfcn.h)
125 AC_CHECK_FUNCS(dlopen dlsym dlerror dlclose)
128 AC_CHECK_FUNCS([syslog memset setnetgrent getnetgrent endnetgrent memcpy],,
129 [AC_MSG_ERROR([Required function not found])])
131 AC_CHECK_HEADERS(stdbool.h)
133 sinclude(lib/replace/readline.m4)
134 sinclude(lib/replace/getpass.m4)