Issue #1338 - Part 1: Update NSPR to 4.24

pull/24/head
wolfbeast 3 years ago committed by Roy Tam
parent f6096004d7
commit 1a92143e68
  1. 4
      nsprpub/admin/makeTargetDirs.sh
  2. 3
      nsprpub/admin/symlinks.sh
  3. 18
      nsprpub/config/Makefile.in
  4. 1
      nsprpub/config/autoconf.mk.in
  5. 6
      nsprpub/config/libc_r.h
  6. 535
      nsprpub/config/nsinstall.c
  7. 7
      nsprpub/config/rules.mk
  8. 483
      nsprpub/configure
  9. 358
      nsprpub/configure.in
  10. 4
      nsprpub/lib/ds/Makefile.in
  11. 64
      nsprpub/lib/ds/plarena.c
  12. 44
      nsprpub/lib/ds/plhash.c
  13. 8
      nsprpub/lib/ds/plvrsion.c
  14. 8
      nsprpub/lib/libc/include/plbase64.h
  15. 68
      nsprpub/lib/libc/include/plgetopt.h
  16. 30
      nsprpub/lib/libc/include/plstr.h
  17. 4
      nsprpub/lib/libc/src/Makefile.in
  18. 8
      nsprpub/lib/libc/src/base64.c
  19. 20
      nsprpub/lib/libc/src/plerror.c
  20. 33
      nsprpub/lib/libc/src/plgetopt.c
  21. 8
      nsprpub/lib/libc/src/plvrsion.c
  22. 80
      nsprpub/lib/libc/src/strcase.c
  23. 13
      nsprpub/lib/libc/src/strcat.c
  24. 30
      nsprpub/lib/libc/src/strchr.c
  25. 12
      nsprpub/lib/libc/src/strcmp.c
  26. 31
      nsprpub/lib/libc/src/strcpy.c
  27. 14
      nsprpub/lib/libc/src/strdup.c
  28. 13
      nsprpub/lib/libc/src/strlen.c
  29. 25
      nsprpub/lib/libc/src/strpbrk.c
  30. 53
      nsprpub/lib/libc/src/strstr.c
  31. 15
      nsprpub/lib/libc/src/strtok.c
  32. 6
      nsprpub/lib/prstreams/Makefile.in
  33. 8
      nsprpub/lib/prstreams/plvrsion.c
  34. 7
      nsprpub/lib/prstreams/prstrms.cpp
  35. 44
      nsprpub/lib/prstreams/prstrms.h
  36. 8
      nsprpub/lib/prstreams/tests/testprstrm/Makefile.in
  37. 233
      nsprpub/lib/prstreams/tests/testprstrm/testprstrm.cpp
  38. 8
      nsprpub/lib/tests/Makefile.in
  39. 220
      nsprpub/lib/tests/arena.c
  40. 3643
      nsprpub/lib/tests/base64t.c
  41. 23
      nsprpub/lib/tests/getopt.c
  42. 2734
      nsprpub/lib/tests/string.c
  43. 118
      nsprpub/pr/include/gencfg.c
  44. 106
      nsprpub/pr/include/md/_aix.h
  45. 120
      nsprpub/pr/include/md/_beos.cfg
  46. 583
      nsprpub/pr/include/md/_beos.h
  47. 74
      nsprpub/pr/include/md/_bsdi.h
  48. 58
      nsprpub/pr/include/md/_darwin.h
  49. 108
      nsprpub/pr/include/md/_dgux.cfg
  50. 188
      nsprpub/pr/include/md/_dgux.h
  51. 54
      nsprpub/pr/include/md/_freebsd.h
  52. 56
      nsprpub/pr/include/md/_hpux.h
  53. 438
      nsprpub/pr/include/md/_irix.h
  54. 119
      nsprpub/pr/include/md/_irix32.cfg
  55. 118
      nsprpub/pr/include/md/_irix64.cfg
  56. 95
      nsprpub/pr/include/md/_linux.cfg
  57. 56
      nsprpub/pr/include/md/_linux.h
  58. 52
      nsprpub/pr/include/md/_netbsd.h
  59. 170
      nsprpub/pr/include/md/_nspr_pthread.h
  60. 122
      nsprpub/pr/include/md/_nto.h
  61. 50
      nsprpub/pr/include/md/_openbsd.h
  62. 52
      nsprpub/pr/include/md/_os2.h
  63. 78
      nsprpub/pr/include/md/_os2_errors.h
  64. 116
      nsprpub/pr/include/md/_osf1.cfg
  65. 222
      nsprpub/pr/include/md/_osf1.h
  66. 2
      nsprpub/pr/include/md/_pcos.h
  67. 67
      nsprpub/pr/include/md/_pth.h
  68. 118
      nsprpub/pr/include/md/_qnx.h
  69. 98
      nsprpub/pr/include/md/_riscos.h
  70. 102
      nsprpub/pr/include/md/_scoos.h
  71. 304
      nsprpub/pr/include/md/_solaris.h
  72. 170
      nsprpub/pr/include/md/_symbian.cfg
  73. 50
      nsprpub/pr/include/md/_symbian.h
  74. 78
      nsprpub/pr/include/md/_unix_errors.h
  75. 342
      nsprpub/pr/include/md/_unixos.h
  76. 86
      nsprpub/pr/include/md/_unixware.h
  77. 72
      nsprpub/pr/include/md/_win32_errors.h
  78. 52
      nsprpub/pr/include/md/_win95.h
  79. 58
      nsprpub/pr/include/md/_winnt.h
  80. 19
      nsprpub/pr/include/md/prosdep.h
  81. 28
      nsprpub/pr/include/obsolete/pralarm.h
  82. 48
      nsprpub/pr/include/obsolete/probslet.h
  83. 32
      nsprpub/pr/include/obsolete/protypes.h
  84. 26
      nsprpub/pr/include/obsolete/prsem.h
  85. 36
      nsprpub/pr/include/pratom.h
  86. 52
      nsprpub/pr/include/prbit.h
  87. 60
      nsprpub/pr/include/prclist.h
  88. 306
      nsprpub/pr/include/prcountr.h
  89. 4
      nsprpub/pr/include/prcvar.h
  90. 2
      nsprpub/pr/include/prdtoa.h
  91. 52
      nsprpub/pr/include/prenv.h
  92. 30
      nsprpub/pr/include/prerror.h
  93. 8
      nsprpub/pr/include/prinet.h
  94. 12
      nsprpub/pr/include/prinit.h
  95. 20
      nsprpub/pr/include/prinrval.h
  96. 196
      nsprpub/pr/include/prio.h
  97. 48
      nsprpub/pr/include/private/pprio.h
  98. 82
      nsprpub/pr/include/private/pprthred.h
  99. 279
      nsprpub/pr/include/private/primpl.h
  100. 10
      nsprpub/pr/include/prlink.h
  101. Some files were not shown because too many files have changed in this diff Show More

@ -26,14 +26,10 @@ mkdir HP-UXB.11.00_64_DBG.OBJ
mkdir HP-UXB.11.00_64_OPT.OBJ
mkdir HP-UXB.11.00_DBG.OBJ
mkdir HP-UXB.11.00_OPT.OBJ
mkdir IRIX6.5_n32_PTH_DBG.OBJ
mkdir IRIX6.5_n32_PTH_OPT.OBJ
mkdir Linux2.2_x86_glibc_PTH_DBG.OBJ
mkdir Linux2.2_x86_glibc_PTH_OPT.OBJ
mkdir Linux2.4_x86_glibc_PTH_DBG.OBJ
mkdir Linux2.4_x86_glibc_PTH_OPT.OBJ
mkdir OSF1V4.0D_DBG.OBJ
mkdir OSF1V4.0D_OPT.OBJ
mkdir SunOS5.6_DBG.OBJ
mkdir SunOS5.6_OPT.OBJ
mkdir SunOS5.7_64_DBG.OBJ

@ -33,9 +33,6 @@ ln -s SunOS5.6_OPT.OBJ SunOS5.8_OPT.OBJ
ln -s SunOS5.7_64_DBG.OBJ SunOS5.8_64_DBG.OBJ
ln -s SunOS5.7_64_OPT.OBJ SunOS5.8_64_OPT.OBJ
ln -s OSF1V4.0D_DBG.OBJ OSF1V5.0_DBG.OBJ
ln -s OSF1V4.0D_OPT.OBJ OSF1V5.0_OPT.OBJ
ln -s WINNT4.0_DBG.OBJ WINNT5.0_DBG.OBJ
ln -s WINNT4.0_DBG.OBJD WINNT5.0_DBG.OBJD
ln -s WINNT4.0_OPT.OBJ WINNT5.0_OPT.OBJ

@ -48,22 +48,6 @@ ifeq (,$(filter-out QNX SCOOS UNIXWARE,$(OS_ARCH)))
DEFINES += -DOMIT_LIB_BUILD_TIME
endif
ifeq ($(OS_ARCH), IRIX)
ifeq ($(basename $(OS_RELEASE)),6)
ifndef NS_USE_GCC
ifeq ($(USE_N32),1)
XLDOPTS += -n32 -Wl,-woff,85
else
ifeq ($(USE_64),1)
XLDOPTS += -64
else
XLDOPTS += -32
endif
endif
endif
endif
endif
ifeq ($(OS_ARCH), HP-UX)
ifeq ($(USE_64),1)
XLDOPTS += +DD64
@ -81,7 +65,7 @@ PROGS = $(OBJDIR)/now$(PROG_SUFFIX)
ifeq (,$(CROSS_COMPILE)$(filter-out OS2 WINNT,$(OS_ARCH)))
TARGETS = $(PROGS)
else
ifeq (,$(filter-out SYMBIAN WINCE,$(OS_ARCH)))
ifeq (,$(filter-out WINCE,$(OS_ARCH)))
TARGETS = $(PROGS)
else
PROGS += $(OBJDIR)/nsinstall$(PROG_SUFFIX)

@ -140,7 +140,6 @@ endif
MACOS_SDK_DIR = @MACOS_SDK_DIR@
SYMBIAN_SDK_DIR = @SYMBIAN_SDK_DIR@
NEXT_ROOT = @NEXT_ROOT@
ifdef NEXT_ROOT

@ -25,7 +25,7 @@
#define R_STRTOK_INIT_R() \
char *r_strtok_r=NULL
#define R_STRTOK_R(return,source,delim) \
#define R_STRTOK_R(return,source,delim) \
return=strtok_r(source,delim,&r_strtok_r)
#define R_STRTOK_NORET_R(source,delim) \
@ -68,14 +68,14 @@
#define R_LOCALTIME_R(val) \
localtime_r(val,&r_localtime_r)
/***********/
/* crypt */
/***********/
#include <crypt.h>
#define R_CRYPT_INIT_R() \
CRYPTD r_cryptd_r; \
bzero(&r_cryptd_r,sizeof(CRYPTD))
bzero(&r_cryptd_r,sizeof(CRYPTD))
#define R_CRYPT_R(pass,salt) \
crypt_r(pass,salt,&r_cryptd_r)

@ -30,9 +30,6 @@
#define HAVE_FCHMOD
#if defined(BEOS)
#undef HAVE_FCHMOD
#endif
/*
* Does getcwd() take NULL as the first argument and malloc
@ -42,13 +39,13 @@
#define GETCWD_CAN_MALLOC
#endif
#if defined(LINUX) || defined(__GNU__) || defined(__GLIBC__)
#if defined(LINUX) || defined(__GNU__) || defined(__GLIBC__)
#include <getopt.h>
#endif
#if defined(SCO) || defined(UNIXWARE)
#if !defined(S_ISLNK) && defined(S_IFLNK)
#define S_ISLNK(a) (((a) & S_IFMT) == S_IFLNK)
#define S_ISLNK(a) (((a) & S_IFMT) == S_IFLNK)
#endif
#endif
@ -60,9 +57,9 @@ static void
usage(void)
{
fprintf(stderr,
"usage: %s [-C cwd] [-L linkprefix] [-m mode] [-o owner] [-g group]\n"
" %*s [-DdltR] file [file ...] directory\n",
program, (int)strlen(program), "");
"usage: %s [-C cwd] [-L linkprefix] [-m mode] [-o owner] [-g group]\n"
" %*s [-DdltR] file [file ...] directory\n",
program, (int)strlen(program), "");
exit(2);
}
@ -72,24 +69,27 @@ mkdirs(char *path, mode_t mode)
char *cp;
struct stat sb;
int res;
while (*path == '/' && path[1] == '/')
path++;
while (*path == '/' && path[1] == '/') {
path++;
}
for (cp = strrchr(path, '/'); cp && cp != path && cp[-1] == '/'; cp--)
;
;
if (cp && cp != path) {
*cp = '\0';
if ((stat(path, &sb) < 0 || !S_ISDIR(sb.st_mode)) &&
mkdirs(path, mode) < 0) {
return -1;
}
*cp = '/';
*cp = '\0';
if ((stat(path, &sb) < 0 || !S_ISDIR(sb.st_mode)) &&
mkdirs(path, mode) < 0) {
return -1;
}
*cp = '/';
}
res = mkdir(path, mode);
if ((res != 0) && (errno == EEXIST))
return 0;
else
return res;
if ((res != 0) && (errno == EEXIST)) {
return 0;
}
else {
return res;
}
}
static uid_t
@ -100,11 +100,13 @@ touid(char *owner)
char *cp;
pw = getpwnam(owner);
if (pw)
return pw->pw_uid;
if (pw) {
return pw->pw_uid;
}
uid = strtol(owner, &cp, 0);
if (uid == 0 && cp == owner)
fail("cannot find uid for %s", owner);
if (uid == 0 && cp == owner) {
fail("cannot find uid for %s", owner);
}
return uid;
}
@ -116,11 +118,13 @@ togid(char *group)
char *cp;
gr = getgrnam(group);
if (gr)
return gr->gr_gid;
if (gr) {
return gr->gr_gid;
}
gid = strtol(group, &cp, 0);
if (gid == 0 && cp == group)
fail("cannot find gid for %s", group);
if (gid == 0 && cp == group) {
fail("cannot find gid for %s", group);
}
return gid;
}
@ -140,65 +144,68 @@ main(int argc, char **argv)
onlydir = dodir = dolink = dorelsymlink = dotimes = lplen = 0;
while ((opt = getopt(argc, argv, "C:DdlL:Rm:o:g:t")) != EOF) {
switch (opt) {
case 'C':
cwd = optarg;
break;
case 'D':
onlydir = 1;
break;
case 'd':
dodir = 1;
break;
case 'l':
dolink = 1;
break;
case 'L':
linkprefix = optarg;
lplen = strlen(linkprefix);
dolink = 1;
break;
case 'R':
dolink = dorelsymlink = 1;
break;
case 'm':
mode = strtoul(optarg, &cp, 8);
if (mode == 0 && cp == optarg)
usage();
break;
case 'o':
owner = optarg;
break;
case 'g':
group = optarg;
break;
case 't':
dotimes = 1;
break;
default:
usage();
}
switch (opt) {
case 'C':
cwd = optarg;
break;
case 'D':
onlydir = 1;
break;
case 'd':
dodir = 1;
break;
case 'l':
dolink = 1;
break;
case 'L':
linkprefix = optarg;
lplen = strlen(linkprefix);
dolink = 1;
break;
case 'R':
dolink = dorelsymlink = 1;
break;
case 'm':
mode = strtoul(optarg, &cp, 8);
if (mode == 0 && cp == optarg) {
usage();
}
break;
case 'o':
owner = optarg;
break;
case 'g':
group = optarg;
break;
case 't':
dotimes = 1;
break;
default:
usage();
}
}
argc -= optind;
argv += optind;
if (argc < 2 - onlydir)
usage();
if (argc < 2 - onlydir) {
usage();
}
todir = argv[argc-1];
if ((stat(todir, &sb) < 0 || !S_ISDIR(sb.st_mode)) &&
mkdirs(todir, 0777) < 0) {
fail("cannot make directory %s", todir);
mkdirs(todir, 0777) < 0) {
fail("cannot make directory %s", todir);
}
if (onlydir) {
return 0;
}
if (onlydir)
return 0;
if (!cwd) {
#ifdef GETCWD_CAN_MALLOC
cwd = getcwd(0, PATH_MAX);
cwd = getcwd(0, PATH_MAX);
#else
cwd = malloc(PATH_MAX + 1);
cwd = getcwd(cwd, PATH_MAX);
cwd = malloc(PATH_MAX + 1);
cwd = getcwd(cwd, PATH_MAX);
#endif
}
xchdir(todir);
@ -215,120 +222,134 @@ main(int argc, char **argv)
gid = group ? togid(group) : -1;
while (--argc > 0) {
name = *argv++;
len = strlen(name);
base = xbasename(name);
bnlen = strlen(base);
toname = (char*)xmalloc(tdlen + 1 + bnlen + 1);
sprintf(toname, "%s/%s", todir, base);
exists = (lstat(toname, &tosb) == 0);
if (dodir) {
/* -d means create a directory, always */
if (exists && !S_ISDIR(tosb.st_mode)) {
(void) unlink(toname);
exists = 0;
}
if (!exists && mkdir(toname, mode) < 0)
fail("cannot make directory %s", toname);
if ((owner || group) && chown(toname, uid, gid) < 0)
fail("cannot change owner of %s", toname);
} else if (dolink) {
if (*name == '/') {
/* source is absolute pathname, link to it directly */
linkname = 0;
} else {
if (linkprefix) {
/* -L implies -l and prefixes names with a $cwd arg. */
len += lplen + 1;
linkname = (char*)xmalloc(len + 1);
sprintf(linkname, "%s/%s", linkprefix, name);
} else if (dorelsymlink) {
/* Symlink the relative path from todir to source name. */
linkname = (char*)xmalloc(PATH_MAX);
if (*todir == '/') {
/* todir is absolute: skip over common prefix. */
lplen = relatepaths(todir, cwd, linkname);
strcpy(linkname + lplen, name);
} else {
/* todir is named by a relative path: reverse it. */
reversepath(todir, name, len, linkname);
xchdir(cwd);
}
len = strlen(linkname);
}
name = linkname;
}
/* Check for a pre-existing symlink with identical content. */
if (exists &&
(!S_ISLNK(tosb.st_mode) ||
readlink(toname, buf, sizeof buf) != len ||
strncmp(buf, name, len) != 0)) {
(void) (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname);
exists = 0;
}
if (!exists && symlink(name, toname) < 0)
fail("cannot make symbolic link %s", toname);
name = *argv++;
len = strlen(name);
base = xbasename(name);
bnlen = strlen(base);
toname = (char*)xmalloc(tdlen + 1 + bnlen + 1);
sprintf(toname, "%s/%s", todir, base);
exists = (lstat(toname, &tosb) == 0);
if (dodir) {
/* -d means create a directory, always */
if (exists && !S_ISDIR(tosb.st_mode)) {
(void) unlink(toname);
exists = 0;
}
if (!exists && mkdir(toname, mode) < 0) {
fail("cannot make directory %s", toname);
}
if ((owner || group) && chown(toname, uid, gid) < 0) {
fail("cannot change owner of %s", toname);
}
} else if (dolink) {
if (*name == '/') {
/* source is absolute pathname, link to it directly */
linkname = 0;
} else {
if (linkprefix) {
/* -L implies -l and prefixes names with a $cwd arg. */
len += lplen + 1;
linkname = (char*)xmalloc(len + 1);
sprintf(linkname, "%s/%s", linkprefix, name);
} else if (dorelsymlink) {
/* Symlink the relative path from todir to source name. */
linkname = (char*)xmalloc(PATH_MAX);
if (*todir == '/') {
/* todir is absolute: skip over common prefix. */
lplen = relatepaths(todir, cwd, linkname);
strcpy(linkname + lplen, name);
} else {
/* todir is named by a relative path: reverse it. */
reversepath(todir, name, len, linkname);
xchdir(cwd);
}
len = strlen(linkname);
}
name = linkname;
}
/* Check for a pre-existing symlink with identical content. */
if (exists &&
(!S_ISLNK(tosb.st_mode) ||
readlink(toname, buf, sizeof buf) != len ||
strncmp(buf, name, len) != 0)) {
(void) (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname);
exists = 0;
}
if (!exists && symlink(name, toname) < 0) {
fail("cannot make symbolic link %s", toname);
}
#ifdef HAVE_LCHOWN
if ((owner || group) && lchown(toname, uid, gid) < 0)
fail("cannot change owner of %s", toname);
if ((owner || group) && lchown(toname, uid, gid) < 0) {
fail("cannot change owner of %s", toname);
}
#endif
if (linkname) {
free(linkname);
linkname = 0;
}
} else {
/* Copy from name to toname, which might be the same file. */
fromfd = open(name, O_RDONLY);
if (fromfd < 0 || fstat(fromfd, &sb) < 0)
fail("cannot access %s", name);
if (exists && (!S_ISREG(tosb.st_mode) || access(toname, W_OK) < 0))
(void) (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname);
tofd = open(toname, O_CREAT | O_WRONLY, 0666);
if (tofd < 0)
fail("cannot create %s", toname);
bp = buf;
while ((cc = read(fromfd, bp, sizeof buf)) > 0) {
while ((wc = write(tofd, bp, cc)) > 0) {
if ((cc -= wc) == 0)
break;
bp += wc;
}
if (wc < 0)
fail("cannot write to %s", toname);
}
if (cc < 0)
fail("cannot read from %s", name);
if (ftruncate(tofd, sb.st_size) < 0)
fail("cannot truncate %s", toname);
if (dotimes) {
utb.actime = sb.st_atime;
utb.modtime = sb.st_mtime;
if (utime(toname, &utb) < 0)
fail("cannot set times of %s", toname);
}
if (linkname) {
free(linkname);
linkname = 0;
}
} else {
/* Copy from name to toname, which might be the same file. */
fromfd = open(name, O_RDONLY);
if (fromfd < 0 || fstat(fromfd, &sb) < 0) {
fail("cannot access %s", name);
}
if (exists && (!S_ISREG(tosb.st_mode) || access(toname, W_OK) < 0)) {
(void) (S_ISDIR(tosb.st_mode) ? rmdir : unlink)(toname);
}
tofd = open(toname, O_CREAT | O_WRONLY, 0666);
if (tofd < 0) {
fail("cannot create %s", toname);
}
bp = buf;
while ((cc = read(fromfd, bp, sizeof buf)) > 0) {
while ((wc = write(tofd, bp, cc)) > 0) {
if ((cc -= wc) == 0) {
break;
}
bp += wc;
}
if (wc < 0) {
fail("cannot write to %s", toname);
}
}
if (cc < 0) {
fail("cannot read from %s", name);
}
if (ftruncate(tofd, sb.st_size) < 0) {
fail("cannot truncate %s", toname);
}
if (dotimes) {
utb.actime = sb.st_atime;
utb.modtime = sb.st_mtime;
if (utime(toname, &utb) < 0) {
fail("cannot set times of %s", toname);
}
}
#ifdef HAVE_FCHMOD
if (fchmod(tofd, mode) < 0)
if (fchmod(tofd, mode) < 0)
#else
if (chmod(toname, mode) < 0)
if (chmod(toname, mode) < 0)
#endif
fail("cannot change mode of %s", toname);
if ((owner || group) && fchown(tofd, uid, gid) < 0)
fail("cannot change owner of %s", toname);
/* Must check for delayed (NFS) write errors on close. */
if (close(tofd) < 0)
fail("cannot write to %s", toname);
close(fromfd);
}
free(toname);
fail("cannot change mode of %s", toname);
if ((owner || group) && fchown(tofd, uid, gid) < 0) {
fail("cannot change owner of %s", toname);
}
/* Must check for delayed (NFS) write errors on close. */
if (close(tofd) < 0) {
fail("cannot write to %s", toname);
}
close(fromfd);
}
free(toname);
}
free(cwd);
@ -362,10 +383,10 @@ fail(char *format, ...)
if (error)
#ifdef USE_REENTRANT_LIBC
R_STRERROR_R(errno);
fprintf(stderr, ": %s", r_strerror_r);
R_STRERROR_R(errno);
fprintf(stderr, ": %s", r_strerror_r);
#else
fprintf(stderr, ": %s", strerror(errno));
fprintf(stderr, ": %s", strerror(errno));
#endif
putc('\n', stderr);
@ -375,18 +396,20 @@ fail(char *format, ...)
char *
getcomponent(char *path, char *name)
{
if (*path == '\0')
return 0;
if (*path == '\0') {
return 0;
}
if (*path == '/') {
*name++ = '/';
*name++ = '/';
} else {
do {
*name++ = *path++;
} while (*path != '/' && *path != '\0');
do {
*name++ = *path++;
} while (*path != '/' && *path != '\0');
}
*name = '\0';
while (*path == '/')
path++;
while (*path == '/') {
path++;
}
return path;
}
@ -394,14 +417,14 @@ getcomponent(char *path, char *name)
/* Sigh. The static buffer in Unixware's readdir is too small. */
struct dirent * readdir(DIR *d)
{
static struct dirent *buf = NULL;
static struct dirent *buf = NULL;
#define MAX_PATH_LEN 1024
if(buf == NULL)
buf = (struct dirent *) malloc(sizeof(struct dirent) + MAX_PATH_LEN)
;
return(readdir_r(d, buf));
if(buf == NULL)
buf = (struct dirent *) malloc(sizeof(struct dirent) + MAX_PATH_LEN)
;
return(readdir_r(d, buf));
}
#endif
@ -413,13 +436,16 @@ ino2name(ino_t ino, char *dir)
char *name;
dp = opendir("..");
if (!dp)
fail("cannot read parent directory");
if (!dp) {
fail("cannot read parent directory");
}
for (;;) {
if (!(ep = readdir(dp)))
fail("cannot find current directory");
if (ep->d_ino == ino)
break;
if (!(ep = readdir(dp))) {
fail("cannot find current directory");
}
if (ep->d_ino == ino) {
break;
}
}
name = xstrdup(ep->d_name);
closedir(dp);
@ -430,8 +456,9 @@ void *
xmalloc(size_t size)
{
void *p = malloc(size);
if (!p)
fail("cannot allocate %u bytes", size);
if (!p) {
fail("cannot allocate %u bytes", size);
}
return p;
}
@ -446,17 +473,21 @@ xbasename(char *path)
{
char *cp;
while ((cp = strrchr(path, '/')) && cp[1] == '\0')
*cp = '\0';
if (!cp) return path;
while ((cp = strrchr(path, '/')) && cp[1] == '\0') {
*cp = '\0';
}
if (!cp) {
return path;
}
return cp + 1;
}
void
xchdir(char *dir)
{
if (chdir(dir) < 0)
fail("cannot change directory to %s", dir);
if (chdir(dir) < 0) {
fail("cannot change directory to %s", dir);
}
}
int
@ -468,27 +499,29 @@ relatepaths(char *from, char *to, char *outpath)
assert(*from == '/' && *to == '/');
for (cp = to, cp2 = from; *cp == *cp2; cp++, cp2++)
if (*cp == '\0')
break;
while (cp[-1] != '/')
cp--, cp2--;
if (*cp == '\0') {
break;
}
while (cp[-1] != '/') {
cp--, cp2--;
}
if (cp - 1 == to) {
/* closest common ancestor is /, so use full pathname */
len = strlen(strcpy(outpath, to));
if (outpath[len] != '/') {
outpath[len++] = '/';
outpath[len] = '\0';
}
/* closest common ancestor is /, so use full pathname */
len = strlen(strcpy(outpath, to));
if (outpath[len] != '/') {
outpath[len++] = '/';
outpath[len] = '\0';
}
} else {
len = 0;
while ((cp2 = getcomponent(cp2, buf)) != 0) {
strcpy(outpath + len, "../");
len += 3;
}
while ((cp = getcomponent(cp, buf)) != 0) {
sprintf(outpath + len, "%s/", buf);
len += strlen(outpath + len);
}
len = 0;
while ((cp2 = getcomponent(cp2, buf)) != 0) {
strcpy(outpath + len, "../");
len += 3;
}
while ((cp = getcomponent(cp, buf)) != 0) {
sprintf(outpath + len, "%s/", buf);
len += strlen(outpath + len);
}
}
return len;
}
@ -503,23 +536,25 @@ reversepath(char *inpath, char *name, int len, char *outpath)
cp = strcpy(outpath + PATH_MAX - (len + 1), name);
cp2 = inpath;
while ((cp2 = getcomponent(cp2, buf)) != 0) {
if (strcmp(buf, ".") == 0)
continue;
if (strcmp(buf, "..") == 0) {
if (stat(".", &sb) < 0)
fail("cannot stat current directory");
name = ino2name(sb.st_ino, "..");
len = strlen(name);
cp -= len + 1;
strcpy(cp, name);
cp[len] = '/';
free(name);
xchdir("..");
} else {
cp -= 3;
strncpy(cp, "../", 3);
xchdir(buf);
}
if (strcmp(buf, ".") == 0) {
continue;
}
if (strcmp(buf, "..") == 0) {
if (stat(".", &sb) < 0) {
fail("cannot stat current directory");
}
name = ino2name(sb.st_ino, "..");
len = strlen(name);
cp -= len + 1;
strcpy(cp, name);
cp[len] = '/';
free(name);
xchdir("..");
} else {
cp -= 3;
memcpy(cp, "../", 3);
xchdir(buf);
}
}
strcpy(outpath, cp);
}

@ -280,10 +280,13 @@ ifdef ENABLE_STRIP
$(STRIP) $@
endif
$(LIBRARY): $(OBJS)
# Same as OBJS, but without any file that matches p*vrsion.o, since these
# collide for static libraries, and are not useful for that case anyway.
STATICLIB_OBJS = $(filter-out $(OBJDIR)/p%vrsion.$(OBJ_SUFFIX),$(OBJS))
$(LIBRARY): $(STATICLIB_OBJS)
@$(MAKE_OBJDIR)
rm -f $@
$(AR) $(AR_FLAGS) $(OBJS) $(AR_EXTRA_ARGS)
$(AR) $(AR_FLAGS) $(STATICLIB_OBJS) $(AR_EXTRA_ARGS)
$(RANLIB) $@
ifeq ($(OS_TARGET), OS2)

483
nsprpub/configure vendored

@ -623,7 +623,6 @@ ac_subst_vars='LTLIBOBJS
LIBOBJS
MT
NEXT_ROOT
SYMBIAN_SDK_DIR
MACOS_SDK_DIR
WRAP_SYSTEM_INCLUDES
VISIBILITY_FLAGS
@ -757,6 +756,7 @@ infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
@ -783,7 +783,6 @@ with_android_ndk
with_android_toolchain
with_android_version
with_android_platform
with_gonk
with_dist_prefix
with_dist_bindir
with_dist_includedir
@ -793,10 +792,8 @@ enable_optimize
enable_debug
enable_debug_symbols
enable_win32_target
enable_symbian_target
enable_debug_rtl
enable_static_rtl
enable_n32
enable_x32
enable_64bit
enable_mdupdate
@ -812,13 +809,11 @@ with_arch
with_fpu
with_float_abi
with_soft_float
with_symbian_sdk
with_ccache
enable_strip
with_pthreads
enable_user_pthreads
enable_nspr_threads
with_bthreads
enable_ipv6
enable_wrap_malloc
with_wrap_malloc
@ -873,6 +868,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE}'
@ -1125,6 +1121,15 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@ -1262,7 +1267,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir
libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@ -1415,6 +1420,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@ -1453,11 +1459,8 @@ Optional Features:
(using compiler flags DBG)
--enable-win32-target=\$t
Specify win32 flavor. (WIN95 or WINNT)
--enable-symbian-target=\$t
Specify symbian flavor. (WINSCW or GCCE)
--enable-debug-rtl Use the MSVC debug runtime library
--enable-static-rtl Use the MSVC static runtime library
--enable-n32 Enable n32 ABI support (IRIX only)
--enable-x32 Enable x32 ABI support (x86_64 only)
--enable-64bit Enable 64-bit support (on certain platforms)
--enable-mdupdate Enable use of certain compilers' mdupdate feature
@ -1484,7 +1487,6 @@ Optional Packages:
Android platform version, default 5 for arm, 9 for x86/mips
--with-android-platform=DIR
location of platform dir
--with-gonk=DIR location of gonk dir
--with-dist-prefix=DIST_PREFIX
place build files in DIST_PREFIX dist
--with-dist-bindir=DIR build execuatables in DIR DIST_PREFIX/bin
@ -1507,13 +1509,9 @@ Optional Packages:
Use specific arm float ABI (-mfloat-abi=type)
--with-soft-float[=yes|no|toolchain-default]
Use soft float library (-msoft-float)
--with-symbian-sdk=SYMBIAN_SDK_DIR
The path to the Symbian SDK
--with-ccache=path/to/ccache
Enable compiling with ccache
--with-pthreads Use system pthreads library as thread subsystem
--with-bthreads Use system bthreads library as thread subsystem
(BeOS only)
--with-wrap-malloc=SHAREDLIB Location of malloc wrapper library
Some influential environment variables:
@ -2488,7 +2486,7 @@ test -n "$target_alias" &&
program_prefix=${target_alias}-
MOD_MAJOR_VERSION=4
MOD_MINOR_VERSION=20
MOD_MINOR_VERSION=24
MOD_PATCH_VERSION=0
NSPR_MODNAME=nspr20
_HAVE_PTHREADS=
@ -2642,6 +2640,12 @@ fi
case "$target" in
x86_64-linux*-android*)
android_tool_prefix="x86_64-linux-android"
;;
aarch64-linux*-android*)
android_tool_prefix="aarch64-linux-android"
;;
arm-linux*-android*|*-linuxandroid*)
android_tool_prefix="arm-linux-androideabi"
;;
@ -2656,19 +2660,6 @@ mipsel-*android*)
;;
esac
# Check whether --with-gonk was given.
if test "${with_gonk+set}" = set; then :
withval=$with_gonk; gonkdir=$withval
fi
if test -n "$gonkdir" ; then
$as_echo "#define ANDROID 1" >>confdefs.h
else
case "$target" in
*-android*|*-linuxandroid*)
if test -z "$android_ndk" ; then
@ -2754,7 +2745,6 @@ $as_echo "$android_platform" >&6; }
;;
esac
fi
dist_prefix='${MOD_DEPTH}/dist'
dist_bindir='${dist_prefix}/bin'
@ -2870,11 +2860,6 @@ if test "${enable_win32_target+set}" = set; then :
fi
# Check whether --enable-symbian-target was given.
if test "${enable_symbian_target+set}" = set; then :
enableval=$enable_symbian_target; OS_TARGET=`echo $enableval | tr a-z A-Z`
fi
# Check whether --enable-debug-rtl was given.
if test "${enable_debug_rtl+set}" = set; then :
@ -2894,17 +2879,6 @@ if test "${enable_static_rtl+set}" = set; then :
fi
# Check whether --enable-n32 was given.
if test "${enable_n32+set}" = set; then :
enableval=$enable_n32; if test "$enableval" = "yes"; then
USE_N32=1
else if test "$enableval" = "no"; then
USE_N32=
fi
fi
fi
# Check whether --enable-x32 was given.
if test "${enable_x32+set}" = set; then :
enableval=$enable_x32; if test "$enableval" = "yes"; then
@ -2993,14 +2967,6 @@ if test -z "$CC"; then
CC=cc
;;
*-irix*)
CC=cc
;;
*-osf*)
CC=cc
;;
*-solaris*)
CC=cc
;;
@ -3033,14 +2999,6 @@ if test -z "$CXX"; then
esac
;;
*-irix*)
CXX=CC
;;
*-osf*)
CXX=cxx
;;
*-solaris*)
CXX=CC
;;
@ -3098,9 +3056,6 @@ if test -n "$MOZ_DEBUG"; then
DEFINES="$DEFINES -UNDEBUG"
case "${target_os}" in
beos*)
DEFINES="$DEFINES -DDEBUG_${USER}"
;;
mks*|cygwin*|mingw*|msys*|os2*)
DEFINES="$DEFINES -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
;;
@ -5641,10 +5596,6 @@ else
OS_TEST=`uname -m`
fi
if test "$OS_ARCH" = "IRIX64"; then
OS_ARCH=IRIX
fi
if test "$OS_ARCH" = "AIX"; then
OS_RELEASE=`uname -v`.`uname -r`
fi
@ -6031,9 +5982,6 @@ case "$host" in
CYGWIN_WRAPPER='sh $(topsrcdir)/build/cygwin-wrapper'
fi
;;
*-beos*)
HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE"
;;
*os2*)
;;
*)
@ -6389,77 +6337,6 @@ fi
RESOLVE_LINK_SYMBOLS=1
;;
*-beos*)
$as_echo "#define XP_BEOS 1" >>confdefs.h
$as_echo "#define BeOS 1" >>confdefs.h
$as_echo "#define BEOS 1" >>confdefs.h
$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h
DSO_LDOPTS=-nostart
MDCPUCFG_H=_beos.cfg
USE_BTHREADS=1
PR_MD_ARCH_DIR=beos
RESOLVE_LINK_SYMBOLS=1
case "${target_cpu}" in
i*86)
_OPTIMIZE_FLAGS=-O2
_DEBUG_FLAGS='-gdwarf-2 -O0'
MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@'
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyaddr in -lbind" >&5
$as_echo_n "checking for gethostbyaddr in -lbind... " >&6; }
if ${ac_cv_lib_bind_gethostbyaddr+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lbind $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char gethostbyaddr ();
int
main ()
{
return gethostbyaddr ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_bind_gethostbyaddr=yes
else
ac_cv_lib_bind_gethostbyaddr=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bind_gethostbyaddr" >&5
$as_echo "$ac_cv_lib_bind_gethostbyaddr" >&6; }
if test "x$ac_cv_lib_bind_gethostbyaddr" = xyes; then :
OS_LIBS="$OS_LIBS -lbind -lsocket"
fi
;;
powerpc)
CC=mwcc
CCC=mwcc
LD=mwld
DSO_LDOPTS='-xms -export pragma -init _init_routine_ -term _term_routine_ -lroot -lnet /boot/develop/lib/ppc/glue-noinit.a /boot/develop/lib/ppc/init_term_dyn.o /boot/develop/lib/ppc/start_dyn.o'
_OPTIMIZE_FLAGS=-O2
_DEBUG_FLAGS='-g -O0'
;;
esac
;;
*-bsdi*)
$as_echo "#define XP_UNIX 1" >>confdefs.h
@ -6682,28 +6559,6 @@ tools are selected during the Xcode/Developer Tools installation." "$LINENO" 5
fi
;;
*-dgux*)
$as_echo "#define XP_UNIX 1" >>confdefs.h
$as_echo "#define _PR_LOCAL_THREADS_ONLY 1" >>confdefs.h
$as_echo "#define SVR4 1" >>confdefs.h
$as_echo "#define SYSV 1" >>confdefs.h
$as_echo "#define DGUX 1" >>confdefs.h
$as_echo "#define _DGUX_SOURCE 1" >>confdefs.h
$as_echo "#define _POSIX4A_DRAFT6_SOURCE 1" >>confdefs.h
DSO_LDOPTS=-G
_OPTIMIZE_FLAGS=-O2
_DEBUG_FLAGS=
MDCPUCFG_H=_dgux.cfg
PR_MD_CSRCS=dgux.c
;;
*-freebsd*)
if test -z "$USE_NSPR_THREADS"; then
USE_PTHREADS=1
@ -6739,7 +6594,7 @@ tools are selected during the Xcode/Developer Tools installation." "$LINENO" 5
$as_echo "#define _HPUX_SOURCE 1" >>confdefs.h
# OSF1 and HPUX report the POLLHUP event for a socket when the
# HPUX report the POLLHUP event for a socket when the
# shutdown(SHUT_WR) operation is called for the remote end, even though
# the socket is still writeable. Use select(), instead of poll(), to
# workaround this problem.
@ -6905,110 +6760,6 @@ tools are selected during the Xcode/Developer Tools installation." "$LINENO" 5
fi
;;
*-irix*)
$as_echo "#define XP_UNIX 1" >>confdefs.h
$as_echo "#define IRIX 1" >>confdefs.h
$as_echo "#define SVR4 1" >>confdefs.h
$as_echo "#define _SGI_MP_SOURCE 1" >>confdefs.h
$as_echo "#define HAVE_FCNTL_FILE_LOCKING 1" >>confdefs.h
PR_MD_CSRCS=irix.c
PR_MD_ASFILES=os_Irix.s
MKSHLIB='$(LD) $(DSO_LDOPTS) -rdata_shared -shared -soname $(notdir $@) -o $@'
STRIP="$STRIP -f"
RESOLVE_LINK_SYMBOLS=1
if test -n "$USE_64"; then
MDCPUCFG_H=_irix64.cfg
else
MDCPUCFG_H=_irix32.cfg
fi
case "${target_os}" in
irix6*)
$as_echo "#define IRIX6 1" >>confdefs.h
USE_PTHREADS=1
USE_N32=1
COMPILER_TAG=_n32
IMPL_STRATEGY=_PTH
;;
irix5*)
$as_echo "#define IRIX5 1" >>confdefs.h
USE_NSPR_THREADS=1
;;
*)
USE_PTHREADS=1
USE_N32=1
;;
esac
if test "$GNU_CC"; then
AS='$(CC) -Wp,-P -x assembler-with-cpp -D_ASM -mips2 $(INCLUDES)'
CFLAGS="$CFLAGS -Wall -Wno-format"
_OPTIMIZE_FLAGS="-O6"
else
if test -n "$USE_N32"; then
AS='as -D_ASM $(INCLUDES) -n32'
else
AS='as -D_ASM $(INCLUDES)'
fi
CFLAGS="$CFLAGS -fullwarn -xansi"
if test "$USE_N32"; then
_OPTIMIZE_FLAGS="-O -OPT:Olimit=4000"
else
_OPTIMIZE_FLAGS="-O -Olimit 4000"
fi
if test "$USE_MDUPDATE"; then
CFLAGS="$CFLAGS -MDupdate \$(DEPENDENCIES)"
fi
case "${target}" in
*-irix6.*)
CFLAGS="$CFLAGS -multigot"
DSO_LDOPTS="-no_unresolved"
if test "$USE_N32"; then
CFLAGS="$CFLAGS -n32 -woff 1209"
DSO_LDOPTS="$DSO_LDOPTS -n32"
else
if test "$USE_64"; then
CFLAGS="$CFLAGS -64"
else
CFLAGS="$CFLAGS -32"
fi
fi
;;
*)
CFLAGS="$CFLAGS -xgot"
;;
esac
fi
if test "${target_os}" = "irix5.3"; then
$as_echo "#define IRIX5_3 1" >>confdefs.h
fi
case "${target_os}" in
irix6.5)
if test -z "$GNU_CC"; then
CFLAGS="$CFLAGS -mips3"