Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: third_party/talloc/libreplace/libreplace.m4

Issue 2282793002: Remove unused third_party/talloc (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 AC_DEFUN_ONCE(AC_LIBREPLACE_LOCATION_CHECKS,
2 [
3 echo "LIBREPLACE_LOCATION_CHECKS: START"
4
5 dnl find the libreplace sources. This is meant to work both for
6 dnl libreplace standalone builds, and builds of packages using libreplace
7 libreplacedir=""
8 libreplacepaths="$srcdir $srcdir/lib/replace $srcdir/libreplace $srcdir/../libre place $srcdir/../replace $srcdir/../lib/replace $srcdir/../../../lib/replace"
9 for d in $libreplacepaths; do
10 if test -f "$d/replace.c"; then
11 libreplacedir="$d"
12 AC_SUBST(libreplacedir)
13 break;
14 fi
15 done
16 if test x"$libreplacedir" = "x"; then
17 AC_MSG_ERROR([cannot find libreplace in $libreplacepaths])
18 fi
19 LIBREPLACEOBJ="$libreplacedir/replace.o"
20 AC_SUBST(LIBREPLACEOBJ)
21
22 AC_CANONICAL_BUILD
23 AC_CANONICAL_HOST
24 AC_CANONICAL_TARGET
25
26 echo "LIBREPLACE_LOCATION_CHECKS: END"
27 ]) dnl end AC_LIBREPLACE_LOCATION_CHECKS
28
29
30 AC_DEFUN_ONCE(AC_LIBREPLACE_BROKEN_CHECKS,
31 [
32 echo "LIBREPLACE_BROKEN_CHECKS: START"
33
34 dnl find the libreplace sources. This is meant to work both for
35 dnl libreplace standalone builds, and builds of packages using libreplace
36 libreplacedir=""
37 libreplacepaths="$srcdir $srcdir/lib/replace $srcdir/libreplace $srcdir/../libre place $srcdir/../replace $srcdir/../lib/replace $srcdir/../../../lib/replace"
38 for d in $libreplacepaths; do
39 if test -f "$d/replace.c"; then
40 libreplacedir="$d"
41 AC_SUBST(libreplacedir)
42 break;
43 fi
44 done
45 if test x"$libreplacedir" = "x"; then
46 AC_MSG_ERROR([cannot find libreplace in $libreplacepaths])
47 fi
48
49 LIBREPLACEOBJ="$libreplacedir/replace.o"
50 AC_SUBST(LIBREPLACEOBJ)
51
52 LIBREPLACEOBJ="${LIBREPLACEOBJ} $libreplacedir/snprintf.o"
53
54 AC_TYPE_SIGNAL
55 AC_TYPE_UID_T
56 AC_TYPE_MODE_T
57 AC_TYPE_OFF_T
58 AC_TYPE_SIZE_T
59 AC_TYPE_PID_T
60 AC_STRUCT_ST_RDEV
61 AC_CHECK_TYPE(ino_t,unsigned)
62 AC_CHECK_TYPE(loff_t,off_t)
63 AC_CHECK_TYPE(offset_t,loff_t)
64
65 AC_FUNC_MEMCMP
66
67 AC_CHECK_FUNCS([pipe strftime srandom random srand rand usleep setbuffer lstat g etpgrp utime utimes])
68
69 AC_CHECK_HEADERS(stdbool.h stdint.h sys/select.h)
70 AC_CHECK_HEADERS(setjmp.h utime.h)
71
72 LIBREPLACE_PROVIDE_HEADER([stdint.h])
73 LIBREPLACE_PROVIDE_HEADER([stdbool.h])
74
75 AC_CHECK_TYPE(bool,
76 [AC_DEFINE(HAVE_BOOL, 1, [Whether the bool type is available])],,
77 [
78 AC_INCLUDES_DEFAULT
79 #ifdef HAVE_STDBOOL_H
80 #include <stdbool.h>
81 #endif]
82 )
83
84 AC_CHECK_TYPE(_Bool,
85 [AC_DEFINE(HAVE__Bool, 1, [Whether the _Bool type is available])],,
86 [
87 AC_INCLUDES_DEFAULT
88 #ifdef HAVE_STDBOOL_H
89 #include <stdbool.h>
90 #endif]
91 )
92
93 AC_CACHE_CHECK([for working mmap],libreplace_cv_HAVE_MMAP,[
94 AC_TRY_RUN([#include "$libreplacedir/test/shared_mmap.c"],
95 libreplace_cv_HAVE_MMAP=yes,libreplace_cv_HAVE_MMAP=no,libreplace_cv_ HAVE_MMAP=cross)])
96 if test x"$libreplace_cv_HAVE_MMAP" = x"yes"; then
97 AC_DEFINE(HAVE_MMAP,1,[Whether mmap works])
98 fi
99
100
101 AC_CHECK_HEADERS(sys/syslog.h syslog.h)
102 AC_CHECK_HEADERS(sys/time.h time.h)
103 AC_CHECK_HEADERS(stdarg.h vararg.h)
104 AC_CHECK_HEADERS(sys/mount.h mntent.h)
105 AC_CHECK_HEADERS(stropts.h)
106 AC_CHECK_HEADERS(unix.h)
107
108 AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror)
109 AC_CHECK_FUNCS(vsyslog setlinebuf mktime ftruncate chsize rename)
110 AC_CHECK_FUNCS(waitpid wait4 strlcpy strlcat initgroups memmove strdup)
111 AC_CHECK_FUNCS(pread pwrite strndup strcasestr strtok_r mkdtemp dup2)
112 AC_CHECK_FUNCS(isatty chown lchown link readlink symlink realpath)
113 AC_HAVE_DECL(setresuid, [#include <unistd.h>])
114 AC_HAVE_DECL(setresgid, [#include <unistd.h>])
115 AC_HAVE_DECL(errno, [#include <errno.h>])
116
117 AC_CACHE_CHECK([for secure mkstemp],libreplace_cv_HAVE_SECURE_MKSTEMP,[
118 AC_TRY_RUN([#include <stdlib.h>
119 #include <sys/types.h>
120 #include <sys/stat.h>
121 #include <unistd.h>
122 main() {
123 struct stat st;
124 char tpl[20]="/tmp/test.XXXXXX";
125 int fd = mkstemp(tpl);
126 if (fd == -1) exit(1);
127 unlink(tpl);
128 if (fstat(fd, &st) != 0) exit(1);
129 if ((st.st_mode & 0777) != 0600) exit(1);
130 exit(0);
131 }],
132 libreplace_cv_HAVE_SECURE_MKSTEMP=yes,
133 libreplace_cv_HAVE_SECURE_MKSTEMP=no,
134 libreplace_cv_HAVE_SECURE_MKSTEMP=cross)])
135 if test x"$libreplace_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
136 AC_DEFINE(HAVE_SECURE_MKSTEMP,1,[Whether mkstemp is secure])
137 fi
138
139 dnl Provided by snprintf.c:
140 AC_CHECK_HEADERS(stdio.h strings.h)
141 AC_CHECK_DECLS([snprintf, vsnprintf, asprintf, vasprintf])
142 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
143
144 AC_CACHE_CHECK([for C99 vsnprintf],libreplace_cv_HAVE_C99_VSNPRINTF,[
145 AC_TRY_RUN([
146 #include <sys/types.h>
147 #include <stdio.h>
148 #include <stdarg.h>
149 #include <stdlib.h>
150 void foo(const char *format, ...) {
151 va_list ap;
152 int len;
153 char buf[20];
154 long long l = 1234567890;
155 l *= 100;
156
157 va_start(ap, format);
158 len = vsnprintf(buf, 0, format, ap);
159 va_end(ap);
160 if (len != 5) exit(1);
161
162 va_start(ap, format);
163 len = vsnprintf(0, 0, format, ap);
164 va_end(ap);
165 if (len != 5) exit(2);
166
167 if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(3);
168
169 if (snprintf(buf, 20, "%lld", l) != 12 || strcmp(buf, "123456789000") != 0) exit(4);
170 if (snprintf(buf, 20, "%zu", 123456789) != 9 || strcmp(buf, "123456789") != 0) exit(5);
171 if (snprintf(buf, 20, "%2\$d %1\$d", 3, 4) != 3 || strcmp(buf, "4 3") != 0) exit(6);
172 if (snprintf(buf, 20, "%s", 0) < 3) exit(7);
173
174 exit(0);
175 }
176 main() { foo("hello"); }
177 ],
178 libreplace_cv_HAVE_C99_VSNPRINTF=yes,libreplace_cv_HAVE_C99_VSNPRINTF=no,librepl ace_cv_HAVE_C99_VSNPRINTF=cross)])
179 if test x"$libreplace_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
180 AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Whether there is a C99 compliant vsnprintf])
181 fi
182
183
184 dnl VA_COPY
185 AC_CACHE_CHECK([for va_copy],libreplace_cv_HAVE_VA_COPY,[
186 AC_TRY_LINK([#include <stdarg.h>
187 va_list ap1,ap2;], [va_copy(ap1,ap2);],
188 libreplace_cv_HAVE_VA_COPY=yes,libreplace_cv_HAVE_VA_COPY=no)])
189 if test x"$libreplace_cv_HAVE_VA_COPY" = x"yes"; then
190 AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
191 fi
192
193 if test x"$libreplace_cv_HAVE_VA_COPY" != x"yes"; then
194 AC_CACHE_CHECK([for __va_copy],libreplace_cv_HAVE___VA_COPY,[
195 AC_TRY_LINK([#include <stdarg.h>
196 va_list ap1,ap2;], [__va_copy(ap1,ap2);],
197 libreplace_cv_HAVE___VA_COPY=yes,libreplace_cv_HAVE___VA_COPY=no)])
198 if test x"$libreplace_cv_HAVE___VA_COPY" = x"yes"; then
199 AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
200 fi
201 fi
202
203 dnl __FUNCTION__ macro
204 AC_CACHE_CHECK([for __FUNCTION__ macro],libreplace_cv_HAVE_FUNCTION_MACRO,[
205 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __FUNCTION__);],
206 libreplace_cv_HAVE_FUNCTION_MACRO=yes,libreplace_cv_HAVE_FUNCTION_MACRO=no)])
207 if test x"$libreplace_cv_HAVE_FUNCTION_MACRO" = x"yes"; then
208 AC_DEFINE(HAVE_FUNCTION_MACRO,1,[Whether there is a __FUNCTION__ macro])
209 else
210 dnl __func__ macro
211 AC_CACHE_CHECK([for __func__ macro],libreplace_cv_HAVE_func_MACRO,[
212 AC_TRY_COMPILE([#include <stdio.h>], [printf("%s\n", __func__);],
213 libreplace_cv_HAVE_func_MACRO=yes,libreplace_cv_HAVE_func_MACRO=no)])
214 if test x"$libreplace_cv_HAVE_func_MACRO" = x"yes"; then
215 AC_DEFINE(HAVE_func_MACRO,1,[Whether there is a __func__ macro])
216 fi
217 fi
218
219 AC_CHECK_HEADERS([sys/param.h limits.h])
220
221 AC_CHECK_TYPE(comparison_fn_t,
222 [AC_DEFINE(HAVE_COMPARISON_FN_T, 1,[Whether or not we have comparison_fn_t])])
223
224 AC_HAVE_DECL(setenv, [#include <stdlib.h>])
225 AC_CHECK_FUNCS(setenv unsetenv)
226 AC_HAVE_DECL(environ, [#include <unistd.h>])
227
228 AC_CHECK_FUNCS(strnlen)
229 AC_CHECK_FUNCS(strtoull __strtoull strtouq strtoll __strtoll strtoq)
230
231 # this test disabled as we don't actually need __VA_ARGS__ yet
232 AC_TRY_CPP([
233 #define eprintf(...) fprintf(stderr, __VA_ARGS__)
234 eprintf("bla", "bar");
235 ], AC_DEFINE(HAVE__VA_ARGS__MACRO, 1, [Whether the __VA_ARGS__ macro is availabl e]))
236
237
238 AC_CACHE_CHECK([for sig_atomic_t type],libreplace_cv_sig_atomic_t, [
239 AC_TRY_COMPILE([
240 #include <sys/types.h>
241 #if STDC_HEADERS
242 #include <stdlib.h>
243 #include <stddef.h>
244 #endif
245 #include <signal.h>],[sig_atomic_t i = 0],
246 libreplace_cv_sig_atomic_t=yes,libreplace_cv_sig_atomic_t=no)])
247 if test x"$libreplace_cv_sig_atomic_t" = x"yes"; then
248 AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE,1,[Whether we have the atomic_t variable typ e])
249 fi
250
251
252 AC_CACHE_CHECK([for O_DIRECT flag to open(2)],libreplace_cv_HAVE_OPEN_O_DIRECT,[
253 AC_TRY_COMPILE([
254 #include <unistd.h>
255 #ifdef HAVE_FCNTL_H
256 #include <fcntl.h>
257 #endif],
258 [int fd = open("/dev/null", O_DIRECT);],
259 libreplace_cv_HAVE_OPEN_O_DIRECT=yes,libreplace_cv_HAVE_OPEN_O_DIRECT=no)])
260 if test x"$libreplace_cv_HAVE_OPEN_O_DIRECT" = x"yes"; then
261 AC_DEFINE(HAVE_OPEN_O_DIRECT,1,[Whether the open(2) accepts O_DIRECT])
262 fi
263
264
265 dnl Check if the C compiler understands volatile (it should, being ANSI).
266 AC_CACHE_CHECK([that the C compiler understands volatile],libreplace_cv_volatile , [
267 AC_TRY_COMPILE([#include <sys/types.h>],[volatile int i = 0],
268 libreplace_cv_volatile=yes,libreplace_cv_volatile=no)])
269 if test x"$libreplace_cv_volatile" = x"yes"; then
270 AC_DEFINE(HAVE_VOLATILE, 1, [Whether the C compiler understands volatile ])
271 fi
272
273 m4_include(system/config.m4)
274
275 m4_include(dlfcn.m4)
276 m4_include(getpass.m4)
277 m4_include(strptime.m4)
278 m4_include(win32.m4)
279 m4_include(timegm.m4)
280 m4_include(repdir.m4)
281 m4_include(crypt.m4)
282
283 AC_CHECK_FUNCS([printf memset memcpy],,[AC_MSG_ERROR([Required function not foun d])])
284
285 echo "LIBREPLACE_BROKEN_CHECKS: END"
286 ]) dnl end AC_LIBREPLACE_BROKEN_CHECKS
287
288 AC_DEFUN_ONCE(AC__LIBREPLACE_ALL_CHECKS_START,
289 [
290 #LIBREPLACE_ALL_CHECKS: START"
291 ])
292 AC_DEFUN_ONCE(AC__LIBREPLACE_ALL_CHECKS_END,
293 [
294 #LIBREPLACE_ALL_CHECKS: END"
295 ])
296 m4_define(AC_LIBREPLACE_ALL_CHECKS,
297 [
298 AC__LIBREPLACE_ALL_CHECKS_START
299 AC_LIBREPLACE_LOCATION_CHECKS
300 AC_LIBREPLACE_CC_CHECKS
301 AC_LIBREPLACE_BROKEN_CHECKS
302 AC__LIBREPLACE_ALL_CHECKS_END
303 CFLAGS="$CFLAGS -I$libreplacedir"
304 ])
305
306 m4_include(libreplace_cc.m4)
307 m4_include(libreplace_ld.m4)
308 m4_include(libreplace_network.m4)
309 m4_include(libreplace_macros.m4)
310
311 m4_ifndef([AC_USE_SYSTEM_EXTENSIONS],[m4_include(autoconf-2.60.m4)])
OLDNEW
« no previous file with comments | « third_party/talloc/libreplace/install-sh ('k') | third_party/talloc/libreplace/libreplace_cc.m4 » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698