tarruby 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. data/README.txt +99 -0
  2. data/ext/extconf.rb +19 -0
  3. data/ext/libtar/COPYRIGHT +35 -0
  4. data/ext/libtar/ChangeLog +243 -0
  5. data/ext/libtar/ChangeLog-1.0.x +141 -0
  6. data/ext/libtar/INSTALL +183 -0
  7. data/ext/libtar/Makefile.in +51 -0
  8. data/ext/libtar/README +121 -0
  9. data/ext/libtar/TODO +10 -0
  10. data/ext/libtar/autoconf/ac_path_generic.m4 +136 -0
  11. data/ext/libtar/autoconf/aclocal.m4 +199 -0
  12. data/ext/libtar/autoconf/encap.m4 +133 -0
  13. data/ext/libtar/autoconf/install-sh +251 -0
  14. data/ext/libtar/autom4te.cache/output.0 +8102 -0
  15. data/ext/libtar/autom4te.cache/requests +112 -0
  16. data/ext/libtar/autom4te.cache/traces.0 +382 -0
  17. data/ext/libtar/compat/ChangeLog +31 -0
  18. data/ext/libtar/compat/README +12 -0
  19. data/ext/libtar/compat/TODO +4 -0
  20. data/ext/libtar/compat/basename.c +91 -0
  21. data/ext/libtar/compat/compat.h +260 -0
  22. data/ext/libtar/compat/dirname.c +96 -0
  23. data/ext/libtar/compat/fnmatch.c +237 -0
  24. data/ext/libtar/compat/gethostbyname_r.c +41 -0
  25. data/ext/libtar/compat/gethostname.c +36 -0
  26. data/ext/libtar/compat/getservbyname_r.c +41 -0
  27. data/ext/libtar/compat/glob.c +898 -0
  28. data/ext/libtar/compat/inet_aton.c +27 -0
  29. data/ext/libtar/compat/module.ac +591 -0
  30. data/ext/libtar/compat/snprintf.c +788 -0
  31. data/ext/libtar/compat/strdup.c +62 -0
  32. data/ext/libtar/compat/strlcat.c +72 -0
  33. data/ext/libtar/compat/strlcpy.c +68 -0
  34. data/ext/libtar/compat/strmode.c +199 -0
  35. data/ext/libtar/compat/strrstr.c +40 -0
  36. data/ext/libtar/compat/strsep.c +87 -0
  37. data/ext/libtar/config.h.in +187 -0
  38. data/ext/libtar/configure +8102 -0
  39. data/ext/libtar/configure.ac +114 -0
  40. data/ext/libtar/doc/Makefile.in +152 -0
  41. data/ext/libtar/doc/tar_append_file.3 +50 -0
  42. data/ext/libtar/doc/tar_block_read.3 +24 -0
  43. data/ext/libtar/doc/tar_extract_all.3 +43 -0
  44. data/ext/libtar/doc/tar_extract_file.3 +84 -0
  45. data/ext/libtar/doc/tar_open.3 +97 -0
  46. data/ext/libtar/doc/th_get_pathname.3 +63 -0
  47. data/ext/libtar/doc/th_print_long_ls.3 +22 -0
  48. data/ext/libtar/doc/th_read.3 +34 -0
  49. data/ext/libtar/doc/th_set_from_stat.3 +45 -0
  50. data/ext/libtar/lib/Makefile.in +92 -0
  51. data/ext/libtar/lib/append.c +272 -0
  52. data/ext/libtar/lib/block.c +384 -0
  53. data/ext/libtar/lib/decode.c +130 -0
  54. data/ext/libtar/lib/encode.c +237 -0
  55. data/ext/libtar/lib/extract.c +656 -0
  56. data/ext/libtar/lib/handle.c +150 -0
  57. data/ext/libtar/lib/internal.h +46 -0
  58. data/ext/libtar/lib/libtar.h +311 -0
  59. data/ext/libtar/lib/output.c +146 -0
  60. data/ext/libtar/lib/util.c +153 -0
  61. data/ext/libtar/lib/wrapper.c +175 -0
  62. data/ext/libtar/libtar/Makefile.in +73 -0
  63. data/ext/libtar/libtar/libtar.c +363 -0
  64. data/ext/libtar/listhash/ChangeLog +15 -0
  65. data/ext/libtar/listhash/TODO +21 -0
  66. data/ext/libtar/listhash/hash.c.in +344 -0
  67. data/ext/libtar/listhash/hash_new.3.in +74 -0
  68. data/ext/libtar/listhash/list.c.in +458 -0
  69. data/ext/libtar/listhash/list_new.3.in +86 -0
  70. data/ext/libtar/listhash/listhash.h.in +196 -0
  71. data/ext/libtar/listhash/module.ac +21 -0
  72. data/ext/libtar/win32/config.h +190 -0
  73. data/ext/libtar/win32/dirent.c +115 -0
  74. data/ext/libtar/win32/dirent.h +24 -0
  75. data/ext/libtar/win32/grp.h +4 -0
  76. data/ext/libtar/win32/listhash/libtar_hash.c +344 -0
  77. data/ext/libtar/win32/listhash/libtar_list.c +458 -0
  78. data/ext/libtar/win32/listhash/libtar_listhash.h +196 -0
  79. data/ext/libtar/win32/pwd.h +4 -0
  80. data/ext/libtar/win32/sys/param.h +8 -0
  81. data/ext/libtar/win32/tar.h +35 -0
  82. data/ext/libtar/win32/utime.h +6 -0
  83. data/ext/libtar/win32/win32/types.h +10 -0
  84. data/ext/tarruby.c +648 -0
  85. metadata +150 -0
@@ -0,0 +1,27 @@
1
+ /*
2
+ ** Copyright 2002 University of Illinois Board of Trustees
3
+ ** Copyright 2002 Mark D. Roth
4
+ ** All rights reserved.
5
+ **
6
+ ** inet_aton.c - inet_aton() function for compatibility library
7
+ **
8
+ ** Mark D. Roth <roth@uiuc.edu>
9
+ ** Campus Information Technologies and Educational Services
10
+ ** University of Illinois at Urbana-Champaign
11
+ */
12
+
13
+ #include <sys/socket.h>
14
+ #include <netinet/in.h>
15
+ #include <arpa/inet.h>
16
+
17
+
18
+ int
19
+ inet_aton(const char *cp, struct in_addr *inp)
20
+ {
21
+ inp->s_addr = inet_addr(cp);
22
+ if (inp->s_addr == -1)
23
+ return 0;
24
+ return 1;
25
+ }
26
+
27
+
@@ -0,0 +1,591 @@
1
+ # COMPAT_VAR___PROGNAME
2
+ # ---------------------
3
+ # Check if libc defines the __progname variable.
4
+ AC_DEFUN([COMPAT_VAR___PROGNAME], [
5
+ AC_CACHE_CHECK([if libc defines __progname],
6
+ [ac_cv_libc_defines___progname],
7
+ [AC_TRY_LINK([],
8
+ [
9
+ extern char *__progname;
10
+ printf("%s", __progname);
11
+ ],
12
+ [ac_cv_libc_defines___progname=yes],
13
+ [ac_cv_libc_defines___progname=no]
14
+ )]
15
+ )
16
+ if test "$ac_cv_libc_defines___progname" = "yes"; then
17
+ AC_DEFINE([HAVE___PROGNAME], 1,
18
+ [Define if libc defines the __progname variable])
19
+ fi
20
+ ])
21
+
22
+
23
+ # COMPAT_FUNC_BASENAME
24
+ # --------------------
25
+ # Check for working basename() function.
26
+ AC_DEFUN([COMPAT_FUNC_BASENAME], [
27
+ AC_DEFINE([NEED_BASENAME], 1,
28
+ [Define if you want to use the basename function])
29
+ AC_CHECK_HEADERS([libgen.h])
30
+ AC_CACHE_CHECK([for working basename],
31
+ [compat_cv_func_basename_works],
32
+ [AC_TRY_RUN([
33
+ #include <stdio.h>
34
+ #ifdef HAVE_LIBGEN_H
35
+ # include <libgen.h>
36
+ #endif
37
+
38
+ typedef struct {
39
+ char *test;
40
+ char *result;
41
+ } test_t;
42
+
43
+ const test_t tests[] = {
44
+ { "/usr/local/foo", "foo" },
45
+ { "/usr/local/foo/", "foo" },
46
+ { NULL, NULL }
47
+ };
48
+
49
+ int main() {
50
+ char test1[1024];
51
+ int i;
52
+
53
+ for (i = 0; tests[i].test; i++) {
54
+ strcpy(test1, tests[i].test);
55
+ if (strcmp(basename(test1), tests[i].result) ||
56
+ strcmp(test1, tests[i].test))
57
+ exit(1);
58
+ }
59
+
60
+ exit(0);
61
+ }
62
+ ],
63
+ [compat_cv_func_basename_works=yes],
64
+ [compat_cv_func_basename_works=no],
65
+ [compat_cv_func_basename_works=no]
66
+ )]
67
+ )
68
+ if test "$compat_cv_func_basename_works" = "yes"; then
69
+ AC_DEFINE([HAVE_BASENAME], 1,
70
+ [Define if your system has a working basename])
71
+ else
72
+ AC_LIBOBJ([basename])
73
+ fi
74
+ ])
75
+
76
+
77
+ # COMPAT_FUNC_DIRNAME
78
+ # -------------------
79
+ # Check for working dirname() function.
80
+ AC_DEFUN([COMPAT_FUNC_DIRNAME], [
81
+ AC_DEFINE([NEED_DIRNAME], 1,
82
+ [Define if you want to use the dirname function])
83
+ AC_CHECK_HEADERS([libgen.h])
84
+ AC_CACHE_CHECK([for working dirname],
85
+ [compat_cv_func_dirname_works],
86
+ [AC_TRY_RUN([
87
+ #include <stdio.h>
88
+ #ifdef HAVE_LIBGEN_H
89
+ # include <libgen.h>
90
+ #endif
91
+
92
+ typedef struct {
93
+ char *test;
94
+ char *result;
95
+ } test_t;
96
+
97
+ const test_t tests[] = {
98
+ { "foobar", "." },
99
+ { "/usr/local/foo", "/usr/local" },
100
+ { "/usr/local/foo/", "/usr/local" },
101
+ { "/", "/" },
102
+ { "", "." },
103
+ { NULL, NULL }
104
+ };
105
+
106
+ int main() {
107
+ char test1[1024];
108
+ int i;
109
+
110
+ for (i = 0; tests[i].test; i++) {
111
+ strcpy(test1, tests[i].test);
112
+ if (strcmp(dirname(test1), tests[i].result) ||
113
+ strcmp(test1, tests[i].test))
114
+ exit(1);
115
+ }
116
+
117
+ exit(0);
118
+ }
119
+ ],
120
+ [compat_cv_func_dirname_works=yes],
121
+ [compat_cv_func_dirname_works=no],
122
+ [compat_cv_func_dirname_works=no]
123
+ )]
124
+ )
125
+ if test "$compat_cv_func_dirname_works" = "yes"; then
126
+ AC_DEFINE([HAVE_DIRNAME], 1,
127
+ [Define if your system has a working dirname])
128
+ else
129
+ AC_LIBOBJ([dirname])
130
+ fi
131
+ ])
132
+
133
+
134
+ # COMPAT_FUNC_FNMATCH
135
+ # -------------------
136
+ # Check for working fnmatch() function.
137
+ AC_DEFUN([COMPAT_FUNC_FNMATCH], [
138
+ AC_DEFINE([NEED_FNMATCH], 1, [Define if you want to use the fnmatch function])
139
+ AC_CHECK_HEADERS([fnmatch.h])
140
+ if test "$ac_cv_header_fnmatch_h" = "yes"; then
141
+ AC_FUNC_FNMATCH
142
+ fi
143
+ if test "$ac_cv_func_fnmatch_works" != "yes"; then
144
+ AC_CHECK_HEADERS([ctype.h])
145
+ AC_LIBOBJ([fnmatch])
146
+ fi
147
+ ])
148
+
149
+
150
+ # COMPAT_FUNC_GLOB
151
+ # ----------------
152
+ # Check for working glob() function.
153
+ AC_DEFUN([COMPAT_FUNC_GLOB], [
154
+ AC_DEFINE([NEED_GLOB], 1, [Define if you want to use the glob function])
155
+ AC_CHECK_HEADERS([glob.h])
156
+ AC_CACHE_CHECK([for working glob],
157
+ [compat_cv_func_glob_works],
158
+ [AC_TRY_RUN([
159
+ #include <stdio.h>
160
+ #ifdef HAVE_GLOB_H
161
+ # include <glob.h>
162
+ #endif
163
+
164
+ #ifndef GLOB_ABORTED
165
+ # define GLOB_ABORTED GLOB_ABEND
166
+ #endif
167
+
168
+ int main() {
169
+ glob_t g;
170
+ int status;
171
+
172
+ status = glob("conf*", 0, NULL, &g);
173
+ switch (status) {
174
+ case 0:
175
+ case GLOB_NOSPACE:
176
+ case GLOB_ABORTED:
177
+ case GLOB_NOMATCH:
178
+ exit(0);
179
+ break;
180
+ default:
181
+ exit(1);
182
+ break;
183
+ }
184
+ }
185
+ ],
186
+ [compat_cv_func_glob_works=yes],
187
+ [compat_cv_func_glob_works=no],
188
+ [compat_cv_func_glob_works=no]
189
+ )]
190
+ )
191
+ if test "$compat_cv_func_glob_works" = "yes"; then
192
+ AC_DEFINE([HAVE_GLOB], 1, [Define if your system has a working glob])
193
+ else
194
+ AC_LIBOBJ([glob])
195
+ AC_CHECK_FUNCS([issetugid])
196
+ fi
197
+ ])
198
+
199
+
200
+ # COMPAT_FUNC_MAKEDEV
201
+ # -------------------
202
+ # Check for number of arguments expected by makedev().
203
+ AC_DEFUN([COMPAT_FUNC_MAKEDEV], [
204
+ AC_REQUIRE([AC_HEADER_MAJOR])
205
+ AC_DEFINE([NEED_MAKEDEV], 1,
206
+ [Define if you want to use the makedev function])
207
+ AC_CACHE_CHECK([whether makedev expects three arguments],
208
+ [compat_cv_func_makedev_three_args],
209
+ [AC_RUN_IFELSE([
210
+ AC_LANG_PROGRAM([[
211
+ #include <sys/types.h>
212
+ #ifdef MAJOR_IN_MKDEV
213
+ # include <sys/mkdev.h>
214
+ #else
215
+ # ifdef MAJOR_IN_SYSMACROS
216
+ # include <sys/sysmacros.h>
217
+ # endif
218
+ #endif
219
+ ]], [[
220
+ dev_t dev;
221
+ major_t maj = 5;
222
+ minor_t min = 7;
223
+
224
+ dev = makedev(0, maj, min);
225
+ if (major(dev) != maj
226
+ || minor(dev) != min)
227
+ exit(1);
228
+ exit(0);
229
+ ]])],
230
+ [compat_cv_func_makedev_three_args=yes],
231
+ [compat_cv_func_makedev_three_args=no]
232
+ )]
233
+ )
234
+ if test "$compat_cv_func_makedev_three_args" = "yes"; then
235
+ AC_DEFINE([MAKEDEV_THREE_ARGS], 1,
236
+ [Define as 1 if makedev expects three arguments])
237
+ fi
238
+ ])
239
+
240
+
241
+ # COMPAT_FUNC_SNPRINTF
242
+ # --------------------
243
+ # Check for working snprintf() function.
244
+ AC_DEFUN([COMPAT_FUNC_SNPRINTF], [
245
+ AC_DEFINE([NEED_SNPRINTF], 1,
246
+ [Define if you want to use the snprintf function])
247
+ AC_CACHE_CHECK([for working snprintf],
248
+ [compat_cv_func_snprintf_works],
249
+ [AC_TRY_RUN([
250
+ #include <stdio.h>
251
+
252
+ typedef struct {
253
+ int length;
254
+ char *test;
255
+ int retval;
256
+ char *result;
257
+ } test_t;
258
+
259
+ const test_t tests[] = {
260
+ { 10, "12345678901234567890", 20, "123456789" },
261
+ #if 0
262
+ { 0, "12345678901234567890", 20, NULL },
263
+ { -1, "12345678901234567890", -1, NULL },
264
+ #endif
265
+ { 0, NULL, 0, NULL }
266
+ };
267
+
268
+ int main() {
269
+ char test1[1024];
270
+ int i;
271
+
272
+ for (i = 0; tests[i].test; i++) {
273
+ memset(test1, 'X', sizeof(test1));
274
+ if ((snprintf(test1, tests[i].length, "%s", tests[i].test)
275
+ != tests[i].retval) ||
276
+ (tests[i].result && strcmp(tests[i].result, test1)))
277
+ exit(1);
278
+ }
279
+
280
+ exit(0);
281
+ }
282
+ ],
283
+ [compat_cv_func_snprintf_works=yes],
284
+ [compat_cv_func_snprintf_works=no],
285
+ [compat_cv_func_snprintf_works=no]
286
+ )]
287
+ )
288
+ if test "$compat_cv_func_snprintf_works" = "yes"; then
289
+ AC_DEFINE([HAVE_SNPRINTF], 1,
290
+ [Define if your system has a working snprintf])
291
+ else
292
+ AC_LIBOBJ([snprintf])
293
+ fi
294
+ ])
295
+
296
+
297
+ # COMPAT_PROTO_MACRO(FUNCTION, HEADER, MACRO-LIST, [BODY])
298
+ # --------------------------------------------------------
299
+ # Determine which C preprocessor macro is needed to expose prototype of
300
+ # FUNCTION in HEADER. First, we try with nothing special defined; then we
301
+ # try with each macro from MACRO-LIST. We stop as soon as it's found
302
+ # and adjust $CFLAGS appropriately.
303
+ AC_DEFUN([COMPAT_PROTO_MACRO],
304
+ [AC_CACHE_CHECK([what to define for $1 prototype],
305
+ [compat_cv_proto_]$1[_macro],
306
+ [AC_TRY_COMPILE(
307
+ [
308
+ #include <$2>
309
+ ],
310
+ [
311
+ void *funcptr;
312
+ $4
313
+ funcptr = $1;
314
+ ],
315
+ [compat_cv_proto_]$1[_macro="none"],
316
+ [for macro in $3; do
317
+ AC_TRY_COMPILE(
318
+ [
319
+ #define $macro
320
+ #include <$2>
321
+ ],
322
+ [
323
+ void *funcptr;
324
+ $4
325
+ funcptr = $1;
326
+ ],
327
+ [
328
+ compat_cv_proto_]$1[_macro="$macro"
329
+ break
330
+ ],
331
+ [compat_cv_proto_]$1[_macro="not found"]
332
+ )
333
+ done]
334
+ )]
335
+ )]
336
+ if test -n "$compat_cv_proto_$1_macro" -a "$compat_cv_proto_$1_macro" != "not found" -a "$compat_cv_proto_$1_macro" != "none"; then
337
+ CFLAGS="${CFLAGS} -D$compat_cv_proto_$1_macro";
338
+ fi
339
+ )
340
+
341
+
342
+ # COMPAT_FUNC_STRTOK_R
343
+ # --------------------
344
+ # Check for working strtok_r().
345
+ AC_DEFUN([COMPAT_FUNC_STRTOK_R], [
346
+ AC_DEFINE([NEED_STRTOK_R], 1,
347
+ [Define if you want to use the strtok_r function])
348
+ AC_REPLACE_FUNCS([strtok_r])
349
+ COMPAT_PROTO_MACRO([strtok_r], [string.h], [_REENTRANT _THREAD_SAFE])
350
+ ])
351
+
352
+
353
+ # COMPAT_FUNC_GETPWUID_R
354
+ # ----------------------
355
+ # Check for POSIX-compliant getpwuid_r().
356
+ AC_DEFUN([COMPAT_FUNC_GETPWUID_R], [
357
+ COMPAT_PROTO_MACRO([getpwuid_r], [pwd.h],
358
+ [_POSIX_PTHREAD_SEMANTICS _REENTRANT],
359
+ [
360
+ struct passwd pwd, *pwdp;
361
+ char buf[10240];
362
+ getpwuid_r(0, &pwd, buf, sizeof(buf), &pwdp);
363
+ ]
364
+ )
365
+ if test "$compat_cv_proto_getpwuid_r_macro" != "not found"; then
366
+ AC_DEFINE([HAVE_GETPWUID_R], 1,
367
+ [Define if your system has a POSIX-compliant getpwuid_r])
368
+ else
369
+ AC_MSG_WARN([cannot find usable getpwuid_r - resulting libraries will not be thread-safe])
370
+ fi
371
+ ])
372
+
373
+
374
+ # COMPAT_FUNC_GETHOSTBYNAME_R
375
+ # ---------------------------
376
+ # Check for gethostbyname_r().
377
+ AC_DEFUN([COMPAT_FUNC_GETHOSTBYNAME_R], [
378
+ AC_REQUIRE([AC_TYPE_SIZE_T])
379
+ AC_DEFINE([NEED_GETHOSTBYNAME_R], 1,
380
+ [Define if you want to use the gethostbyname_r function])
381
+ AC_SEARCH_LIBS([gethostbyname_r], [nsl])
382
+ if test "$ac_cv_search_gethostbyname_r" != "no"; then
383
+ COMPAT_PROTO_MACRO([gethostbyname_r], [netdb.h], [_REENTRANT])
384
+ AC_CACHE_CHECK(
385
+ [for number of arguments to gethostbyname_r],
386
+ [compat_cv_gethostbyname_r_args],
387
+ [AC_TRY_COMPILE(
388
+ [
389
+ #include <netdb.h>
390
+ ],
391
+ [
392
+ struct hostent hent;
393
+ char buf[10240];
394
+ int herr;
395
+
396
+ gethostbyname_r("localhost", &hent, buf, sizeof(buf), &herr);
397
+ ],
398
+ [compat_cv_gethostbyname_r_args=5],
399
+ [AC_TRY_COMPILE(
400
+ [
401
+ #include <netdb.h>
402
+ ],
403
+ [
404
+ struct hostent hent, *hp;
405
+ char buf[10240];
406
+ int herr;
407
+
408
+ gethostbyname_r("localhost", &hent, buf, sizeof(buf), &hp, &herr);
409
+ ],
410
+ [compat_cv_gethostbyname_r_args=6],
411
+ [AC_TRY_COMPILE(
412
+ [
413
+ #include <netdb.h>
414
+ ],
415
+ [
416
+ struct hostent hent;
417
+ struct hostent_data hdata;
418
+
419
+ gethostbyname_r("localhost", &hent, &hdata);
420
+ ],
421
+ [compat_cv_gethostbyname_r_args=3],
422
+ [compat_cv_gethostbyname_r_args=no]
423
+ )]
424
+ )]
425
+ )]
426
+ )
427
+ if test "$compat_cv_gethostbyname_r_args" != "no"; then
428
+ AC_DEFINE([HAVE_GETHOSTBYNAME_R], 1,
429
+ [Define if you have the gethostbyname_r function])
430
+ AC_DEFINE_UNQUOTED([GETHOSTBYNAME_R_NUM_ARGS],
431
+ [$compat_cv_gethostbyname_r_args],
432
+ [Define to number of arguments for gethostbyname_r])
433
+ if test "$compat_cv_gethostbyname_r_args" != "6"; then
434
+ AC_LIBOBJ([gethostbyname_r])
435
+ fi
436
+ else
437
+ AC_MSG_WARN([unknown form of gethostbyname_r - resulting libraries will not be thread-safe])
438
+ fi
439
+ else
440
+ AC_MSG_WARN([cannot find gethostbyname_r - resulting libraries will not be thread-safe])
441
+ fi
442
+ ])
443
+
444
+
445
+ # COMPAT_FUNC_GETSERVBYNAME_R
446
+ # ---------------------------
447
+ # Check for getservbyname_r().
448
+ AC_DEFUN([COMPAT_FUNC_GETSERVBYNAME_R], [
449
+ AC_REQUIRE([AC_TYPE_SIZE_T])
450
+ AC_DEFINE([NEED_GETSERVBYNAME_R], 1,
451
+ [Define if you want to use the getservbyname_r function])
452
+ AC_SEARCH_LIBS([getservbyname_r], [socket nsl])
453
+ if test "$ac_cv_search_getservbyname_r" != "no"; then
454
+ COMPAT_PROTO_MACRO([getservbyname_r], [netdb.h], [_REENTRANT])
455
+ AC_CACHE_CHECK(
456
+ [for number of arguments to getservbyname_r],
457
+ [compat_cv_getservbyname_r_args],
458
+ [AC_TRY_COMPILE(
459
+ [
460
+ #include <netdb.h>
461
+ ],
462
+ [
463
+ struct servent sent;
464
+ char buf[10240];
465
+
466
+ getservbyname_r("telnet", "tcp", &sent, buf, sizeof(buf));
467
+ ],
468
+ [compat_cv_getservbyname_r_args=5],
469
+ [AC_TRY_COMPILE(
470
+ [
471
+ #include <netdb.h>
472
+ ],
473
+ [
474
+ struct servent sent, *sp;
475
+ char buf[10240];
476
+
477
+ getservbyname_r("telnet", "tcp", &sent, buf, sizeof(buf), &sp);
478
+ ],
479
+ [compat_cv_getservbyname_r_args=6],
480
+ [AC_TRY_COMPILE(
481
+ [
482
+ #include <netdb.h>
483
+ ],
484
+ [
485
+ struct servent sent;
486
+ struct servent_data sdata;
487
+
488
+ getservbyname_r("telnet", "tcp", &sent, &sdata);
489
+ ],
490
+ [compat_cv_getservbyname_r_args=4],
491
+ [compat_cv_getservbyname_r_args=no]
492
+ )]
493
+ )]
494
+ )]
495
+ )
496
+ if test "$compat_cv_getservbyname_r_args" != "no"; then
497
+ AC_DEFINE([HAVE_GETSERVBYNAME_R], 1,
498
+ [Define if you have the getservbyname_r function])
499
+ AC_DEFINE_UNQUOTED([GETSERVBYNAME_R_NUM_ARGS],
500
+ [$compat_cv_getservbyname_r_args],
501
+ [Define to number of arguments for getservbyname_r])
502
+ if test "$compat_cv_getservbyname_r_args" != "6"; then
503
+ AC_LIBOBJ([getservbyname_r])
504
+ fi
505
+ else
506
+ AC_MSG_WARN([unknown form of getservbyname_r - resulting libraries will not be thread-safe])
507
+ fi
508
+ else
509
+ AC_MSG_WARN([cannot find getservbyname_r - resulting libraries will not be thread-safe])
510
+ fi
511
+ ])
512
+
513
+
514
+ # COMPAT_REPLACE_FUNC(function)
515
+ # -----------------------------
516
+ # Replacement for AC_REPLACE_FUNCS.
517
+ AC_DEFUN([COMPAT_REPLACE_FUNC], [
518
+ AC_DEFINE([NEED_]translit($1,[a-z],[A-Z]), 1,
519
+ [Define if you want to use the ]$1[ function])
520
+ AC_CHECK_FUNC($1,
521
+ [AC_DEFINE([HAVE_]translit($1,[a-z],[A-Z]), 1,
522
+ [Define if you have the ]$1[ function])],
523
+ [AC_LIBOBJ(]$1[)]
524
+ )
525
+ ])
526
+
527
+
528
+ # COMPAT_FUNC_GETHOSTNAME
529
+ # -----------------------
530
+ # Check for gethostname().
531
+ AC_DEFUN([COMPAT_FUNC_GETHOSTNAME], [
532
+ COMPAT_REPLACE_FUNC([gethostname])
533
+ ])
534
+
535
+
536
+ # COMPAT_FUNC_INET_ATON
537
+ # ---------------------
538
+ # Check for inet_aton().
539
+ AC_DEFUN([COMPAT_FUNC_INET_ATON], [
540
+ COMPAT_REPLACE_FUNC([inet_aton])
541
+ ])
542
+
543
+
544
+ # COMPAT_FUNC_STRDUP
545
+ # ------------------
546
+ # Check for strdup().
547
+ AC_DEFUN([COMPAT_FUNC_STRDUP], [
548
+ COMPAT_REPLACE_FUNC([strdup])
549
+ ])
550
+
551
+
552
+ # COMPAT_FUNC_STRLCAT
553
+ # -------------------
554
+ # Check for strlcat().
555
+ AC_DEFUN([COMPAT_FUNC_STRLCAT], [
556
+ COMPAT_REPLACE_FUNC([strlcat])
557
+ ])
558
+
559
+
560
+ # COMPAT_FUNC_STRLCPY
561
+ # -------------------
562
+ # Check for strlcpy().
563
+ AC_DEFUN([COMPAT_FUNC_STRLCPY], [
564
+ COMPAT_REPLACE_FUNC([strlcpy])
565
+ ])
566
+
567
+
568
+ # COMPAT_FUNC_STRMODE
569
+ # -------------------
570
+ # Check for strmode().
571
+ AC_DEFUN([COMPAT_FUNC_STRMODE], [
572
+ COMPAT_REPLACE_FUNC([strmode])
573
+ ])
574
+
575
+
576
+ # COMPAT_FUNC_STRRSTR
577
+ # -------------------
578
+ # Check for strrstr().
579
+ AC_DEFUN([COMPAT_FUNC_STRRSTR], [
580
+ COMPAT_REPLACE_FUNC([strrstr])
581
+ ])
582
+
583
+
584
+ # COMPAT_FUNC_STRSEP
585
+ # ------------------
586
+ # Check for strsep().
587
+ AC_DEFUN([COMPAT_FUNC_STRSEP], [
588
+ COMPAT_REPLACE_FUNC([strsep])
589
+ ])
590
+
591
+