Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 469206 | Differences between
and this patch

Collapse All | Expand All

(-)file_not_specified_in_diff (-37 / +1091 lines)
Line  Link Here
0
-- a/import-gnulib.config
0
++ b/import-gnulib.config
Lines 139-144 Link Here
139
sys_wait
139
sys_wait
140
timespec
140
timespec
141
uname
141
uname
142
unlinkat
142
verify
143
verify
143
version-etc
144
version-etc
144
version-etc-fsf
145
version-etc-fsf
145
-- a/gl/lib/Makefile.am
146
++ b/gl/lib/Makefile.am
Lines 21-27 Link Here
21
# the same distribution terms as the rest of that program.
21
# the same distribution terms as the rest of that program.
22
#
22
#
23
# Generated by gnulib-tool.
23
# Generated by gnulib-tool.
24
# Reproduce by: gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libgnulib --source-base=gl/lib --m4-base=gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --with-tests --no-conditional-dependencies --no-libtool --macro-prefix=gl alloca areadlinkat argmatch assert byteswap c-strcasestr c-strstr canonicalize cloexec closein closeout ctype d-ino d-type dirent-safer dirname errno error faccessat fchdir fcntl fdl fdopendir fflush fileblocks filemode fnmatch-gnu fopen-safer fts getdelim getline getopt-gnu gettext gettimeofday gpl-3.0 hash human idcache inline inttypes isblank locale lstat maintainer-makefile malloc manywarnings math mbrtowc mbscasestr mbsstr mktime modechange modf mountlist open parse-datetime pathmax perror progname quotearg readlink realloc regex rpmatch save-cwd savedir selinux-at snprintf stat stat-macros stat-size stat-time stdarg stdbool stddef stdint stdio stdlib stpcpy strcasestr strdup-posix strftime string strndup strtol strtoul strtoull strtoumax sys_stat sys_time sys_wait timespec uname update-copyright verify version-etc version-etc-fsf warnings wchar wcwidth xalloc xalloc-die xgetcwd xstrtod xstrtol xstrtoumax yesno
24
# Reproduce by: gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libgnulib --source-base=gl/lib --m4-base=gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --with-tests --no-conditional-dependencies --no-libtool --macro-prefix=gl alloca areadlinkat argmatch assert byteswap c-strcasestr c-strstr canonicalize cloexec closein closeout ctype d-ino d-type dirent-safer dirname errno error faccessat fchdir fcntl fdl fdopendir fflush fileblocks filemode fnmatch-gnu fopen-safer fts getdelim getline getopt-gnu gettext gettimeofday gpl-3.0 hash human idcache inline inttypes isblank locale lstat maintainer-makefile malloc manywarnings math mbrtowc mbscasestr mbsstr mktime modechange modf mountlist open parse-datetime pathmax perror progname quotearg readlink realloc regex rpmatch save-cwd savedir selinux-at snprintf stat stat-macros stat-size stat-time stdarg stdbool stddef stdint stdio stdlib stpcpy strcasestr strdup-posix strftime string strndup strtol strtoul strtoull strtoumax sys_stat sys_time sys_wait timespec uname unlinkat update-copyright verify version-etc version-etc-fsf warnings wchar wcwidth xalloc xalloc-die xgetcwd xstrtod xstrtol xstrtoumax yesno
25
25
26
AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
26
AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
27
27
Lines 1977-1982 Link Here
1977
1977
1978
## end   gnulib module rewinddir
1978
## end   gnulib module rewinddir
1979
1979
1980
## begin gnulib module rmdir
1981
1982
1983
EXTRA_DIST += rmdir.c
1984
1985
EXTRA_libgnulib_a_SOURCES += rmdir.c
1986
1987
## end   gnulib module rmdir
1988
1980
## begin gnulib module root-uid
1989
## begin gnulib module root-uid
1981
1990
1982
1991
Lines 3450-3455 Link Here
3450
3459
3451
## end   gnulib module uniwidth/width
3460
## end   gnulib module uniwidth/width
3452
3461
3462
## begin gnulib module unlink
3463
3464
3465
EXTRA_DIST += unlink.c
3466
3467
EXTRA_libgnulib_a_SOURCES += unlink.c
3468
3469
## end   gnulib module unlink
3470
3471
## begin gnulib module unlinkat
3472
3473
3474
EXTRA_DIST += at-func.c unlinkat.c
3475
3476
EXTRA_libgnulib_a_SOURCES += at-func.c unlinkat.c
3477
3478
## end   gnulib module unlinkat
3479
3453
## begin gnulib module unsetenv
3480
## begin gnulib module unsetenv
3454
3481
3455
3482
3456
-- a/gl/lib/rmdir.c
3483
++ b/gl/lib/rmdir.c
Line 0 Link Here
0
-- a/gl/lib/unlinkat.c
1
/* Work around rmdir bugs.
2
3
   Copyright (C) 1988, 1990, 1999, 2003-2006, 2009-2012 Free Software
4
   Foundation, Inc.
5
6
   This program is free software: you can redistribute it and/or modify
7
   it under the terms of the GNU General Public License as published by
8
   the Free Software Foundation; either version 3 of the License, or
9
   (at your option) any later version.
10
11
   This program is distributed in the hope that it will be useful,
12
   but WITHOUT ANY WARRANTY; without even the implied warranty of
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
   GNU General Public License for more details.
15
16
   You should have received a copy of the GNU General Public License
17
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
18
19
#include <config.h>
20
21
#include <unistd.h>
22
23
#include <errno.h>
24
#include <string.h>
25
26
#include "dosname.h"
27
28
#undef rmdir
29
30
/* Remove directory DIR.
31
   Return 0 if successful, -1 if not.  */
32
33
int
34
rpl_rmdir (char const *dir)
35
{
36
  /* Work around cygwin 1.5.x bug where rmdir("dir/./") succeeds.  */
37
  size_t len = strlen (dir);
38
  int result;
39
  while (len && ISSLASH (dir[len - 1]))
40
    len--;
41
  if (len && dir[len - 1] == '.' && (1 == len || ISSLASH (dir[len - 2])))
42
    {
43
      errno = EINVAL;
44
      return -1;
45
    }
46
  result = rmdir (dir);
47
  /* Work around mingw bug, where rmdir("file/") fails with EINVAL
48
     instead of ENOTDIR.  We've already filtered out trailing ., the
49
     only reason allowed by POSIX for EINVAL.  */
50
  if (result == -1 && errno == EINVAL)
51
    errno = ENOTDIR;
52
  return result;
53
}
54
++ b/gl/lib/unlinkat.c
Line 0 Link Here
0
-- a/gl/lib/unlink.c
1
/* Work around unlinkat bugs on Solaris 9 and Hurd.
2
3
   Copyright (C) 2009-2012 Free Software Foundation, Inc.
4
5
   This program is free software: you can redistribute it and/or modify
6
   it under the terms of the GNU General Public License as published by
7
   the Free Software Foundation; either version 3 of the License, or
8
   (at your option) any later version.
9
10
   This program is distributed in the hope that it will be useful,
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
   GNU General Public License for more details.
14
15
   You should have received a copy of the GNU General Public License
16
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17
18
/* Written by Eric Blake.  */
19
20
#include <config.h>
21
22
#include <unistd.h>
23
24
#include <errno.h>
25
#include <fcntl.h>
26
#include <string.h>
27
#include <sys/stat.h>
28
29
#include <stdlib.h>
30
31
#include "dosname.h"
32
#include "openat.h"
33
34
#if HAVE_UNLINKAT
35
36
# undef unlinkat
37
38
/* unlinkat without AT_REMOVEDIR does not honor trailing / on Solaris
39
   9.  Solve it in a similar manner to unlink.  Hurd has the same
40
   issue. */
41
42
int
43
rpl_unlinkat (int fd, char const *name, int flag)
44
{
45
  size_t len;
46
  int result = 0;
47
  /* rmdir behavior has no problems with trailing slash.  */
48
  if (flag & AT_REMOVEDIR)
49
    return unlinkat (fd, name, flag);
50
51
  len = strlen (name);
52
  if (len && ISSLASH (name[len - 1]))
53
    {
54
      /* See the lengthy comment in unlink.c why we disobey the POSIX
55
         rule of letting unlink("link-to-dir/") attempt to unlink a
56
         directory.  */
57
      struct stat st;
58
      result = lstatat (fd, name, &st);
59
      if (result == 0)
60
        {
61
          /* Trailing NUL will overwrite the trailing slash.  */
62
          char *short_name = malloc (len);
63
          if (!short_name)
64
            {
65
              errno = EPERM;
66
              return -1;
67
            }
68
          memcpy (short_name, name, len);
69
          while (len && ISSLASH (short_name[len - 1]))
70
            short_name[--len] = '\0';
71
          if (len && (lstatat (fd, short_name, &st) || S_ISLNK (st.st_mode)))
72
            {
73
              free (short_name);
74
              errno = EPERM;
75
              return -1;
76
            }
77
          free (short_name);
78
        }
79
    }
80
  if (!result)
81
    result = unlinkat (fd, name, flag);
82
  return result;
83
}
84
85
#else /* !HAVE_UNLINKAT */
86
87
/* Replacement for Solaris' function by the same name.
88
   <http://www.google.com/search?q=unlinkat+site:docs.sun.com>
89
   First, try to simulate it via (unlink|rmdir) ("/proc/self/fd/FD/FILE").
90
   Failing that, simulate it via save_cwd/fchdir/(unlink|rmdir)/restore_cwd.
91
   If either the save_cwd or the restore_cwd fails (relatively unlikely),
92
   then give a diagnostic and exit nonzero.
93
   Otherwise, this function works just like Solaris' unlinkat.  */
94
95
# define AT_FUNC_NAME unlinkat
96
# define AT_FUNC_F1 rmdir
97
# define AT_FUNC_F2 unlink
98
# define AT_FUNC_USE_F1_COND AT_REMOVEDIR
99
# define AT_FUNC_POST_FILE_PARAM_DECLS , int flag
100
# define AT_FUNC_POST_FILE_ARGS        /* empty */
101
# include "at-func.c"
102
# undef AT_FUNC_NAME
103
# undef AT_FUNC_F1
104
# undef AT_FUNC_F2
105
# undef AT_FUNC_USE_F1_COND
106
# undef AT_FUNC_POST_FILE_PARAM_DECLS
107
# undef AT_FUNC_POST_FILE_ARGS
108
109
#endif /* !HAVE_UNLINKAT */
110
++ b/gl/lib/unlink.c
Line 0 Link Here
0
-- a/gl/m4/glibc2.m4
1
/* Work around unlink bugs.
2
3
   Copyright (C) 2009-2012 Free Software Foundation, Inc.
4
5
   This program is free software: you can redistribute it and/or modify
6
   it under the terms of the GNU General Public License as published by
7
   the Free Software Foundation; either version 3 of the License, or
8
   (at your option) any later version.
9
10
   This program is distributed in the hope that it will be useful,
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
   GNU General Public License for more details.
14
15
   You should have received a copy of the GNU General Public License
16
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17
18
#include <config.h>
19
20
#include <unistd.h>
21
22
#include <errno.h>
23
#include <stdlib.h>
24
#include <string.h>
25
#include <sys/stat.h>
26
27
#include "dosname.h"
28
29
#undef unlink
30
31
/* Remove file NAME.
32
   Return 0 if successful, -1 if not.  */
33
34
int
35
rpl_unlink (char const *name)
36
{
37
  /* Work around Solaris 9 bug where unlink("file/") succeeds.  */
38
  size_t len = strlen (name);
39
  int result = 0;
40
  if (len && ISSLASH (name[len - 1]))
41
    {
42
      /* We can't unlink(2) something if it doesn't exist.  If it does
43
         exist, then it resolved to a directory, due to the trailing
44
         slash, and POSIX requires that the unlink attempt to remove
45
         that directory (which would leave the symlink dangling).
46
         Unfortunately, Solaris 9 is one of the platforms where the
47
         root user can unlink directories, and we don't want to
48
         cripple this behavior on real directories, even if it is
49
         seldom needed (at any rate, it's nicer to let coreutils'
50
         unlink(1) give the correct errno for non-root users).  But we
51
         don't know whether name was an actual directory, or a symlink
52
         to a directory; and due to the bug of ignoring trailing
53
         slash, Solaris 9 would end up successfully unlinking the
54
         symlink instead of the directory.  Technically, we could use
55
         realpath to find the canonical directory name to attempt
56
         deletion on.  But that is a lot of work for a corner case; so
57
         we instead just use an lstat on the shortened name, and
58
         reject symlinks with trailing slashes.  The root user of
59
         unlink(1) will just have to live with the rule that they
60
         can't delete a directory via a symlink.  */
61
      struct stat st;
62
      result = lstat (name, &st);
63
      if (result == 0)
64
        {
65
          /* Trailing NUL will overwrite the trailing slash.  */
66
          char *short_name = malloc (len);
67
          if (!short_name)
68
            {
69
              errno = EPERM;
70
              return -1;
71
            }
72
          memcpy (short_name, name, len);
73
          while (len && ISSLASH (short_name[len - 1]))
74
            short_name[--len] = '\0';
75
          if (len && (lstat (short_name, &st) || S_ISLNK (st.st_mode)))
76
            {
77
              free (short_name);
78
              errno = EPERM;
79
              return -1;
80
            }
81
          free (short_name);
82
        }
83
    }
84
  if (!result)
85
    {
86
#if UNLINK_PARENT_BUG
87
      if (len >= 2 && name[len - 1] == '.' && name[len - 2] == '.'
88
          && (len == 2 || ISSLASH (name[len - 3])))
89
        {
90
          errno = EISDIR; /* could also use EPERM */
91
          return -1;
92
        }
93
#endif
94
      result = unlink (name);
95
    }
96
  return result;
97
}
98
++ b/gl/m4/glibc2.m4
Line 0 Link Here
0
-- a/gl/m4/gnulib-cache.m4
1
# glibc2.m4 serial 3
2
dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2012 Free Software Foundation,
3
dnl Inc.
4
dnl This file is free software; the Free Software Foundation
5
dnl gives unlimited permission to copy and/or distribute it,
6
dnl with or without modifications, as long as this notice is preserved.
7
8
# Test for the GNU C Library, version 2.0 or newer.
9
# From Bruno Haible.
10
11
AC_DEFUN([gt_GLIBC2],
12
  [
13
    AC_CACHE_CHECK([whether we are using the GNU C Library 2 or newer],
14
      [ac_cv_gnu_library_2],
15
      [AC_EGREP_CPP([Lucky GNU user],
16
        [
17
#include <features.h>
18
#ifdef __GNU_LIBRARY__
19
 #if (__GLIBC__ >= 2) && !defined __UCLIBC__
20
  Lucky GNU user
21
 #endif
22
#endif
23
        ],
24
        [ac_cv_gnu_library_2=yes],
25
        [ac_cv_gnu_library_2=no])
26
      ]
27
    )
28
    AC_SUBST([GLIBC2])
29
    GLIBC2="$ac_cv_gnu_library_2"
30
  ]
31
)
32
++ b/gl/m4/gnulib-cache.m4
Lines 27-33 Link Here
27
27
28
28
29
# Specification in the form of a command-line invocation:
29
# Specification in the form of a command-line invocation:
30
#   gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libgnulib --source-base=gl/lib --m4-base=gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --with-tests --no-conditional-dependencies --no-libtool --macro-prefix=gl alloca areadlinkat argmatch assert byteswap c-strcasestr c-strstr canonicalize cloexec closein closeout ctype d-ino d-type dirent-safer dirname errno error faccessat fchdir fcntl fdl fdopendir fflush fileblocks filemode fnmatch-gnu fopen-safer fts getdelim getline getopt-gnu gettext gettimeofday gpl-3.0 hash human idcache inline inttypes isblank locale lstat maintainer-makefile malloc manywarnings math mbrtowc mbscasestr mbsstr mktime modechange modf mountlist open parse-datetime pathmax perror progname quotearg readlink realloc regex rpmatch save-cwd savedir selinux-at snprintf stat stat-macros stat-size stat-time stdarg stdbool stddef stdint stdio stdlib stpcpy strcasestr strdup-posix strftime string strndup strtol strtoul strtoull strtoumax sys_stat sys_time sys_wait timespec uname update-copyright verify version-etc version-etc-fsf warnings wchar wcwidth xalloc xalloc-die xgetcwd xstrtod xstrtol xstrtoumax yesno
30
#   gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libgnulib --source-base=gl/lib --m4-base=gl/m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --with-tests --no-conditional-dependencies --no-libtool --macro-prefix=gl alloca areadlinkat argmatch assert byteswap c-strcasestr c-strstr canonicalize cloexec closein closeout ctype d-ino d-type dirent-safer dirname errno error faccessat fchdir fcntl fdl fdopendir fflush fileblocks filemode fnmatch-gnu fopen-safer fts getdelim getline getopt-gnu gettext gettimeofday gpl-3.0 hash human idcache inline inttypes isblank locale lstat maintainer-makefile malloc manywarnings math mbrtowc mbscasestr mbsstr mktime modechange modf mountlist open parse-datetime pathmax perror progname quotearg readlink realloc regex rpmatch save-cwd savedir selinux-at snprintf stat stat-macros stat-size stat-time stdarg stdbool stddef stdint stdio stdlib stpcpy strcasestr strdup-posix strftime string strndup strtol strtoul strtoull strtoumax sys_stat sys_time sys_wait timespec uname unlinkat update-copyright verify version-etc version-etc-fsf warnings wchar wcwidth xalloc xalloc-die xgetcwd xstrtod xstrtol xstrtoumax yesno
31
31
32
# Specification in the form of a few gnulib-tool.m4 macro invocations:
32
# Specification in the form of a few gnulib-tool.m4 macro invocations:
33
gl_LOCAL_DIR([gnulib-local])
33
gl_LOCAL_DIR([gnulib-local])
Lines 125-130 Link Here
125
  sys_wait
125
  sys_wait
126
  timespec
126
  timespec
127
  uname
127
  uname
128
  unlinkat
128
  update-copyright
129
  update-copyright
129
  verify
130
  verify
130
  version-etc
131
  version-etc
131
-- a/gl/m4/gnulib-comp.m4
132
++ b/gl/m4/gnulib-comp.m4
Lines 1045-1050 Link Here
1045
    AC_LIBOBJ([rewinddir])
1045
    AC_LIBOBJ([rewinddir])
1046
  fi
1046
  fi
1047
  gl_DIRENT_MODULE_INDICATOR([rewinddir])
1047
  gl_DIRENT_MODULE_INDICATOR([rewinddir])
1048
  gl_FUNC_RMDIR
1049
  if test $REPLACE_RMDIR = 1; then
1050
    AC_LIBOBJ([rmdir])
1051
  fi
1052
  gl_UNISTD_MODULE_INDICATOR([rmdir])
1048
  gl_FUNC_RPMATCH
1053
  gl_FUNC_RPMATCH
1049
  if test $HAVE_RPMATCH = 0; then
1054
  if test $HAVE_RPMATCH = 0; then
1050
    AC_LIBOBJ([rpmatch])
1055
    AC_LIBOBJ([rpmatch])
Lines 1223-1228 Link Here
1223
  gl_LIBUNISTRING_LIBHEADER([0.9], [unitypes.h])
1228
  gl_LIBUNISTRING_LIBHEADER([0.9], [unitypes.h])
1224
  gl_LIBUNISTRING_LIBHEADER([0.9], [uniwidth.h])
1229
  gl_LIBUNISTRING_LIBHEADER([0.9], [uniwidth.h])
1225
  gl_LIBUNISTRING_MODULE([0.9.4], [uniwidth/width])
1230
  gl_LIBUNISTRING_MODULE([0.9.4], [uniwidth/width])
1231
  gl_FUNC_UNLINK
1232
  if test $REPLACE_UNLINK = 1; then
1233
    AC_LIBOBJ([unlink])
1234
  fi
1235
  gl_UNISTD_MODULE_INDICATOR([unlink])
1236
  gl_FUNC_UNLINKAT
1237
  if test $HAVE_UNLINKAT = 0 || test $REPLACE_UNLINKAT = 1; then
1238
    AC_LIBOBJ([unlinkat])
1239
  fi
1240
  gl_UNISTD_MODULE_INDICATOR([unlinkat])
1226
  gl_FUNC_UNSETENV
1241
  gl_FUNC_UNSETENV
1227
  if test $HAVE_UNSETENV = 0 || test $REPLACE_UNSETENV = 1; then
1242
  if test $HAVE_UNSETENV = 0 || test $REPLACE_UNSETENV = 1; then
1228
    AC_LIBOBJ([unsetenv])
1243
    AC_LIBOBJ([unsetenv])
Lines 1368-1378 Link Here
1368
    AC_LIBOBJ([putenv])
1383
    AC_LIBOBJ([putenv])
1369
  fi
1384
  fi
1370
  gl_STDLIB_MODULE_INDICATOR([putenv])
1385
  gl_STDLIB_MODULE_INDICATOR([putenv])
1371
  gl_FUNC_RMDIR
1372
  if test $REPLACE_RMDIR = 1; then
1373
    AC_LIBOBJ([rmdir])
1374
  fi
1375
  gl_UNISTD_MODULE_INDICATOR([rmdir])
1376
  gl_FUNC_SETLOCALE
1386
  gl_FUNC_SETLOCALE
1377
  if test $REPLACE_SETLOCALE = 1; then
1387
  if test $REPLACE_SETLOCALE = 1; then
1378
    AC_LIBOBJ([setlocale])
1388
    AC_LIBOBJ([setlocale])
Lines 1412-1427 Link Here
1412
  gl_UNISTD_MODULE_INDICATOR([symlinkat])
1422
  gl_UNISTD_MODULE_INDICATOR([symlinkat])
1413
  AC_CHECK_FUNCS_ONCE([shutdown])
1423
  AC_CHECK_FUNCS_ONCE([shutdown])
1414
  gl_THREAD
1424
  gl_THREAD
1415
  gl_FUNC_UNLINK
1416
  if test $REPLACE_UNLINK = 1; then
1417
    AC_LIBOBJ([unlink])
1418
  fi
1419
  gl_UNISTD_MODULE_INDICATOR([unlink])
1420
  gl_FUNC_UNLINKAT
1421
  if test $HAVE_UNLINKAT = 0 || test $REPLACE_UNLINKAT = 1; then
1422
    AC_LIBOBJ([unlinkat])
1423
  fi
1424
  gl_UNISTD_MODULE_INDICATOR([unlinkat])
1425
  gl_UNLINKDIR
1425
  gl_UNLINKDIR
1426
  abs_aux_dir=`cd "$ac_aux_dir"; pwd`
1426
  abs_aux_dir=`cd "$ac_aux_dir"; pwd`
1427
  AC_SUBST([abs_aux_dir])
1427
  AC_SUBST([abs_aux_dir])
Lines 1791-1796 Link Here
1791
  lib/regex_internal.h
1791
  lib/regex_internal.h
1792
  lib/regexec.c
1792
  lib/regexec.c
1793
  lib/rewinddir.c
1793
  lib/rewinddir.c
1794
  lib/rmdir.c
1794
  lib/root-uid.h
1795
  lib/root-uid.h
1795
  lib/rpmatch.c
1796
  lib/rpmatch.c
1796
  lib/same-inode.h
1797
  lib/same-inode.h
Lines 1872-1877 Link Here
1872
  lib/uniwidth.in.h
1873
  lib/uniwidth.in.h
1873
  lib/uniwidth/cjk.h
1874
  lib/uniwidth/cjk.h
1874
  lib/uniwidth/width.c
1875
  lib/uniwidth/width.c
1876
  lib/unlink.c
1877
  lib/unlinkat.c
1875
  lib/unsetenv.c
1878
  lib/unsetenv.c
1876
  lib/vasnprintf.c
1879
  lib/vasnprintf.c
1877
  lib/vasnprintf.h
1880
  lib/vasnprintf.h
Lines 2464-2478 Link Here
2464
  tests=lib/priv-set.c
2467
  tests=lib/priv-set.c
2465
  tests=lib/priv-set.h
2468
  tests=lib/priv-set.h
2466
  tests=lib/putenv.c
2469
  tests=lib/putenv.c
2467
  tests=lib/rmdir.c
2468
  tests=lib/setlocale.c
2470
  tests=lib/setlocale.c
2469
  tests=lib/sleep.c
2471
  tests=lib/sleep.c
2470
  tests=lib/symlink.c
2472
  tests=lib/symlink.c
2471
  tests=lib/symlinkat.c
2473
  tests=lib/symlinkat.c
2472
  tests=lib/uinttostr.c
2474
  tests=lib/uinttostr.c
2473
  tests=lib/umaxtostr.c
2475
  tests=lib/umaxtostr.c
2474
  tests=lib/unlink.c
2475
  tests=lib/unlinkat.c
2476
  tests=lib/unlinkdir.c
2476
  tests=lib/unlinkdir.c
2477
  tests=lib/unlinkdir.h
2477
  tests=lib/unlinkdir.h
2478
  tests=lib/usleep.c
2478
  tests=lib/usleep.c
2479
-- a/gl/m4/gnulib-tool.m4
2479
++ b/gl/m4/gnulib-tool.m4
Line 0 Link Here
0
-- a/gl/m4/intdiv0.m4
1
# gnulib-tool.m4 serial 2
2
dnl Copyright (C) 2004-2005, 2009-2012 Free Software Foundation, Inc.
3
dnl This file is free software; the Free Software Foundation
4
dnl gives unlimited permission to copy and/or distribute it,
5
dnl with or without modifications, as long as this notice is preserved.
6
7
dnl The following macros need not be invoked explicitly.
8
dnl Invoking them does nothing except to declare default arguments
9
dnl for "gnulib-tool --import".
10
11
dnl Usage: gl_LOCAL_DIR([DIR])
12
AC_DEFUN([gl_LOCAL_DIR], [])
13
14
dnl Usage: gl_MODULES([module1 module2 ...])
15
AC_DEFUN([gl_MODULES], [])
16
17
dnl Usage: gl_AVOID([module1 module2 ...])
18
AC_DEFUN([gl_AVOID], [])
19
20
dnl Usage: gl_SOURCE_BASE([DIR])
21
AC_DEFUN([gl_SOURCE_BASE], [])
22
23
dnl Usage: gl_M4_BASE([DIR])
24
AC_DEFUN([gl_M4_BASE], [])
25
26
dnl Usage: gl_PO_BASE([DIR])
27
AC_DEFUN([gl_PO_BASE], [])
28
29
dnl Usage: gl_DOC_BASE([DIR])
30
AC_DEFUN([gl_DOC_BASE], [])
31
32
dnl Usage: gl_TESTS_BASE([DIR])
33
AC_DEFUN([gl_TESTS_BASE], [])
34
35
dnl Usage: gl_WITH_TESTS
36
AC_DEFUN([gl_WITH_TESTS], [])
37
38
dnl Usage: gl_LIB([LIBNAME])
39
AC_DEFUN([gl_LIB], [])
40
41
dnl Usage: gl_LGPL or gl_LGPL([VERSION])
42
AC_DEFUN([gl_LGPL], [])
43
44
dnl Usage: gl_MAKEFILE_NAME([FILENAME])
45
AC_DEFUN([gl_MAKEFILE_NAME], [])
46
47
dnl Usage: gl_LIBTOOL
48
AC_DEFUN([gl_LIBTOOL], [])
49
50
dnl Usage: gl_MACRO_PREFIX([PREFIX])
51
AC_DEFUN([gl_MACRO_PREFIX], [])
52
53
dnl Usage: gl_PO_DOMAIN([DOMAIN])
54
AC_DEFUN([gl_PO_DOMAIN], [])
55
56
dnl Usage: gl_VC_FILES([BOOLEAN])
57
AC_DEFUN([gl_VC_FILES], [])
58
++ b/gl/m4/intdiv0.m4
Line 0 Link Here
0
-- a/gl/m4/intldir.m4
1
# intdiv0.m4 serial 6 (gettext-0.18.2)
2
dnl Copyright (C) 2002, 2007-2008, 2010-2012 Free Software Foundation, Inc.
3
dnl This file is free software; the Free Software Foundation
4
dnl gives unlimited permission to copy and/or distribute it,
5
dnl with or without modifications, as long as this notice is preserved.
6
7
dnl From Bruno Haible.
8
9
AC_DEFUN([gt_INTDIV0],
10
[
11
  AC_REQUIRE([AC_PROG_CC])dnl
12
  AC_REQUIRE([AC_CANONICAL_HOST])dnl
13
14
  AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
15
    gt_cv_int_divbyzero_sigfpe,
16
    [
17
      gt_cv_int_divbyzero_sigfpe=
18
changequote(,)dnl
19
      case "$host_os" in
20
        macos* | darwin[6-9]* | darwin[1-9][0-9]*)
21
          # On Mac OS X 10.2 or newer, just assume the same as when cross-
22
          # compiling. If we were to perform the real test, 1 Crash Report
23
          # dialog window would pop up.
24
          case "$host_cpu" in
25
            i[34567]86 | x86_64)
26
              gt_cv_int_divbyzero_sigfpe="guessing yes" ;;
27
          esac
28
          ;;
29
      esac
30
changequote([,])dnl
31
      if test -z "$gt_cv_int_divbyzero_sigfpe"; then
32
        AC_RUN_IFELSE(
33
          [AC_LANG_SOURCE([[
34
#include <stdlib.h>
35
#include <signal.h>
36
37
static void
38
sigfpe_handler (int sig)
39
{
40
  /* Exit with code 0 if SIGFPE, with code 1 if any other signal.  */
41
  exit (sig != SIGFPE);
42
}
43
44
int x = 1;
45
int y = 0;
46
int z;
47
int nan;
48
49
int main ()
50
{
51
  signal (SIGFPE, sigfpe_handler);
52
/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP.  */
53
#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
54
  signal (SIGTRAP, sigfpe_handler);
55
#endif
56
/* Linux/SPARC yields signal SIGILL.  */
57
#if defined (__sparc__) && defined (__linux__)
58
  signal (SIGILL, sigfpe_handler);
59
#endif
60
61
  z = x / y;
62
  nan = y / y;
63
  exit (2);
64
}
65
]])],
66
          [gt_cv_int_divbyzero_sigfpe=yes],
67
          [gt_cv_int_divbyzero_sigfpe=no],
68
          [
69
            # Guess based on the CPU.
70
changequote(,)dnl
71
            case "$host_cpu" in
72
              alpha* | i[34567]86 | x86_64 | m68k | s390*)
73
                gt_cv_int_divbyzero_sigfpe="guessing yes";;
74
              *)
75
                gt_cv_int_divbyzero_sigfpe="guessing no";;
76
            esac
77
changequote([,])dnl
78
          ])
79
      fi
80
    ])
81
  case "$gt_cv_int_divbyzero_sigfpe" in
82
    *yes) value=1;;
83
    *) value=0;;
84
  esac
85
  AC_DEFINE_UNQUOTED([INTDIV0_RAISES_SIGFPE], [$value],
86
    [Define if integer division by zero raises signal SIGFPE.])
87
])
88
++ b/gl/m4/intldir.m4
Line 0 Link Here
0
-- a/gl/m4/intl.m4
1
# intldir.m4 serial 2 (gettext-0.18)
2
dnl Copyright (C) 2006, 2009-2012 Free Software Foundation, Inc.
3
dnl This file is free software; the Free Software Foundation
4
dnl gives unlimited permission to copy and/or distribute it,
5
dnl with or without modifications, as long as this notice is preserved.
6
dnl
7
dnl This file can can be used in projects which are not available under
8
dnl the GNU General Public License or the GNU Library General Public
9
dnl License but which still want to provide support for the GNU gettext
10
dnl functionality.
11
dnl Please note that the actual code of the GNU gettext library is covered
12
dnl by the GNU Library General Public License, and the rest of the GNU
13
dnl gettext package package is covered by the GNU General Public License.
14
dnl They are *not* in the public domain.
15
16
AC_PREREQ([2.52])
17
18
dnl Tells the AM_GNU_GETTEXT macro to consider an intl/ directory.
19
AC_DEFUN([AM_GNU_GETTEXT_INTL_SUBDIR], [])
20
++ b/gl/m4/intl.m4
Line 0 Link Here
0
-- a/gl/m4/intmax.m4
1
# intl.m4 serial 17 (gettext-0.18)
2
dnl Copyright (C) 1995-2009 Free Software Foundation, Inc.
3
dnl This file is free software; the Free Software Foundation
4
dnl gives unlimited permission to copy and/or distribute it,
5
dnl with or without modifications, as long as this notice is preserved.
6
dnl
7
dnl This file can can be used in projects which are not available under
8
dnl the GNU General Public License or the GNU Library General Public
9
dnl License but which still want to provide support for the GNU gettext
10
dnl functionality.
11
dnl Please note that the actual code of the GNU gettext library is covered
12
dnl by the GNU Library General Public License, and the rest of the GNU
13
dnl gettext package package is covered by the GNU General Public License.
14
dnl They are *not* in the public domain.
15
16
dnl Authors:
17
dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
18
dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2009.
19
20
AC_PREREQ([2.52])
21
22
dnl Checks for all prerequisites of the intl subdirectory,
23
dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
24
dnl            USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
25
AC_DEFUN([AM_INTL_SUBDIR],
26
[
27
  AC_REQUIRE([AC_PROG_INSTALL])dnl
28
  AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
29
  AC_REQUIRE([AC_PROG_CC])dnl
30
  AC_REQUIRE([AC_CANONICAL_HOST])dnl
31
  AC_REQUIRE([gt_GLIBC2])dnl
32
  AC_REQUIRE([AC_PROG_RANLIB])dnl
33
  AC_REQUIRE([gl_VISIBILITY])dnl
34
  AC_REQUIRE([gt_INTL_SUBDIR_CORE])dnl
35
  AC_REQUIRE([AC_TYPE_LONG_LONG_INT])dnl
36
  AC_REQUIRE([gt_TYPE_WCHAR_T])dnl
37
  AC_REQUIRE([gt_TYPE_WINT_T])dnl
38
  AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
39
  AC_REQUIRE([gt_TYPE_INTMAX_T])
40
  AC_REQUIRE([gt_PRINTF_POSIX])
41
  AC_REQUIRE([gl_GLIBC21])dnl
42
  AC_REQUIRE([gl_XSIZE])dnl
43
  AC_REQUIRE([gl_FCNTL_O_FLAGS])dnl
44
  AC_REQUIRE([gt_INTL_MACOSX])dnl
45
46
  dnl Support for automake's --enable-silent-rules.
47
  case "$enable_silent_rules" in
48
    yes) INTL_DEFAULT_VERBOSITY=0;;
49
    no)  INTL_DEFAULT_VERBOSITY=1;;
50
    *)   INTL_DEFAULT_VERBOSITY=1;;
51
  esac
52
  AC_SUBST([INTL_DEFAULT_VERBOSITY])
53
54
  AC_CHECK_TYPE([ptrdiff_t], ,
55
    [AC_DEFINE([ptrdiff_t], [long],
56
       [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
57
    ])
58
  AC_CHECK_HEADERS([stddef.h stdlib.h string.h])
59
  AC_CHECK_FUNCS([asprintf fwprintf newlocale putenv setenv setlocale \
60
    snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb])
61
62
  dnl Use the _snprintf function only if it is declared (because on NetBSD it
63
  dnl is defined as a weak alias of snprintf; we prefer to use the latter).
64
  gt_CHECK_DECL(_snprintf, [#include <stdio.h>])
65
  gt_CHECK_DECL(_snwprintf, [#include <stdio.h>])
66
67
  dnl Use the *_unlocked functions only if they are declared.
68
  dnl (because some of them were defined without being declared in Solaris
69
  dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
70
  dnl on Solaris 2.5.1 to run on Solaris 2.6).
71
  dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
72
  gt_CHECK_DECL(getc_unlocked, [#include <stdio.h>])
73
74
  case $gt_cv_func_printf_posix in
75
    *yes) HAVE_POSIX_PRINTF=1 ;;
76
    *) HAVE_POSIX_PRINTF=0 ;;
77
  esac
78
  AC_SUBST([HAVE_POSIX_PRINTF])
79
  if test "$ac_cv_func_asprintf" = yes; then
80
    HAVE_ASPRINTF=1
81
  else
82
    HAVE_ASPRINTF=0
83
  fi
84
  AC_SUBST([HAVE_ASPRINTF])
85
  if test "$ac_cv_func_snprintf" = yes; then
86
    HAVE_SNPRINTF=1
87
  else
88
    HAVE_SNPRINTF=0
89
  fi
90
  AC_SUBST([HAVE_SNPRINTF])
91
  if test "$ac_cv_func_newlocale" = yes; then
92
    HAVE_NEWLOCALE=1
93
  else
94
    HAVE_NEWLOCALE=0
95
  fi
96
  AC_SUBST([HAVE_NEWLOCALE])
97
  if test "$ac_cv_func_wprintf" = yes; then
98
    HAVE_WPRINTF=1
99
  else
100
    HAVE_WPRINTF=0
101
  fi
102
  AC_SUBST([HAVE_WPRINTF])
103
104
  AM_LANGINFO_CODESET
105
  gt_LC_MESSAGES
106
107
  dnl Compilation on mingw and Cygwin needs special Makefile rules, because
108
  dnl 1. when we install a shared library, we must arrange to export
109
  dnl    auxiliary pointer variables for every exported variable,
110
  dnl 2. when we install a shared library and a static library simultaneously,
111
  dnl    the include file specifies __declspec(dllimport) and therefore we
112
  dnl    must arrange to define the auxiliary pointer variables for the
113
  dnl    exported variables _also_ in the static library.
114
  if test "$enable_shared" = yes; then
115
    case "$host_os" in
116
      mingw* | cygwin*) is_woe32dll=yes ;;
117
      *) is_woe32dll=no ;;
118
    esac
119
  else
120
    is_woe32dll=no
121
  fi
122
  WOE32DLL=$is_woe32dll
123
  AC_SUBST([WOE32DLL])
124
125
  dnl On mingw and Cygwin, we can activate special Makefile rules which add
126
  dnl version information to the shared libraries and executables.
127
  case "$host_os" in
128
    mingw* | cygwin*) is_woe32=yes ;;
129
    *) is_woe32=no ;;
130
  esac
131
  WOE32=$is_woe32
132
  AC_SUBST([WOE32])
133
  if test $WOE32 = yes; then
134
    dnl Check for a program that compiles Windows resource files.
135
    AC_CHECK_TOOL([WINDRES], [windres])
136
  fi
137
138
  dnl Determine whether when creating a library, "-lc" should be passed to
139
  dnl libtool or not. On many platforms, it is required for the libtool option
140
  dnl -no-undefined to work. On HP-UX, however, the -lc - stored by libtool
141
  dnl in the *.la files - makes it impossible to create multithreaded programs,
142
  dnl because libtool also reorders the -lc to come before the -pthread, and
143
  dnl this disables pthread_create() <http://docs.hp.com/en/1896/pthreads.html>.
144
  case "$host_os" in
145
    hpux*) LTLIBC="" ;;
146
    *)     LTLIBC="-lc" ;;
147
  esac
148
  AC_SUBST([LTLIBC])
149
150
  dnl Rename some macros and functions used for locking.
151
  AH_BOTTOM([
152
#define __libc_lock_t                   gl_lock_t
153
#define __libc_lock_define              gl_lock_define
154
#define __libc_lock_define_initialized  gl_lock_define_initialized
155
#define __libc_lock_init                gl_lock_init
156
#define __libc_lock_lock                gl_lock_lock
157
#define __libc_lock_unlock              gl_lock_unlock
158
#define __libc_lock_recursive_t                   gl_recursive_lock_t
159
#define __libc_lock_define_recursive              gl_recursive_lock_define
160
#define __libc_lock_define_initialized_recursive  gl_recursive_lock_define_initialized
161
#define __libc_lock_init_recursive                gl_recursive_lock_init
162
#define __libc_lock_lock_recursive                gl_recursive_lock_lock
163
#define __libc_lock_unlock_recursive              gl_recursive_lock_unlock
164
#define glthread_in_use  libintl_thread_in_use
165
#define glthread_lock_init_func     libintl_lock_init_func
166
#define glthread_lock_lock_func     libintl_lock_lock_func
167
#define glthread_lock_unlock_func   libintl_lock_unlock_func
168
#define glthread_lock_destroy_func  libintl_lock_destroy_func
169
#define glthread_rwlock_init_multithreaded     libintl_rwlock_init_multithreaded
170
#define glthread_rwlock_init_func              libintl_rwlock_init_func
171
#define glthread_rwlock_rdlock_multithreaded   libintl_rwlock_rdlock_multithreaded
172
#define glthread_rwlock_rdlock_func            libintl_rwlock_rdlock_func
173
#define glthread_rwlock_wrlock_multithreaded   libintl_rwlock_wrlock_multithreaded
174
#define glthread_rwlock_wrlock_func            libintl_rwlock_wrlock_func
175
#define glthread_rwlock_unlock_multithreaded   libintl_rwlock_unlock_multithreaded
176
#define glthread_rwlock_unlock_func            libintl_rwlock_unlock_func
177
#define glthread_rwlock_destroy_multithreaded  libintl_rwlock_destroy_multithreaded
178
#define glthread_rwlock_destroy_func           libintl_rwlock_destroy_func
179
#define glthread_recursive_lock_init_multithreaded     libintl_recursive_lock_init_multithreaded
180
#define glthread_recursive_lock_init_func              libintl_recursive_lock_init_func
181
#define glthread_recursive_lock_lock_multithreaded     libintl_recursive_lock_lock_multithreaded
182
#define glthread_recursive_lock_lock_func              libintl_recursive_lock_lock_func
183
#define glthread_recursive_lock_unlock_multithreaded   libintl_recursive_lock_unlock_multithreaded
184
#define glthread_recursive_lock_unlock_func            libintl_recursive_lock_unlock_func
185
#define glthread_recursive_lock_destroy_multithreaded  libintl_recursive_lock_destroy_multithreaded
186
#define glthread_recursive_lock_destroy_func           libintl_recursive_lock_destroy_func
187
#define glthread_once_func            libintl_once_func
188
#define glthread_once_singlethreaded  libintl_once_singlethreaded
189
#define glthread_once_multithreaded   libintl_once_multithreaded
190
])
191
])
192
193
194
dnl Checks for the core files of the intl subdirectory:
195
dnl   dcigettext.c
196
dnl   eval-plural.h
197
dnl   explodename.c
198
dnl   finddomain.c
199
dnl   gettextP.h
200
dnl   gmo.h
201
dnl   hash-string.h hash-string.c
202
dnl   l10nflist.c
203
dnl   libgnuintl.h.in (except the *printf stuff)
204
dnl   loadinfo.h
205
dnl   loadmsgcat.c
206
dnl   localealias.c
207
dnl   log.c
208
dnl   plural-exp.h plural-exp.c
209
dnl   plural.y
210
dnl Used by libglocale.
211
AC_DEFUN([gt_INTL_SUBDIR_CORE],
212
[
213
  AC_REQUIRE([AC_C_INLINE])dnl
214
  AC_REQUIRE([AC_TYPE_SIZE_T])dnl
215
  AC_REQUIRE([gl_AC_HEADER_STDINT_H])
216
  AC_REQUIRE([AC_FUNC_ALLOCA])dnl
217
  AC_REQUIRE([AC_FUNC_MMAP])dnl
218
  AC_REQUIRE([gt_INTDIV0])dnl
219
  AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])dnl
220
  AC_REQUIRE([gt_INTTYPES_PRI])dnl
221
  AC_REQUIRE([gl_LOCK])dnl
222
223
  AC_TRY_LINK(
224
    [int foo (int a) { a = __builtin_expect (a, 10); return a == 10 ? 0 : 1; }],
225
    [],
226
    [AC_DEFINE([HAVE_BUILTIN_EXPECT], [1],
227
       [Define to 1 if the compiler understands __builtin_expect.])])
228
229
  AC_CHECK_HEADERS([argz.h inttypes.h limits.h unistd.h sys/param.h])
230
  AC_CHECK_FUNCS([getcwd getegid geteuid getgid getuid mempcpy munmap \
231
    stpcpy strcasecmp strdup strtoul tsearch uselocale argz_count \
232
    argz_stringify argz_next __fsetlocking])
233
234
  dnl Use the *_unlocked functions only if they are declared.
235
  dnl (because some of them were defined without being declared in Solaris
236
  dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
237
  dnl on Solaris 2.5.1 to run on Solaris 2.6).
238
  dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
239
  gt_CHECK_DECL([feof_unlocked], [#include <stdio.h>])
240
  gt_CHECK_DECL([fgets_unlocked], [#include <stdio.h>])
241
242
  AM_ICONV
243
244
  dnl intl/plural.c is generated from intl/plural.y. It requires bison,
245
  dnl because plural.y uses bison specific features. It requires at least
246
  dnl bison-1.26 because earlier versions generate a plural.c that doesn't
247
  dnl compile.
248
  dnl bison is only needed for the maintainer (who touches plural.y). But in
249
  dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
250
  dnl the rule in general Makefile. Now, some people carelessly touch the
251
  dnl files or have a broken "make" program, hence the plural.c rule will
252
  dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
253
  dnl present or too old.
254
  AC_CHECK_PROGS([INTLBISON], [bison])
255
  if test -z "$INTLBISON"; then
256
    ac_verc_fail=yes
257
  else
258
    dnl Found it, now check the version.
259
    AC_MSG_CHECKING([version of bison])
260
changequote(<<,>>)dnl
261
    ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
262
    case $ac_prog_version in
263
      '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
264
      1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
265
changequote([,])dnl
266
         ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
267
      *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
268
    esac
269
    AC_MSG_RESULT([$ac_prog_version])
270
  fi
271
  if test $ac_verc_fail = yes; then
272
    INTLBISON=:
273
  fi
274
])
275
276
277
dnl gt_CHECK_DECL(FUNC, INCLUDES)
278
dnl Check whether a function is declared.
279
AC_DEFUN([gt_CHECK_DECL],
280
[
281
  AC_CACHE_CHECK([whether $1 is declared], [ac_cv_have_decl_$1],
282
    [AC_TRY_COMPILE([$2], [
283
#ifndef $1
284
  char *p = (char *) $1;
285
#endif
286
], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)])
287
  if test $ac_cv_have_decl_$1 = yes; then
288
    gt_value=1
289
  else
290
    gt_value=0
291
  fi
292
  AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value],
293
    [Define to 1 if you have the declaration of `$1', and to 0 if you don't.])
294
])
295
++ b/gl/m4/intmax.m4
Line 0 Link Here
0
-- a/gl/m4/printf-posix.m4
1
# intmax.m4 serial 6 (gettext-0.18.2)
2
dnl Copyright (C) 2002-2005, 2008-2012 Free Software Foundation, Inc.
3
dnl This file is free software; the Free Software Foundation
4
dnl gives unlimited permission to copy and/or distribute it,
5
dnl with or without modifications, as long as this notice is preserved.
6
7
dnl From Bruno Haible.
8
dnl Test whether the system has the 'intmax_t' type, but don't attempt to
9
dnl find a replacement if it is lacking.
10
11
AC_DEFUN([gt_TYPE_INTMAX_T],
12
[
13
  AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
14
  AC_REQUIRE([gl_AC_HEADER_STDINT_H])
15
  AC_CACHE_CHECK([for intmax_t], [gt_cv_c_intmax_t],
16
    [AC_COMPILE_IFELSE(
17
       [AC_LANG_PROGRAM(
18
          [[
19
#include <stddef.h>
20
#include <stdlib.h>
21
#if HAVE_STDINT_H_WITH_UINTMAX
22
#include <stdint.h>
23
#endif
24
#if HAVE_INTTYPES_H_WITH_UINTMAX
25
#include <inttypes.h>
26
#endif
27
          ]],
28
          [[intmax_t x = -1;
29
            return !x;]])],
30
       [gt_cv_c_intmax_t=yes],
31
       [gt_cv_c_intmax_t=no])])
32
  if test $gt_cv_c_intmax_t = yes; then
33
    AC_DEFINE([HAVE_INTMAX_T], [1],
34
      [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
35
  fi
36
])
37
++ b/gl/m4/printf-posix.m4
Line 0 Link Here
0
-- a/gl/m4/sockpfaf.m4
1
# printf-posix.m4 serial 6 (gettext-0.18.2)
2
dnl Copyright (C) 2003, 2007, 2009-2012 Free Software Foundation, Inc.
3
dnl This file is free software; the Free Software Foundation
4
dnl gives unlimited permission to copy and/or distribute it,
5
dnl with or without modifications, as long as this notice is preserved.
6
7
dnl From Bruno Haible.
8
dnl Test whether the printf() function supports POSIX/XSI format strings with
9
dnl positions.
10
11
AC_DEFUN([gt_PRINTF_POSIX],
12
[
13
  AC_REQUIRE([AC_PROG_CC])
14
  AC_CACHE_CHECK([whether printf() supports POSIX/XSI format strings],
15
    gt_cv_func_printf_posix,
16
    [
17
      AC_RUN_IFELSE(
18
        [AC_LANG_SOURCE([[
19
#include <stdio.h>
20
#include <string.h>
21
/* The string "%2$d %1$d", with dollar characters protected from the shell's
22
   dollar expansion (possibly an autoconf bug).  */
23
static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' };
24
static char buf[100];
25
int main ()
26
{
27
  sprintf (buf, format, 33, 55);
28
  return (strcmp (buf, "55 33") != 0);
29
}]])],
30
        [gt_cv_func_printf_posix=yes],
31
        [gt_cv_func_printf_posix=no],
32
        [
33
          AC_EGREP_CPP([notposix], [
34
#if defined __NetBSD__ || defined __BEOS__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__
35
  notposix
36
#endif
37
            ],
38
            [gt_cv_func_printf_posix="guessing no"],
39
            [gt_cv_func_printf_posix="guessing yes"])
40
        ])
41
    ])
42
  case $gt_cv_func_printf_posix in
43
    *yes)
44
      AC_DEFINE([HAVE_POSIX_PRINTF], [1],
45
        [Define if your printf() function supports format strings with positions.])
46
      ;;
47
  esac
48
])
49
++ b/gl/m4/sockpfaf.m4
Line 0 Link Here
0
-- a/gl/m4/uintmax_t.m4
1
# sockpfaf.m4 serial 8
2
dnl Copyright (C) 2004, 2006, 2009-2012 Free Software Foundation, Inc.
3
dnl This file is free software; the Free Software Foundation
4
dnl gives unlimited permission to copy and/or distribute it,
5
dnl with or without modifications, as long as this notice is preserved.
6
7
dnl Test for some common socket protocol families (PF_INET, PF_INET6, ...)
8
dnl and some common address families (AF_INET, AF_INET6, ...).
9
dnl This test assumes that a system supports an address family if and only if
10
dnl it supports the corresponding protocol family.
11
12
dnl From Bruno Haible.
13
14
AC_DEFUN([gl_SOCKET_FAMILIES],
15
[
16
  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
17
  AC_CHECK_HEADERS_ONCE([netinet/in.h])
18
19
  AC_MSG_CHECKING([for IPv4 sockets])
20
  AC_CACHE_VAL([gl_cv_socket_ipv4],
21
    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
22
#ifdef HAVE_SYS_SOCKET_H
23
#include <sys/socket.h>
24
#endif
25
#ifdef HAVE_NETINET_IN_H
26
#include <netinet/in.h>
27
#endif
28
#ifdef HAVE_WINSOCK2_H
29
#include <winsock2.h>
30
#endif]],
31
[[int x = AF_INET; struct in_addr y; struct sockaddr_in z;
32
 if (&x && &y && &z) return 0;]])],
33
       gl_cv_socket_ipv4=yes, gl_cv_socket_ipv4=no)])
34
  AC_MSG_RESULT([$gl_cv_socket_ipv4])
35
  if test $gl_cv_socket_ipv4 = yes; then
36
    AC_DEFINE([HAVE_IPV4], [1], [Define to 1 if <sys/socket.h> defines AF_INET.])
37
  fi
38
39
  AC_MSG_CHECKING([for IPv6 sockets])
40
  AC_CACHE_VAL([gl_cv_socket_ipv6],
41
    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
42
#ifdef HAVE_SYS_SOCKET_H
43
#include <sys/socket.h>
44
#endif
45
#ifdef HAVE_NETINET_IN_H
46
#include <netinet/in.h>
47
#endif
48
#ifdef HAVE_WINSOCK2_H
49
#include <winsock2.h>
50
#endif
51
#ifdef HAVE_WS2TCPIP_H
52
#include <ws2tcpip.h>
53
#endif]],
54
[[int x = AF_INET6; struct in6_addr y; struct sockaddr_in6 z;
55
 if (&x && &y && &z) return 0;]])],
56
       gl_cv_socket_ipv6=yes, gl_cv_socket_ipv6=no)])
57
  AC_MSG_RESULT([$gl_cv_socket_ipv6])
58
  if test $gl_cv_socket_ipv6 = yes; then
59
    AC_DEFINE([HAVE_IPV6], [1], [Define to 1 if <sys/socket.h> defines AF_INET6.])
60
  fi
61
])
62
63
AC_DEFUN([gl_SOCKET_FAMILY_UNIX],
64
[
65
  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
66
  AC_CHECK_HEADERS_ONCE([sys/un.h])
67
68
  AC_MSG_CHECKING([for UNIX domain sockets])
69
  AC_CACHE_VAL([gl_cv_socket_unix],
70
    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
71
#ifdef HAVE_SYS_SOCKET_H
72
#include <sys/socket.h>
73
#endif
74
#ifdef HAVE_SYS_UN_H
75
#include <sys/un.h>
76
#endif
77
#ifdef HAVE_WINSOCK2_H
78
#include <winsock2.h>
79
#endif]],
80
[[int x = AF_UNIX; struct sockaddr_un y;
81
 if (&x && &y) return 0;]])],
82
       gl_cv_socket_unix=yes, gl_cv_socket_unix=no)])
83
  AC_MSG_RESULT([$gl_cv_socket_unix])
84
  if test $gl_cv_socket_unix = yes; then
85
    AC_DEFINE([HAVE_UNIXSOCKET], [1], [Define to 1 if <sys/socket.h> defines AF_UNIX.])
86
  fi
87
])
88
++ b/gl/m4/uintmax_t.m4
Line 0 Link Here
0
-- a/gl/m4/visibility.m4
1
# uintmax_t.m4 serial 12
2
dnl Copyright (C) 1997-2004, 2007-2012 Free Software Foundation, Inc.
3
dnl This file is free software; the Free Software Foundation
4
dnl gives unlimited permission to copy and/or distribute it,
5
dnl with or without modifications, as long as this notice is preserved.
6
7
dnl From Paul Eggert.
8
9
AC_PREREQ([2.13])
10
11
# Define uintmax_t to 'unsigned long' or 'unsigned long long'
12
# if it is not already defined in <stdint.h> or <inttypes.h>.
13
14
AC_DEFUN([gl_AC_TYPE_UINTMAX_T],
15
[
16
  AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
17
  AC_REQUIRE([gl_AC_HEADER_STDINT_H])
18
  if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then
19
    AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
20
    test $ac_cv_type_unsigned_long_long_int = yes \
21
      && ac_type='unsigned long long' \
22
      || ac_type='unsigned long'
23
    AC_DEFINE_UNQUOTED([uintmax_t], [$ac_type],
24
      [Define to unsigned long or unsigned long long
25
       if <stdint.h> and <inttypes.h> don't define.])
26
  else
27
    AC_DEFINE([HAVE_UINTMAX_T], [1],
28
      [Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.])
29
  fi
30
])
31
++ b/gl/m4/visibility.m4
Line 0 Link Here
1
# visibility.m4 serial 5 (gettext-0.18.2)
2
dnl Copyright (C) 2005, 2008, 2010-2012 Free Software Foundation, Inc.
3
dnl This file is free software; the Free Software Foundation
4
dnl gives unlimited permission to copy and/or distribute it,
5
dnl with or without modifications, as long as this notice is preserved.
6
7
dnl From Bruno Haible.
8
9
dnl Tests whether the compiler supports the command-line option
10
dnl -fvisibility=hidden and the function and variable attributes
11
dnl __attribute__((__visibility__("hidden"))) and
12
dnl __attribute__((__visibility__("default"))).
13
dnl Does *not* test for __visibility__("protected") - which has tricky
14
dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on
15
dnl Mac OS X.
16
dnl Does *not* test for __visibility__("internal") - which has processor
17
dnl dependent semantics.
18
dnl Does *not* test for #pragma GCC visibility push(hidden) - which is
19
dnl "really only recommended for legacy code".
20
dnl Set the variable CFLAG_VISIBILITY.
21
dnl Defines and sets the variable HAVE_VISIBILITY.
22
23
AC_DEFUN([gl_VISIBILITY],
24
[
25
  AC_REQUIRE([AC_PROG_CC])
26
  CFLAG_VISIBILITY=
27
  HAVE_VISIBILITY=0
28
  if test -n "$GCC"; then
29
    dnl First, check whether -Werror can be added to the command line, or
30
    dnl whether it leads to an error because of some other option that the
31
    dnl user has put into $CC $CFLAGS $CPPFLAGS.
32
    AC_MSG_CHECKING([whether the -Werror option is usable])
33
    AC_CACHE_VAL([gl_cv_cc_vis_werror], [
34
      gl_save_CFLAGS="$CFLAGS"
35
      CFLAGS="$CFLAGS -Werror"
36
      AC_COMPILE_IFELSE(
37
        [AC_LANG_PROGRAM([[]], [[]])],
38
        [gl_cv_cc_vis_werror=yes],
39
        [gl_cv_cc_vis_werror=no])
40
      CFLAGS="$gl_save_CFLAGS"])
41
    AC_MSG_RESULT([$gl_cv_cc_vis_werror])
42
    dnl Now check whether visibility declarations are supported.
43
    AC_MSG_CHECKING([for simple visibility declarations])
44
    AC_CACHE_VAL([gl_cv_cc_visibility], [
45
      gl_save_CFLAGS="$CFLAGS"
46
      CFLAGS="$CFLAGS -fvisibility=hidden"
47
      dnl We use the option -Werror and a function dummyfunc, because on some
48
      dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning
49
      dnl "visibility attribute not supported in this configuration; ignored"
50
      dnl at the first function definition in every compilation unit, and we
51
      dnl don't want to use the option in this case.
52
      if test $gl_cv_cc_vis_werror = yes; then
53
        CFLAGS="$CFLAGS -Werror"
54
      fi
55
      AC_COMPILE_IFELSE(
56
        [AC_LANG_PROGRAM(
57
           [[extern __attribute__((__visibility__("hidden"))) int hiddenvar;
58
             extern __attribute__((__visibility__("default"))) int exportedvar;
59
             extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
60
             extern __attribute__((__visibility__("default"))) int exportedfunc (void);
61
             void dummyfunc (void) {}
62
           ]],
63
           [[]])],
64
        [gl_cv_cc_visibility=yes],
65
        [gl_cv_cc_visibility=no])
66
      CFLAGS="$gl_save_CFLAGS"])
67
    AC_MSG_RESULT([$gl_cv_cc_visibility])
68
    if test $gl_cv_cc_visibility = yes; then
69
      CFLAG_VISIBILITY="-fvisibility=hidden"
70
      HAVE_VISIBILITY=1
71
    fi
72
  fi
73
  AC_SUBST([CFLAG_VISIBILITY])
74
  AC_SUBST([HAVE_VISIBILITY])
75
  AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY],
76
    [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.])
77
])

Return to bug 469206