Added to the repository by gnulib-sync
Showing
89 changed files
with
3959 additions
and
0 deletions
lib/xstrtoul.c
0 → 100644
m4/alloca.m4
0 → 100644
1 | # alloca.m4 serial 5 | ||
2 | dnl Copyright (C) 2002, 2003, 2004 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 | AC_DEFUN([gl_FUNC_ALLOCA], | ||
8 | [ | ||
9 | dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57. | ||
10 | AC_REQUIRE([AC_PROG_CPP]) | ||
11 | AC_REQUIRE([AC_PROG_EGREP]) | ||
12 | |||
13 | AC_REQUIRE([AC_FUNC_ALLOCA]) | ||
14 | if test $ac_cv_func_alloca_works = no; then | ||
15 | gl_PREREQ_ALLOCA | ||
16 | fi | ||
17 | |||
18 | # Define an additional variable used in the Makefile substitution. | ||
19 | if test $ac_cv_working_alloca_h = yes; then | ||
20 | AC_EGREP_CPP([Need own alloca], [ | ||
21 | #if defined __GNUC__ || defined _AIX || defined _MSC_VER | ||
22 | Need own alloca | ||
23 | #endif | ||
24 | ], | ||
25 | [AC_DEFINE(HAVE_ALLOCA, 1, | ||
26 | [Define to 1 if you have `alloca' after including <alloca.h>, | ||
27 | a header that may be supplied by this distribution.]) | ||
28 | ALLOCA_H=alloca.h], | ||
29 | [ALLOCA_H=]) | ||
30 | else | ||
31 | ALLOCA_H=alloca.h | ||
32 | fi | ||
33 | AC_SUBST([ALLOCA_H]) | ||
34 | |||
35 | AC_DEFINE(HAVE_ALLOCA_H, 1, | ||
36 | [Define HAVE_ALLOCA_H for backward compatibility with older code | ||
37 | that includes <alloca.h> only if HAVE_ALLOCA_H is defined.]) | ||
38 | ]) | ||
39 | |||
40 | # Prerequisites of lib/alloca.c. | ||
41 | # STACK_DIRECTION is already handled by AC_FUNC_ALLOCA. | ||
42 | AC_DEFUN([gl_PREREQ_ALLOCA], [:]) |
m4/allocsa.m4
0 → 100644
1 | # allocsa.m4 serial 3 | ||
2 | dnl Copyright (C) 2003-2004 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 | AC_DEFUN([gl_ALLOCSA], | ||
8 | [ | ||
9 | dnl Use the autoconf tests for alloca(), but not the AC_SUBSTed variables | ||
10 | dnl @ALLOCA@ and @LTALLOCA@. | ||
11 | AC_REQUIRE([gl_FUNC_ALLOCA]) | ||
12 | AC_REQUIRE([gl_EEMALLOC]) | ||
13 | AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) | ||
14 | AC_REQUIRE([gt_TYPE_LONGDOUBLE]) | ||
15 | ]) |
m4/argp.m4
0 → 100644
1 | # argp.m4 serial 4 | ||
2 | dnl Copyright (C) 2003, 2004 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 | AC_DEFUN([gl_ARGP], | ||
8 | [ | ||
9 | AC_REQUIRE([AC_C_INLINE]) | ||
10 | dnl AC_REQUIRE([gl_FUNC_GLIBC_UNLOCKED_IO]) | ||
11 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | ||
12 | AC_REQUIRE([gl_GETOPT_SUBSTITUTE]) | ||
13 | AC_CHECK_DECLS([program_invocation_name, program_invocation_short_name],,, | ||
14 | [#include <errno.h>]) | ||
15 | AC_CHECK_FUNCS_ONCE([flockfile funlockfile]) | ||
16 | AC_CHECK_HEADERS_ONCE([features.h linewrap.h]) | ||
17 | ]) |
m4/eealloc.m4
0 → 100644
1 | # eealloc.m4 serial 1 | ||
2 | dnl Copyright (C) 2003 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 | AC_DEFUN([gl_EEALLOC], | ||
8 | [ | ||
9 | AC_REQUIRE([gl_EEMALLOC]) | ||
10 | AC_REQUIRE([gl_EEREALLOC]) | ||
11 | AC_REQUIRE([AC_C_INLINE]) | ||
12 | ]) | ||
13 | |||
14 | AC_DEFUN([gl_EEMALLOC], | ||
15 | [ | ||
16 | _AC_FUNC_MALLOC_IF( | ||
17 | [gl_cv_func_malloc_0_nonnull=1], | ||
18 | [gl_cv_func_malloc_0_nonnull=0]) | ||
19 | AC_DEFINE_UNQUOTED([MALLOC_0_IS_NONNULL], $gl_cv_func_malloc_0_nonnull, | ||
20 | [If malloc(0) is != NULL, define this to 1. Otherwise define this | ||
21 | to 0.]) | ||
22 | ]) | ||
23 | |||
24 | AC_DEFUN([gl_EEREALLOC], | ||
25 | [ | ||
26 | _AC_FUNC_REALLOC_IF( | ||
27 | [gl_cv_func_realloc_0_nonnull=1], | ||
28 | [gl_cv_func_realloc_0_nonnull=0]) | ||
29 | AC_DEFINE_UNQUOTED([REALLOC_0_IS_NONNULL], $gl_cv_func_realloc_0_nonnull, | ||
30 | [If realloc(NULL,0) is != NULL, define this to 1. Otherwise define this | ||
31 | to 0.]) | ||
32 | ]) |
m4/eoverflow.m4
0 → 100644
1 | # eoverflow.m4 serial 1 | ||
2 | dnl Copyright (C) 2004 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 | # The EOVERFLOW errno value ought to be defined in <errno.h>, according to | ||
10 | # POSIX. But some systems (like AIX 3) don't define it, and some systems | ||
11 | # (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined. | ||
12 | |||
13 | # Define EOVERFLOW as a C macro and as a substituted macro in such a way that | ||
14 | # 1. on all systems, after inclusion of <errno.h>, EOVERFLOW is usable, | ||
15 | # 2. on systems where EOVERFLOW is defined elsewhere, we use the same numeric | ||
16 | # value. | ||
17 | |||
18 | AC_DEFUN([gl_EOVERFLOW], | ||
19 | [ | ||
20 | AC_REQUIRE([AC_PROG_CC])dnl | ||
21 | |||
22 | AC_CACHE_CHECK([for EOVERFLOW], ac_cv_decl_EOVERFLOW, [ | ||
23 | AC_EGREP_CPP(yes,[ | ||
24 | #include <errno.h> | ||
25 | #ifdef EOVERFLOW | ||
26 | yes | ||
27 | #endif | ||
28 | ], have_eoverflow=1) | ||
29 | if test -n "$have_eoverflow"; then | ||
30 | dnl EOVERFLOW exists in <errno.h>. Don't need to define EOVERFLOW ourselves. | ||
31 | ac_cv_decl_EOVERFLOW=yes | ||
32 | else | ||
33 | AC_EGREP_CPP(yes,[ | ||
34 | #define _XOPEN_SOURCE_EXTENDED 1 | ||
35 | #include <errno.h> | ||
36 | #ifdef EOVERFLOW | ||
37 | yes | ||
38 | #endif | ||
39 | ], have_eoverflow=1) | ||
40 | if test -n "$have_eoverflow"; then | ||
41 | dnl EOVERFLOW exists but is hidden. | ||
42 | dnl Define it to the same value. | ||
43 | _AC_COMPUTE_INT([EOVERFLOW], ac_cv_decl_EOVERFLOW, [ | ||
44 | #define _XOPEN_SOURCE_EXTENDED 1 | ||
45 | #include <errno.h> | ||
46 | /* The following two lines are a workaround against an autoconf-2.52 bug. */ | ||
47 | #include <stdio.h> | ||
48 | #include <stdlib.h> | ||
49 | ]) | ||
50 | else | ||
51 | dnl EOVERFLOW isn't defined by the system. Define EOVERFLOW ourselves, but | ||
52 | dnl don't define it as EINVAL, because snprintf() callers want to | ||
53 | dnl distinguish EINVAL and EOVERFLOW. | ||
54 | ac_cv_decl_EOVERFLOW=E2BIG | ||
55 | fi | ||
56 | fi | ||
57 | ]) | ||
58 | if test "$ac_cv_decl_EOVERFLOW" != yes; then | ||
59 | AC_DEFINE_UNQUOTED([EOVERFLOW], [$ac_cv_decl_EOVERFLOW], | ||
60 | [Define as good substitute value for EOVERFLOW.]) | ||
61 | EOVERFLOW="$ac_cv_decl_EOVERFLOW" | ||
62 | AC_SUBST(EOVERFLOW) | ||
63 | fi | ||
64 | ]) |
m4/error.m4
0 → 100644
1 | #serial 11 | ||
2 | |||
3 | # Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2004 Free Software | ||
4 | # Foundation, Inc. | ||
5 | # | ||
6 | # This file is free software; the Free Software Foundation | ||
7 | # gives unlimited permission to copy and/or distribute it, | ||
8 | # with or without modifications, as long as this notice is preserved. | ||
9 | |||
10 | AC_DEFUN([gl_ERROR], | ||
11 | [ | ||
12 | AC_FUNC_ERROR_AT_LINE | ||
13 | dnl Note: AC_FUNC_ERROR_AT_LINE does AC_LIBSOURCES([error.h, error.c]). | ||
14 | gl_PREREQ_ERROR | ||
15 | ]) | ||
16 | |||
17 | # Prerequisites of lib/error.c. | ||
18 | AC_DEFUN([gl_PREREQ_ERROR], | ||
19 | [ | ||
20 | AC_REQUIRE([AC_FUNC_STRERROR_R]) | ||
21 | : | ||
22 | ]) |
m4/exitfail.m4
0 → 100644
1 | # exitfail.m4 serial 4 | ||
2 | dnl Copyright (C) 2002, 2003 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 | AC_DEFUN([gl_EXITFAIL], | ||
8 | [ | ||
9 | dnl No prerequisites of lib/exitfail.c. | ||
10 | : | ||
11 | ]) |
m4/extensions.m4
0 → 100644
1 | # Enable extensions on systems that normally disable them. | ||
2 | |||
3 | # Copyright (C) 2003 Free Software Foundation, Inc. | ||
4 | # This file is free software; the Free Software Foundation | ||
5 | # gives unlimited permission to copy and/or distribute it, | ||
6 | # with or without modifications, as long as this notice is preserved. | ||
7 | |||
8 | # gl_USE_SYSTEM_EXTENSIONS | ||
9 | # ------------------------ | ||
10 | # Enable extensions on systems that normally disable them, | ||
11 | # typically due to standards-conformance issues. | ||
12 | AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], [ | ||
13 | AC_BEFORE([$0], [AC_COMPILE_IFELSE]) | ||
14 | AC_BEFORE([$0], [AC_RUN_IFELSE]) | ||
15 | |||
16 | AC_REQUIRE([AC_GNU_SOURCE]) | ||
17 | AC_REQUIRE([AC_AIX]) | ||
18 | AC_REQUIRE([AC_MINIX]) | ||
19 | |||
20 | AH_VERBATIM([__EXTENSIONS__], | ||
21 | [/* Enable extensions on Solaris. */ | ||
22 | #ifndef __EXTENSIONS__ | ||
23 | # undef __EXTENSIONS__ | ||
24 | #endif]) | ||
25 | AC_DEFINE([__EXTENSIONS__]) | ||
26 | ]) |
m4/fnmatch.m4
0 → 100644
1 | # Check for fnmatch. | ||
2 | |||
3 | # This is a modified version of autoconf's AC_FUNC_FNMATCH. | ||
4 | # This file should be simplified after Autoconf 2.57 is required. | ||
5 | |||
6 | # Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. | ||
7 | # This file is free software; the Free Software Foundation | ||
8 | # gives unlimited permission to copy and/or distribute it, | ||
9 | # with or without modifications, as long as this notice is preserved. | ||
10 | |||
11 | # _AC_FUNC_FNMATCH_IF(STANDARD = GNU | POSIX, CACHE_VAR, IF-TRUE, IF-FALSE) | ||
12 | # ------------------------------------------------------------------------- | ||
13 | # If a STANDARD compliant fnmatch is found, run IF-TRUE, otherwise | ||
14 | # IF-FALSE. Use CACHE_VAR. | ||
15 | AC_DEFUN([_AC_FUNC_FNMATCH_IF], | ||
16 | [AC_CACHE_CHECK( | ||
17 | [for working $1 fnmatch], | ||
18 | [$2], | ||
19 | [dnl Some versions of Solaris, SCO, and the GNU C Library | ||
20 | dnl have a broken or incompatible fnmatch. | ||
21 | dnl So we run a test program. If we are cross-compiling, take no chance. | ||
22 | dnl Thanks to John Oleynick, François Pinard, and Paul Eggert for this test. | ||
23 | AC_RUN_IFELSE( | ||
24 | [AC_LANG_PROGRAM( | ||
25 | [ | ||
26 | # include <stdlib.h> | ||
27 | # include <fnmatch.h> | ||
28 | # define y(a, b, c) (fnmatch (a, b, c) == 0) | ||
29 | # define n(a, b, c) (fnmatch (a, b, c) == FNM_NOMATCH) | ||
30 | ], | ||
31 | [exit | ||
32 | (!(y ("a*", "abc", 0) | ||
33 | && n ("d*/*1", "d/s/1", FNM_PATHNAME) | ||
34 | && y ("a\\\\bc", "abc", 0) | ||
35 | && n ("a\\\\bc", "abc", FNM_NOESCAPE) | ||
36 | && y ("*x", ".x", 0) | ||
37 | && n ("*x", ".x", FNM_PERIOD) | ||
38 | && m4_if([$1], [GNU], | ||
39 | [y ("xxXX", "xXxX", FNM_CASEFOLD) | ||
40 | && y ("a++(x|yy)b", "a+xyyyyxb", FNM_EXTMATCH) | ||
41 | && n ("d*/*1", "d/s/1", FNM_FILE_NAME) | ||
42 | && y ("*", "x", FNM_FILE_NAME | FNM_LEADING_DIR) | ||
43 | && y ("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR) | ||
44 | && y ("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR)], | ||
45 | 1)));])], | ||
46 | [$2=yes], | ||
47 | [$2=no], | ||
48 | [$2=cross])]) | ||
49 | AS_IF([test $$2 = yes], [$3], [$4]) | ||
50 | ])# _AC_FUNC_FNMATCH_IF | ||
51 | |||
52 | |||
53 | # _AC_LIBOBJ_FNMATCH | ||
54 | # ------------------ | ||
55 | # Prepare the replacement of fnmatch. | ||
56 | AC_DEFUN([_AC_LIBOBJ_FNMATCH], | ||
57 | [AC_REQUIRE([AC_C_CONST])dnl | ||
58 | AC_REQUIRE([AC_FUNC_ALLOCA])dnl | ||
59 | AC_REQUIRE([AC_TYPE_MBSTATE_T])dnl | ||
60 | AC_CHECK_DECLS([getenv]) | ||
61 | AC_CHECK_FUNCS([btowc mbsrtowcs mempcpy wmemchr wmemcpy wmempcpy]) | ||
62 | AC_CHECK_HEADERS([wchar.h wctype.h]) | ||
63 | AC_LIBOBJ([fnmatch]) | ||
64 | FNMATCH_H=fnmatch.h | ||
65 | ])# _AC_LIBOBJ_FNMATCH | ||
66 | |||
67 | |||
68 | AC_DEFUN([gl_FUNC_FNMATCH_POSIX], | ||
69 | [ | ||
70 | FNMATCH_H= | ||
71 | _AC_FUNC_FNMATCH_IF([POSIX], [ac_cv_func_fnmatch_posix], | ||
72 | [rm -f lib/fnmatch.h], | ||
73 | [_AC_LIBOBJ_FNMATCH]) | ||
74 | if test $ac_cv_func_fnmatch_posix != yes; then | ||
75 | dnl We must choose a different name for our function, since on ELF systems | ||
76 | dnl a broken fnmatch() in libc.so would override our fnmatch() if it is | ||
77 | dnl compiled into a shared library. | ||
78 | AC_DEFINE([fnmatch], [posix_fnmatch], | ||
79 | [Define to a replacement function name for fnmatch().]) | ||
80 | fi | ||
81 | AC_SUBST([FNMATCH_H]) | ||
82 | ]) | ||
83 | |||
84 | |||
85 | AC_DEFUN([gl_FUNC_FNMATCH_GNU], | ||
86 | [ | ||
87 | dnl Persuade glibc <fnmatch.h> to declare FNM_CASEFOLD etc. | ||
88 | AC_REQUIRE([AC_GNU_SOURCE]) | ||
89 | |||
90 | FNMATCH_H= | ||
91 | _AC_FUNC_FNMATCH_IF([GNU], [ac_cv_func_fnmatch_gnu], | ||
92 | [rm -f lib/fnmatch.h], | ||
93 | [_AC_LIBOBJ_FNMATCH]) | ||
94 | if test $ac_cv_func_fnmatch_gnu != yes; then | ||
95 | dnl We must choose a different name for our function, since on ELF systems | ||
96 | dnl a broken fnmatch() in libc.so would override our fnmatch() if it is | ||
97 | dnl compiled into a shared library. | ||
98 | AC_DEFINE([fnmatch], [gnu_fnmatch], | ||
99 | [Define to a replacement function name for fnmatch().]) | ||
100 | fi | ||
101 | AC_SUBST([FNMATCH_H]) | ||
102 | ]) |
m4/getline.m4
0 → 100644
1 | # getline.m4 serial 11 | ||
2 | |||
3 | dnl Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software | ||
4 | dnl Foundation, Inc. | ||
5 | dnl | ||
6 | dnl This file is free software; the Free Software Foundation | ||
7 | dnl gives unlimited permission to copy and/or distribute it, | ||
8 | dnl with or without modifications, as long as this notice is preserved. | ||
9 | |||
10 | AC_PREREQ(2.52) | ||
11 | |||
12 | dnl See if there's a working, system-supplied version of the getline function. | ||
13 | dnl We can't just do MU_REPLACE_FUNCS(getline) because some systems | ||
14 | dnl have a function by that name in -linet that doesn't have anything | ||
15 | dnl to do with the function we need. | ||
16 | AC_DEFUN([AM_FUNC_GETLINE], | ||
17 | [ | ||
18 | dnl Persuade glibc <stdio.h> to declare getline() and getdelim(). | ||
19 | AC_REQUIRE([AC_GNU_SOURCE]) | ||
20 | |||
21 | am_getline_needs_run_time_check=no | ||
22 | AC_CHECK_FUNC(getline, | ||
23 | dnl Found it in some library. Verify that it works. | ||
24 | am_getline_needs_run_time_check=yes, | ||
25 | am_cv_func_working_getline=no) | ||
26 | if test $am_getline_needs_run_time_check = yes; then | ||
27 | AC_CACHE_CHECK([for working getline function], am_cv_func_working_getline, | ||
28 | [echo fooN |tr -d '\012'|tr N '\012' > conftest.data | ||
29 | AC_TRY_RUN([ | ||
30 | # include <stdio.h> | ||
31 | # include <stdlib.h> | ||
32 | # include <string.h> | ||
33 | int main () | ||
34 | { /* Based on a test program from Karl Heuer. */ | ||
35 | char *line = NULL; | ||
36 | size_t siz = 0; | ||
37 | int len; | ||
38 | FILE *in = fopen ("./conftest.data", "r"); | ||
39 | if (!in) | ||
40 | return 1; | ||
41 | len = getline (&line, &siz, in); | ||
42 | exit ((len == 4 && line && strcmp (line, "foo\n") == 0) ? 0 : 1); | ||
43 | } | ||
44 | ], am_cv_func_working_getline=yes dnl The library version works. | ||
45 | , am_cv_func_working_getline=no dnl The library version does NOT work. | ||
46 | , am_cv_func_working_getline=no dnl We're cross compiling. | ||
47 | )]) | ||
48 | fi | ||
49 | |||
50 | if test $am_cv_func_working_getline = no; then | ||
51 | dnl We must choose a different name for our function, since on ELF systems | ||
52 | dnl a broken getline() in libc.so would override our getline() in | ||
53 | dnl libgettextlib.so. | ||
54 | AC_DEFINE([getline], [gnu_getline], | ||
55 | [Define to a replacement function name for getline().]) | ||
56 | MU_LIBOBJ(getline) | ||
57 | |||
58 | # Avoid multiple inclusions of getndelim2.o into LIBOBJS. | ||
59 | # This hack won't be needed after gnulib requires Autoconf 2.58 or later. | ||
60 | case " $LIB@&t@OBJS " in | ||
61 | *" getndelim2.$ac_objext "* ) ;; | ||
62 | *) MU_LIBOBJ(getndelim2);; | ||
63 | esac | ||
64 | |||
65 | gl_PREREQ_GETLINE | ||
66 | gl_PREREQ_GETNDELIM2 | ||
67 | fi | ||
68 | ]) | ||
69 | |||
70 | # Prerequisites of lib/getline.c. | ||
71 | AC_DEFUN([gl_PREREQ_GETLINE], | ||
72 | [ | ||
73 | AC_CHECK_FUNCS(getdelim) | ||
74 | ]) |
m4/getndelim2.m4
0 → 100644
1 | # getndelim2.m4 serial 4 | ||
2 | dnl Copyright (C) 2003 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 | AC_DEFUN([gl_GETNDELIM2], | ||
8 | [ | ||
9 | # Avoid multiple inclusions of getndelim2.o into LIBOBJS. | ||
10 | # This hack won't be needed after gnulib requires Autoconf 2.58 or later. | ||
11 | case " $LIB@&t@OBJS " in | ||
12 | *" getndelim2.$ac_objext "* ) ;; | ||
13 | *) MU_LIBOBJ(getndelim2);; | ||
14 | esac | ||
15 | |||
16 | gl_PREREQ_GETNDELIM2 | ||
17 | ]) | ||
18 | |||
19 | # Prerequisites of lib/getndelim2.h and lib/getndelim2.c. | ||
20 | AC_DEFUN([gl_PREREQ_GETNDELIM2], | ||
21 | [ | ||
22 | dnl Prerequisites of lib/getndelim2.h. | ||
23 | AC_REQUIRE([gt_TYPE_SSIZE_T]) | ||
24 | dnl No prerequisites of lib/getndelim2.c. | ||
25 | ]) |
m4/getpass.m4
0 → 100644
1 | # getpass.m4 serial 5 | ||
2 | dnl Copyright (C) 2002-2003 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 | # Provide a getpass() function if the system doesn't have it. | ||
8 | AC_DEFUN([gl_FUNC_GETPASS], | ||
9 | [ | ||
10 | AC_REPLACE_FUNCS(getpass) | ||
11 | AC_CHECK_DECLS_ONCE(getpass) | ||
12 | if test $ac_cv_func_getpass = no; then | ||
13 | gl_PREREQ_GETPASS | ||
14 | fi | ||
15 | ]) | ||
16 | |||
17 | # Provide the GNU getpass() implementation. It supports passwords of | ||
18 | # arbitrary length (not just 8 bytes as on HP-UX). | ||
19 | AC_DEFUN([gl_FUNC_GETPASS_GNU], | ||
20 | [ | ||
21 | AC_CHECK_DECLS_ONCE(getpass) | ||
22 | dnl TODO: Detect when GNU getpass() is already found in glibc. | ||
23 | AC_LIBOBJ(getpass) | ||
24 | gl_PREREQ_GETPASS | ||
25 | dnl We must choose a different name for our function, since on ELF systems | ||
26 | dnl an unusable getpass() in libc.so would override our getpass() if it is | ||
27 | dnl compiled into a shared library. | ||
28 | AC_DEFINE([getpass], [gnu_getpass], | ||
29 | [Define to a replacement function name for getpass().]) | ||
30 | ]) | ||
31 | |||
32 | # Prerequisites of lib/getpass.c. | ||
33 | AC_DEFUN([gl_PREREQ_GETPASS], [ | ||
34 | AC_CHECK_HEADERS_ONCE(stdio_ext.h) | ||
35 | AC_CHECK_DECLS_ONCE([fflush_unlocked flockfile fputs_unlocked funlockfile putc_unlocked]) | ||
36 | : | ||
37 | ]) |
m4/gettext_gl.m4
0 → 100644
This diff is collapsed.
Click to expand it.
m4/glibc21_gl.m4
0 → 100644
1 | # glibc21.m4 serial 3 | ||
2 | dnl Copyright (C) 2000-2002, 2004 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 | # Test for the GNU C Library, version 2.1 or newer. | ||
8 | # From Bruno Haible. | ||
9 | |||
10 | AC_DEFUN([gl_GLIBC21], | ||
11 | [ | ||
12 | AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, | ||
13 | ac_cv_gnu_library_2_1, | ||
14 | [AC_EGREP_CPP([Lucky GNU user], | ||
15 | [ | ||
16 | #include <features.h> | ||
17 | #ifdef __GNU_LIBRARY__ | ||
18 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) | ||
19 | Lucky GNU user | ||
20 | #endif | ||
21 | #endif | ||
22 | ], | ||
23 | ac_cv_gnu_library_2_1=yes, | ||
24 | ac_cv_gnu_library_2_1=no) | ||
25 | ] | ||
26 | ) | ||
27 | AC_SUBST(GLIBC21) | ||
28 | GLIBC21="$ac_cv_gnu_library_2_1" | ||
29 | ] | ||
30 | ) |
m4/iconv.m4
0 → 100644
1 | # iconv.m4 serial AM4 (gettext-0.11.3) | ||
2 | dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. | ||
3 | dnl This file is free software, distributed under the terms of the GNU | ||
4 | dnl General Public License. As a special exception to the GNU General | ||
5 | dnl Public License, this file may be distributed as part of a program | ||
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | |||
9 | dnl From Bruno Haible. | ||
10 | |||
11 | AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], | ||
12 | [ | ||
13 | dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. | ||
14 | AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) | ||
15 | AC_REQUIRE([AC_LIB_RPATH]) | ||
16 | |||
17 | dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV | ||
18 | dnl accordingly. | ||
19 | AC_LIB_LINKFLAGS_BODY([iconv]) | ||
20 | ]) | ||
21 | |||
22 | AC_DEFUN([AM_ICONV_LINK], | ||
23 | [ | ||
24 | dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and | ||
25 | dnl those with the standalone portable GNU libiconv installed). | ||
26 | |||
27 | dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV | ||
28 | dnl accordingly. | ||
29 | AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) | ||
30 | |||
31 | dnl Add $INCICONV to CPPFLAGS before performing the following checks, | ||
32 | dnl because if the user has installed libiconv and not disabled its use | ||
33 | dnl via --without-libiconv-prefix, he wants to use it. The first | ||
34 | dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. | ||
35 | am_save_CPPFLAGS="$CPPFLAGS" | ||
36 | AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) | ||
37 | |||
38 | AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ | ||
39 | am_cv_func_iconv="no, consider installing GNU libiconv" | ||
40 | am_cv_lib_iconv=no | ||
41 | AC_TRY_LINK([#include <stdlib.h> | ||
42 | #include <iconv.h>], | ||
43 | [iconv_t cd = iconv_open("",""); | ||
44 | iconv(cd,NULL,NULL,NULL,NULL); | ||
45 | iconv_close(cd);], | ||
46 | am_cv_func_iconv=yes) | ||
47 | if test "$am_cv_func_iconv" != yes; then | ||
48 | am_save_LIBS="$LIBS" | ||
49 | LIBS="$LIBS $LIBICONV" | ||
50 | AC_TRY_LINK([#include <stdlib.h> | ||
51 | #include <iconv.h>], | ||
52 | [iconv_t cd = iconv_open("",""); | ||
53 | iconv(cd,NULL,NULL,NULL,NULL); | ||
54 | iconv_close(cd);], | ||
55 | am_cv_lib_iconv=yes | ||
56 | am_cv_func_iconv=yes) | ||
57 | LIBS="$am_save_LIBS" | ||
58 | fi | ||
59 | ]) | ||
60 | if test "$am_cv_func_iconv" = yes; then | ||
61 | AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) | ||
62 | fi | ||
63 | if test "$am_cv_lib_iconv" = yes; then | ||
64 | AC_MSG_CHECKING([how to link with libiconv]) | ||
65 | AC_MSG_RESULT([$LIBICONV]) | ||
66 | else | ||
67 | dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV | ||
68 | dnl either. | ||
69 | CPPFLAGS="$am_save_CPPFLAGS" | ||
70 | LIBICONV= | ||
71 | LTLIBICONV= | ||
72 | fi | ||
73 | AC_SUBST(LIBICONV) | ||
74 | AC_SUBST(LTLIBICONV) | ||
75 | ]) | ||
76 | |||
77 | AC_DEFUN([AM_ICONV], | ||
78 | [ | ||
79 | AM_ICONV_LINK | ||
80 | if test "$am_cv_func_iconv" = yes; then | ||
81 | AC_MSG_CHECKING([for iconv declaration]) | ||
82 | AC_CACHE_VAL(am_cv_proto_iconv, [ | ||
83 | AC_TRY_COMPILE([ | ||
84 | #include <stdlib.h> | ||
85 | #include <iconv.h> | ||
86 | extern | ||
87 | #ifdef __cplusplus | ||
88 | "C" | ||
89 | #endif | ||
90 | #if defined(__STDC__) || defined(__cplusplus) | ||
91 | size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); | ||
92 | #else | ||
93 | size_t iconv(); | ||
94 | #endif | ||
95 | ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") | ||
96 | am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) | ||
97 | am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` | ||
98 | AC_MSG_RESULT([$]{ac_t:- | ||
99 | }[$]am_cv_proto_iconv) | ||
100 | AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, | ||
101 | [Define as const if the declaration of iconv() needs const.]) | ||
102 | fi | ||
103 | ]) |
m4/intmax.m4
0 → 100644
1 | # intmax.m4 serial 1 (gettext-0.12) | ||
2 | dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. | ||
3 | dnl This file is free software, distributed under the terms of the GNU | ||
4 | dnl General Public License. As a special exception to the GNU General | ||
5 | dnl Public License, this file may be distributed as part of a program | ||
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | |||
9 | dnl From Bruno Haible. | ||
10 | dnl Test whether the system has the 'intmax_t' type, but don't attempt to | ||
11 | dnl find a replacement if it is lacking. | ||
12 | |||
13 | AC_DEFUN([gt_TYPE_INTMAX_T], | ||
14 | [ | ||
15 | AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) | ||
16 | AC_REQUIRE([jm_AC_HEADER_STDINT_H]) | ||
17 | AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t, | ||
18 | [AC_TRY_COMPILE([ | ||
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 | ], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)]) | ||
28 | if test $gt_cv_c_intmax_t = yes; then | ||
29 | AC_DEFINE(HAVE_INTMAX_T, 1, | ||
30 | [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.]) | ||
31 | fi | ||
32 | ]) |
m4/intmax_t.m4
0 → 100644
1 | # intmax_t.m4 serial 4 | ||
2 | dnl Copyright (C) 1997-2004 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 intmax_t to 'long' or 'long long' | ||
12 | # if it is not already defined in <stdint.h> or <inttypes.h>. | ||
13 | |||
14 | AC_DEFUN([gl_AC_TYPE_INTMAX_T], | ||
15 | [ | ||
16 | dnl For simplicity, we assume that a header file defines 'intmax_t' if and | ||
17 | dnl only if it defines 'uintmax_t'. | ||
18 | AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) | ||
19 | AC_REQUIRE([gl_AC_HEADER_STDINT_H]) | ||
20 | if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then | ||
21 | AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) | ||
22 | test $ac_cv_type_long_long = yes \ | ||
23 | && ac_type='long long' \ | ||
24 | || ac_type='long' | ||
25 | AC_DEFINE_UNQUOTED(intmax_t, $ac_type, | ||
26 | [Define to long or long long if <inttypes.h> and <stdint.h> don't define.]) | ||
27 | else | ||
28 | AC_DEFINE(HAVE_INTMAX_T, 1, | ||
29 | [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.]) | ||
30 | fi | ||
31 | ]) | ||
32 | |||
33 | dnl An alternative would be to explicitly test for 'intmax_t'. | ||
34 | |||
35 | AC_DEFUN([gt_AC_TYPE_INTMAX_T], | ||
36 | [ | ||
37 | AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) | ||
38 | AC_REQUIRE([gl_AC_HEADER_STDINT_H]) | ||
39 | AC_CACHE_CHECK(for intmax_t, gt_cv_c_intmax_t, | ||
40 | [AC_TRY_COMPILE([ | ||
41 | #include <stddef.h> | ||
42 | #include <stdlib.h> | ||
43 | #if HAVE_STDINT_H_WITH_UINTMAX | ||
44 | #include <stdint.h> | ||
45 | #endif | ||
46 | #if HAVE_INTTYPES_H_WITH_UINTMAX | ||
47 | #include <inttypes.h> | ||
48 | #endif | ||
49 | ], [intmax_t x = -1;], gt_cv_c_intmax_t=yes, gt_cv_c_intmax_t=no)]) | ||
50 | if test $gt_cv_c_intmax_t = yes; then | ||
51 | AC_DEFINE(HAVE_INTMAX_T, 1, | ||
52 | [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.]) | ||
53 | else | ||
54 | AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) | ||
55 | test $ac_cv_type_long_long = yes \ | ||
56 | && ac_type='long long' \ | ||
57 | || ac_type='long' | ||
58 | AC_DEFINE_UNQUOTED(intmax_t, $ac_type, | ||
59 | [Define to long or long long if <stdint.h> and <inttypes.h> don't define.]) | ||
60 | fi | ||
61 | ]) |
m4/inttypes.m4
0 → 100644
1 | # inttypes.m4 serial 1 (gettext-0.11.4) | ||
2 | dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. | ||
3 | dnl This file is free software, distributed under the terms of the GNU | ||
4 | dnl General Public License. As a special exception to the GNU General | ||
5 | dnl Public License, this file may be distributed as part of a program | ||
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | |||
9 | dnl From Paul Eggert. | ||
10 | |||
11 | # Define HAVE_INTTYPES_H if <inttypes.h> exists and doesn't clash with | ||
12 | # <sys/types.h>. | ||
13 | |||
14 | AC_DEFUN([gt_HEADER_INTTYPES_H], | ||
15 | [ | ||
16 | AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h, | ||
17 | [ | ||
18 | AC_TRY_COMPILE( | ||
19 | [#include <sys/types.h> | ||
20 | #include <inttypes.h>], | ||
21 | [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no) | ||
22 | ]) | ||
23 | if test $gt_cv_header_inttypes_h = yes; then | ||
24 | AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1, | ||
25 | [Define if <inttypes.h> exists and doesn't clash with <sys/types.h>.]) | ||
26 | fi | ||
27 | ]) |
m4/inttypes_h_gl.m4
0 → 100644
1 | # inttypes_h.m4 serial 6 | ||
2 | dnl Copyright (C) 1997-2004 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 | # Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists, | ||
10 | # doesn't clash with <sys/types.h>, and declares uintmax_t. | ||
11 | |||
12 | AC_DEFUN([gl_AC_HEADER_INTTYPES_H], | ||
13 | [ | ||
14 | AC_CACHE_CHECK([for inttypes.h], gl_cv_header_inttypes_h, | ||
15 | [AC_TRY_COMPILE( | ||
16 | [#include <sys/types.h> | ||
17 | #include <inttypes.h>], | ||
18 | [uintmax_t i = (uintmax_t) -1;], | ||
19 | gl_cv_header_inttypes_h=yes, | ||
20 | gl_cv_header_inttypes_h=no)]) | ||
21 | if test $gl_cv_header_inttypes_h = yes; then | ||
22 | AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1, | ||
23 | [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, | ||
24 | and declares uintmax_t. ]) | ||
25 | fi | ||
26 | ]) |
m4/lib-ld_gl.m4
0 → 100644
1 | # lib-ld.m4 serial 3 (gettext-0.13) | ||
2 | dnl Copyright (C) 1996-2003 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 Subroutines of libtool.m4, | ||
8 | dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision | ||
9 | dnl with libtool.m4. | ||
10 | |||
11 | dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. | ||
12 | AC_DEFUN([AC_LIB_PROG_LD_GNU], | ||
13 | [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, | ||
14 | [# I'd rather use --version here, but apparently some GNU ld's only accept -v. | ||
15 | case `$LD -v 2>&1 </dev/null` in | ||
16 | *GNU* | *'with BFD'*) | ||
17 | acl_cv_prog_gnu_ld=yes ;; | ||
18 | *) | ||
19 | acl_cv_prog_gnu_ld=no ;; | ||
20 | esac]) | ||
21 | with_gnu_ld=$acl_cv_prog_gnu_ld | ||
22 | ]) | ||
23 | |||
24 | dnl From libtool-1.4. Sets the variable LD. | ||
25 | AC_DEFUN([AC_LIB_PROG_LD], | ||
26 | [AC_ARG_WITH(gnu-ld, | ||
27 | [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], | ||
28 | test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) | ||
29 | AC_REQUIRE([AC_PROG_CC])dnl | ||
30 | AC_REQUIRE([AC_CANONICAL_HOST])dnl | ||
31 | # Prepare PATH_SEPARATOR. | ||
32 | # The user is always right. | ||
33 | if test "${PATH_SEPARATOR+set}" != set; then | ||
34 | echo "#! /bin/sh" >conf$$.sh | ||
35 | echo "exit 0" >>conf$$.sh | ||
36 | chmod +x conf$$.sh | ||
37 | if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then | ||
38 | PATH_SEPARATOR=';' | ||
39 | else | ||
40 | PATH_SEPARATOR=: | ||
41 | fi | ||
42 | rm -f conf$$.sh | ||
43 | fi | ||
44 | ac_prog=ld | ||
45 | if test "$GCC" = yes; then | ||
46 | # Check if gcc -print-prog-name=ld gives a path. | ||
47 | AC_MSG_CHECKING([for ld used by GCC]) | ||
48 | case $host in | ||
49 | *-*-mingw*) | ||
50 | # gcc leaves a trailing carriage return which upsets mingw | ||
51 | ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; | ||
52 | *) | ||
53 | ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; | ||
54 | esac | ||
55 | case $ac_prog in | ||
56 | # Accept absolute paths. | ||
57 | [[\\/]* | [A-Za-z]:[\\/]*)] | ||
58 | [re_direlt='/[^/][^/]*/\.\./'] | ||
59 | # Canonicalize the path of ld | ||
60 | ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` | ||
61 | while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do | ||
62 | ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` | ||
63 | done | ||
64 | test -z "$LD" && LD="$ac_prog" | ||
65 | ;; | ||
66 | "") | ||
67 | # If it fails, then pretend we aren't using GCC. | ||
68 | ac_prog=ld | ||
69 | ;; | ||
70 | *) | ||
71 | # If it is relative, then search for the first ld in PATH. | ||
72 | with_gnu_ld=unknown | ||
73 | ;; | ||
74 | esac | ||
75 | elif test "$with_gnu_ld" = yes; then | ||
76 | AC_MSG_CHECKING([for GNU ld]) | ||
77 | else | ||
78 | AC_MSG_CHECKING([for non-GNU ld]) | ||
79 | fi | ||
80 | AC_CACHE_VAL(acl_cv_path_LD, | ||
81 | [if test -z "$LD"; then | ||
82 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" | ||
83 | for ac_dir in $PATH; do | ||
84 | test -z "$ac_dir" && ac_dir=. | ||
85 | if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then | ||
86 | acl_cv_path_LD="$ac_dir/$ac_prog" | ||
87 | # Check to see if the program is GNU ld. I'd rather use --version, | ||
88 | # but apparently some GNU ld's only accept -v. | ||
89 | # Break only if it was the GNU/non-GNU ld that we prefer. | ||
90 | case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in | ||
91 | *GNU* | *'with BFD'*) | ||
92 | test "$with_gnu_ld" != no && break ;; | ||
93 | *) | ||
94 | test "$with_gnu_ld" != yes && break ;; | ||
95 | esac | ||
96 | fi | ||
97 | done | ||
98 | IFS="$ac_save_ifs" | ||
99 | else | ||
100 | acl_cv_path_LD="$LD" # Let the user override the test with a path. | ||
101 | fi]) | ||
102 | LD="$acl_cv_path_LD" | ||
103 | if test -n "$LD"; then | ||
104 | AC_MSG_RESULT($LD) | ||
105 | else | ||
106 | AC_MSG_RESULT(no) | ||
107 | fi | ||
108 | test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) | ||
109 | AC_LIB_PROG_LD_GNU | ||
110 | ]) |
m4/lib-prefix_gl.m4
0 → 100644
1 | # lib-prefix.m4 serial 3 (gettext-0.13) | ||
2 | dnl Copyright (C) 2001-2003 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 AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and | ||
10 | dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't | ||
11 | dnl require excessive bracketing. | ||
12 | ifdef([AC_HELP_STRING], | ||
13 | [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], | ||
14 | [AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) | ||
15 | |||
16 | dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed | ||
17 | dnl to access previously installed libraries. The basic assumption is that | ||
18 | dnl a user will want packages to use other packages he previously installed | ||
19 | dnl with the same --prefix option. | ||
20 | dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate | ||
21 | dnl libraries, but is otherwise very convenient. | ||
22 | AC_DEFUN([AC_LIB_PREFIX], | ||
23 | [ | ||
24 | AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) | ||
25 | AC_REQUIRE([AC_PROG_CC]) | ||
26 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
27 | AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) | ||
28 | dnl By default, look in $includedir and $libdir. | ||
29 | use_additional=yes | ||
30 | AC_LIB_WITH_FINAL_PREFIX([ | ||
31 | eval additional_includedir=\"$includedir\" | ||
32 | eval additional_libdir=\"$libdir\" | ||
33 | ]) | ||
34 | AC_LIB_ARG_WITH([lib-prefix], | ||
35 | [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib | ||
36 | --without-lib-prefix don't search for libraries in includedir and libdir], | ||
37 | [ | ||
38 | if test "X$withval" = "Xno"; then | ||
39 | use_additional=no | ||
40 | else | ||
41 | if test "X$withval" = "X"; then | ||
42 | AC_LIB_WITH_FINAL_PREFIX([ | ||
43 | eval additional_includedir=\"$includedir\" | ||
44 | eval additional_libdir=\"$libdir\" | ||
45 | ]) | ||
46 | else | ||
47 | additional_includedir="$withval/include" | ||
48 | additional_libdir="$withval/lib" | ||
49 | fi | ||
50 | fi | ||
51 | ]) | ||
52 | if test $use_additional = yes; then | ||
53 | dnl Potentially add $additional_includedir to $CPPFLAGS. | ||
54 | dnl But don't add it | ||
55 | dnl 1. if it's the standard /usr/include, | ||
56 | dnl 2. if it's already present in $CPPFLAGS, | ||
57 | dnl 3. if it's /usr/local/include and we are using GCC on Linux, | ||
58 | dnl 4. if it doesn't exist as a directory. | ||
59 | if test "X$additional_includedir" != "X/usr/include"; then | ||
60 | haveit= | ||
61 | for x in $CPPFLAGS; do | ||
62 | AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) | ||
63 | if test "X$x" = "X-I$additional_includedir"; then | ||
64 | haveit=yes | ||
65 | break | ||
66 | fi | ||
67 | done | ||
68 | if test -z "$haveit"; then | ||
69 | if test "X$additional_includedir" = "X/usr/local/include"; then | ||
70 | if test -n "$GCC"; then | ||
71 | case $host_os in | ||
72 | linux*) haveit=yes;; | ||
73 | esac | ||
74 | fi | ||
75 | fi | ||
76 | if test -z "$haveit"; then | ||
77 | if test -d "$additional_includedir"; then | ||
78 | dnl Really add $additional_includedir to $CPPFLAGS. | ||
79 | CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" | ||
80 | fi | ||
81 | fi | ||
82 | fi | ||
83 | fi | ||
84 | dnl Potentially add $additional_libdir to $LDFLAGS. | ||
85 | dnl But don't add it | ||
86 | dnl 1. if it's the standard /usr/lib, | ||
87 | dnl 2. if it's already present in $LDFLAGS, | ||
88 | dnl 3. if it's /usr/local/lib and we are using GCC on Linux, | ||
89 | dnl 4. if it doesn't exist as a directory. | ||
90 | if test "X$additional_libdir" != "X/usr/lib"; then | ||
91 | haveit= | ||
92 | for x in $LDFLAGS; do | ||
93 | AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) | ||
94 | if test "X$x" = "X-L$additional_libdir"; then | ||
95 | haveit=yes | ||
96 | break | ||
97 | fi | ||
98 | done | ||
99 | if test -z "$haveit"; then | ||
100 | if test "X$additional_libdir" = "X/usr/local/lib"; then | ||
101 | if test -n "$GCC"; then | ||
102 | case $host_os in | ||
103 | linux*) haveit=yes;; | ||
104 | esac | ||
105 | fi | ||
106 | fi | ||
107 | if test -z "$haveit"; then | ||
108 | if test -d "$additional_libdir"; then | ||
109 | dnl Really add $additional_libdir to $LDFLAGS. | ||
110 | LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" | ||
111 | fi | ||
112 | fi | ||
113 | fi | ||
114 | fi | ||
115 | fi | ||
116 | ]) | ||
117 | |||
118 | dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, | ||
119 | dnl acl_final_exec_prefix, containing the values to which $prefix and | ||
120 | dnl $exec_prefix will expand at the end of the configure script. | ||
121 | AC_DEFUN([AC_LIB_PREPARE_PREFIX], | ||
122 | [ | ||
123 | dnl Unfortunately, prefix and exec_prefix get only finally determined | ||
124 | dnl at the end of configure. | ||
125 | if test "X$prefix" = "XNONE"; then | ||
126 | acl_final_prefix="$ac_default_prefix" | ||
127 | else | ||
128 | acl_final_prefix="$prefix" | ||
129 | fi | ||
130 | if test "X$exec_prefix" = "XNONE"; then | ||
131 | acl_final_exec_prefix='${prefix}' | ||
132 | else | ||
133 | acl_final_exec_prefix="$exec_prefix" | ||
134 | fi | ||
135 | acl_save_prefix="$prefix" | ||
136 | prefix="$acl_final_prefix" | ||
137 | eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" | ||
138 | prefix="$acl_save_prefix" | ||
139 | ]) | ||
140 | |||
141 | dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the | ||
142 | dnl variables prefix and exec_prefix bound to the values they will have | ||
143 | dnl at the end of the configure script. | ||
144 | AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], | ||
145 | [ | ||
146 | acl_save_prefix="$prefix" | ||
147 | prefix="$acl_final_prefix" | ||
148 | acl_save_exec_prefix="$exec_prefix" | ||
149 | exec_prefix="$acl_final_exec_prefix" | ||
150 | $1 | ||
151 | exec_prefix="$acl_save_exec_prefix" | ||
152 | prefix="$acl_save_prefix" | ||
153 | ]) |
m4/longdouble.m4
0 → 100644
1 | # longdouble.m4 serial 1 (gettext-0.12) | ||
2 | dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. | ||
3 | dnl This file is free software, distributed under the terms of the GNU | ||
4 | dnl General Public License. As a special exception to the GNU General | ||
5 | dnl Public License, this file may be distributed as part of a program | ||
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | |||
9 | dnl From Bruno Haible. | ||
10 | dnl Test whether the compiler supports the 'long double' type. | ||
11 | dnl Prerequisite: AC_PROG_CC | ||
12 | |||
13 | AC_DEFUN([gt_TYPE_LONGDOUBLE], | ||
14 | [ | ||
15 | AC_CACHE_CHECK([for long double], gt_cv_c_long_double, | ||
16 | [if test "$GCC" = yes; then | ||
17 | gt_cv_c_long_double=yes | ||
18 | else | ||
19 | AC_TRY_COMPILE([ | ||
20 | /* The Stardent Vistra knows sizeof(long double), but does not support it. */ | ||
21 | long double foo = 0.0; | ||
22 | /* On Ultrix 4.3 cc, long double is 4 and double is 8. */ | ||
23 | int array [2*(sizeof(long double) >= sizeof(double)) - 1]; | ||
24 | ], , | ||
25 | gt_cv_c_long_double=yes, gt_cv_c_long_double=no) | ||
26 | fi]) | ||
27 | if test $gt_cv_c_long_double = yes; then | ||
28 | AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.]) | ||
29 | fi | ||
30 | ]) |
m4/longlong_gl.m4
0 → 100644
1 | # longlong.m4 serial 5 | ||
2 | dnl Copyright (C) 1999-2004 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 | # Define HAVE_LONG_LONG if 'long long' works. | ||
10 | |||
11 | AC_DEFUN([gl_AC_TYPE_LONG_LONG], | ||
12 | [ | ||
13 | AC_CACHE_CHECK([for long long], ac_cv_type_long_long, | ||
14 | [AC_TRY_LINK([long long ll = 1LL; int i = 63;], | ||
15 | [long long llmax = (long long) -1; | ||
16 | return ll << i | ll >> i | llmax / ll | llmax % ll;], | ||
17 | ac_cv_type_long_long=yes, | ||
18 | ac_cv_type_long_long=no)]) | ||
19 | if test $ac_cv_type_long_long = yes; then | ||
20 | AC_DEFINE(HAVE_LONG_LONG, 1, | ||
21 | [Define if you have the 'long long' type.]) | ||
22 | fi | ||
23 | ]) |
m4/mailbox-link.m4
0 → 100644
This diff is collapsed.
Click to expand it.
m4/mbstate_t.m4
0 → 100644
1 | # mbstate_t.m4 serial 9 | ||
2 | dnl Copyright (C) 2000, 2001, 2002 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 | # From Paul Eggert. | ||
8 | |||
9 | # BeOS 5 has <wchar.h> but does not define mbstate_t, | ||
10 | # so you can't declare an object of that type. | ||
11 | # Check for this incompatibility with Standard C. | ||
12 | |||
13 | # AC_TYPE_MBSTATE_T | ||
14 | # ----------------- | ||
15 | AC_DEFUN([AC_TYPE_MBSTATE_T], | ||
16 | [AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t, | ||
17 | [AC_COMPILE_IFELSE( | ||
18 | [AC_LANG_PROGRAM( | ||
19 | [AC_INCLUDES_DEFAULT | ||
20 | # include <wchar.h>], | ||
21 | [mbstate_t x; return sizeof x;])], | ||
22 | [ac_cv_type_mbstate_t=yes], | ||
23 | [ac_cv_type_mbstate_t=no])]) | ||
24 | if test $ac_cv_type_mbstate_t = yes; then | ||
25 | AC_DEFINE([HAVE_MBSTATE_T], 1, | ||
26 | [Define to 1 if <wchar.h> declares mbstate_t.]) | ||
27 | else | ||
28 | AC_DEFINE([mbstate_t], int, | ||
29 | [Define to a type if <wchar.h> does not define.]) | ||
30 | fi]) |
m4/md5.m4
0 → 100644
1 | # md5.m4 serial 6 | ||
2 | dnl Copyright (C) 2002, 2003, 2004 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 | AC_DEFUN([gl_MD5], | ||
8 | [ | ||
9 | dnl Prerequisites of lib/md5.h. | ||
10 | AC_REQUIRE([gl_AC_TYPE_UINT32_T]) | ||
11 | |||
12 | dnl Prerequisites of lib/md5.c. | ||
13 | AC_REQUIRE([AC_C_BIGENDIAN]) | ||
14 | : | ||
15 | ]) |
m4/mempcpy.m4
0 → 100644
1 | # mempcpy.m4 serial 3 | ||
2 | dnl Copyright (C) 2003, 2004 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 | AC_DEFUN([gl_FUNC_MEMPCPY], | ||
8 | [ | ||
9 | MU_LIBSOURCES([mempcpy.c, mempcpy.h]) | ||
10 | |||
11 | dnl Persuade glibc <string.h> to declare mempcpy(). | ||
12 | AC_REQUIRE([AC_GNU_SOURCE]) | ||
13 | |||
14 | MU_REPLACE_FUNCS(mempcpy) | ||
15 | if test $ac_cv_func_mempcpy = no; then | ||
16 | gl_PREREQ_MEMPCPY | ||
17 | fi | ||
18 | ]) | ||
19 | |||
20 | # Prerequisites of lib/mempcpy.c. | ||
21 | AC_DEFUN([gl_PREREQ_MEMPCPY], [ | ||
22 | : | ||
23 | ]) |
m4/nls.m4
0 → 100644
1 | # nls.m4 serial 1 (gettext-0.12) | ||
2 | dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. | ||
3 | dnl This file is free software, distributed under the terms of the GNU | ||
4 | dnl General Public License. As a special exception to the GNU General | ||
5 | dnl Public License, this file may be distributed as part of a program | ||
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | dnl | ||
9 | dnl This file can can be used in projects which are not available under | ||
10 | dnl the GNU General Public License or the GNU Library General Public | ||
11 | dnl License but which still want to provide support for the GNU gettext | ||
12 | dnl functionality. | ||
13 | dnl Please note that the actual code of the GNU gettext library is covered | ||
14 | dnl by the GNU Library General Public License, and the rest of the GNU | ||
15 | dnl gettext package package is covered by the GNU General Public License. | ||
16 | dnl They are *not* in the public domain. | ||
17 | |||
18 | dnl Authors: | ||
19 | dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. | ||
20 | dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003. | ||
21 | |||
22 | AC_DEFUN([AM_NLS], | ||
23 | [ | ||
24 | AC_MSG_CHECKING([whether NLS is requested]) | ||
25 | dnl Default is enabled NLS | ||
26 | AC_ARG_ENABLE(nls, | ||
27 | [ --disable-nls do not use Native Language Support], | ||
28 | USE_NLS=$enableval, USE_NLS=yes) | ||
29 | AC_MSG_RESULT($USE_NLS) | ||
30 | AC_SUBST(USE_NLS) | ||
31 | ]) | ||
32 | |||
33 | AC_DEFUN([AM_MKINSTALLDIRS], | ||
34 | [ | ||
35 | dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly | ||
36 | dnl find the mkinstalldirs script in another subdir but $(top_srcdir). | ||
37 | dnl Try to locate it. | ||
38 | MKINSTALLDIRS= | ||
39 | if test -n "$ac_aux_dir"; then | ||
40 | case "$ac_aux_dir" in | ||
41 | /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;; | ||
42 | *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;; | ||
43 | esac | ||
44 | fi | ||
45 | if test -z "$MKINSTALLDIRS"; then | ||
46 | MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" | ||
47 | fi | ||
48 | AC_SUBST(MKINSTALLDIRS) | ||
49 | ]) |
m4/obstack.m4
0 → 100644
1 | # obstack.m4 serial 4 | ||
2 | dnl Copyright (C) 2002, 2003, 2004 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 | AC_DEFUN([gl_OBSTACK], | ||
8 | [ | ||
9 | AC_FUNC_OBSTACK | ||
10 | dnl Note: AC_FUNC_OBSTACK does AC_LIBSOURCES([obstack.h, obstack.c]). | ||
11 | if test $ac_cv_func_obstack = no; then | ||
12 | gl_PREREQ_OBSTACK | ||
13 | fi | ||
14 | ]) | ||
15 | |||
16 | # Prerequisites of lib/obstack.c. | ||
17 | AC_DEFUN([gl_PREREQ_OBSTACK], | ||
18 | [ | ||
19 | AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) | ||
20 | AC_REQUIRE([gl_AC_HEADER_STDINT_H]) | ||
21 | AC_REQUIRE([gl_AC_TYPE_UINTMAX_T]) | ||
22 | : | ||
23 | ]) |
m4/onceonly.m4
0 → 100644
1 | # onceonly_2_57.m4 serial 3 | ||
2 | dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. | ||
3 | dnl This file is free software, distributed under the terms of the GNU | ||
4 | dnl General Public License. As a special exception to the GNU General | ||
5 | dnl Public License, this file may be distributed as part of a program | ||
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | |||
9 | dnl This file defines some "once only" variants of standard autoconf macros. | ||
10 | dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS | ||
11 | dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS | ||
12 | dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS | ||
13 | dnl AC_REQUIRE([AC_HEADER_STDC]) like AC_HEADER_STDC | ||
14 | dnl The advantage is that the check for each of the headers/functions/decls | ||
15 | dnl will be put only once into the 'configure' file. It keeps the size of | ||
16 | dnl the 'configure' file down, and avoids redundant output when 'configure' | ||
17 | dnl is run. | ||
18 | dnl The drawback is that the checks cannot be conditionalized. If you write | ||
19 | dnl if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi | ||
20 | dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to | ||
21 | dnl empty, and the check will be inserted before the body of the AC_DEFUNed | ||
22 | dnl function. | ||
23 | |||
24 | dnl This is like onceonly.m4, except that it uses diversions to named sections | ||
25 | dnl DEFAULTS and INIT_PREPARE in order to check all requested headers at once, | ||
26 | dnl thus reducing the size of 'configure'. Works with autoconf-2.57. The | ||
27 | dnl size reduction is ca. 9%. | ||
28 | |||
29 | dnl Autoconf version 2.57 or newer is recommended. | ||
30 | AC_PREREQ(2.54) | ||
31 | |||
32 | # AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of | ||
33 | # AC_CHECK_HEADERS(HEADER1 HEADER2 ...). | ||
34 | AC_DEFUN([AC_CHECK_HEADERS_ONCE], [ | ||
35 | : | ||
36 | AC_FOREACH([gl_HEADER_NAME], [$1], [ | ||
37 | AC_DEFUN([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME, | ||
38 | [./-], [___])), [ | ||
39 | m4_divert_text([INIT_PREPARE], | ||
40 | [gl_header_list="$gl_header_list gl_HEADER_NAME"]) | ||
41 | gl_HEADERS_EXPANSION | ||
42 | AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_HEADER_NAME])), | ||
43 | [Define to 1 if you have the <]m4_defn([gl_HEADER_NAME])[> header file.]) | ||
44 | ]) | ||
45 | AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME, | ||
46 | [./-], [___]))) | ||
47 | ]) | ||
48 | ]) | ||
49 | m4_define([gl_HEADERS_EXPANSION], [ | ||
50 | m4_divert_text([DEFAULTS], [gl_header_list=]) | ||
51 | AC_CHECK_HEADERS([$gl_header_list]) | ||
52 | m4_define([gl_HEADERS_EXPANSION], []) | ||
53 | ]) | ||
54 | |||
55 | # AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of | ||
56 | # AC_CHECK_FUNCS(FUNC1 FUNC2 ...). | ||
57 | AC_DEFUN([AC_CHECK_FUNCS_ONCE], [ | ||
58 | : | ||
59 | AC_FOREACH([gl_FUNC_NAME], [$1], [ | ||
60 | AC_DEFUN([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]), [ | ||
61 | m4_divert_text([INIT_PREPARE], | ||
62 | [gl_func_list="$gl_func_list gl_FUNC_NAME"]) | ||
63 | gl_FUNCS_EXPANSION | ||
64 | AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_FUNC_NAME])), | ||
65 | [Define to 1 if you have the `]m4_defn([gl_FUNC_NAME])[' function.]) | ||
66 | ]) | ||
67 | AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME])) | ||
68 | ]) | ||
69 | ]) | ||
70 | m4_define([gl_FUNCS_EXPANSION], [ | ||
71 | m4_divert_text([DEFAULTS], [gl_func_list=]) | ||
72 | AC_CHECK_FUNCS([$gl_func_list]) | ||
73 | m4_define([gl_FUNCS_EXPANSION], []) | ||
74 | ]) | ||
75 | |||
76 | # AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of | ||
77 | # AC_CHECK_DECLS(DECL1, DECL2, ...). | ||
78 | AC_DEFUN([AC_CHECK_DECLS_ONCE], [ | ||
79 | : | ||
80 | AC_FOREACH([gl_DECL_NAME], [$1], [ | ||
81 | AC_DEFUN([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]), [ | ||
82 | AC_CHECK_DECLS(m4_defn([gl_DECL_NAME])) | ||
83 | ]) | ||
84 | AC_REQUIRE([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME])) | ||
85 | ]) | ||
86 | ]) |
m4/po_gl.m4
0 → 100644
This diff is collapsed.
Click to expand it.
m4/printf-posix.m4
0 → 100644
1 | # printf-posix.m4 serial 2 (gettext-0.13.1) | ||
2 | dnl Copyright (C) 2003 Free Software Foundation, Inc. | ||
3 | dnl This file is free software, distributed under the terms of the GNU | ||
4 | dnl General Public License. As a special exception to the GNU General | ||
5 | dnl Public License, this file may be distributed as part of a program | ||
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | |||
9 | dnl From Bruno Haible. | ||
10 | dnl Test whether the printf() function supports POSIX/XSI format strings with | ||
11 | dnl positions. | ||
12 | |||
13 | AC_DEFUN([gt_PRINTF_POSIX], | ||
14 | [ | ||
15 | AC_REQUIRE([AC_PROG_CC]) | ||
16 | AC_CACHE_CHECK([whether printf() supports POSIX/XSI format strings], | ||
17 | gt_cv_func_printf_posix, | ||
18 | [ | ||
19 | AC_TRY_RUN([ | ||
20 | #include <stdio.h> | ||
21 | #include <string.h> | ||
22 | /* The string "%2$d %1$d", with dollar characters protected from the shell's | ||
23 | dollar expansion (possibly an autoconf bug). */ | ||
24 | static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; | ||
25 | static char buf[100]; | ||
26 | int main () | ||
27 | { | ||
28 | sprintf (buf, format, 33, 55); | ||
29 | return (strcmp (buf, "55 33") != 0); | ||
30 | }], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no, | ||
31 | [ | ||
32 | AC_EGREP_CPP(notposix, [ | ||
33 | #if defined __NetBSD__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ | ||
34 | notposix | ||
35 | #endif | ||
36 | ], gt_cv_func_printf_posix="guessing no", | ||
37 | gt_cv_func_printf_posix="guessing yes") | ||
38 | ]) | ||
39 | ]) | ||
40 | case $gt_cv_func_printf_posix in | ||
41 | *yes) | ||
42 | AC_DEFINE(HAVE_POSIX_PRINTF, 1, | ||
43 | [Define if your printf() function supports format strings with positions.]) | ||
44 | ;; | ||
45 | esac | ||
46 | ]) |
m4/progtest.m4
0 → 100644
1 | # progtest.m4 serial 3 (gettext-0.12) | ||
2 | dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. | ||
3 | dnl This file is free software, distributed under the terms of the GNU | ||
4 | dnl General Public License. As a special exception to the GNU General | ||
5 | dnl Public License, this file may be distributed as part of a program | ||
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | dnl | ||
9 | dnl This file can can be used in projects which are not available under | ||
10 | dnl the GNU General Public License or the GNU Library General Public | ||
11 | dnl License but which still want to provide support for the GNU gettext | ||
12 | dnl functionality. | ||
13 | dnl Please note that the actual code of the GNU gettext library is covered | ||
14 | dnl by the GNU Library General Public License, and the rest of the GNU | ||
15 | dnl gettext package package is covered by the GNU General Public License. | ||
16 | dnl They are *not* in the public domain. | ||
17 | |||
18 | dnl Authors: | ||
19 | dnl Ulrich Drepper <drepper@cygnus.com>, 1996. | ||
20 | |||
21 | # Search path for a program which passes the given test. | ||
22 | |||
23 | dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, | ||
24 | dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) | ||
25 | AC_DEFUN([AM_PATH_PROG_WITH_TEST], | ||
26 | [ | ||
27 | # Prepare PATH_SEPARATOR. | ||
28 | # The user is always right. | ||
29 | if test "${PATH_SEPARATOR+set}" != set; then | ||
30 | echo "#! /bin/sh" >conf$$.sh | ||
31 | echo "exit 0" >>conf$$.sh | ||
32 | chmod +x conf$$.sh | ||
33 | if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then | ||
34 | PATH_SEPARATOR=';' | ||
35 | else | ||
36 | PATH_SEPARATOR=: | ||
37 | fi | ||
38 | rm -f conf$$.sh | ||
39 | fi | ||
40 | |||
41 | # Find out how to test for executable files. Don't use a zero-byte file, | ||
42 | # as systems may use methods other than mode bits to determine executability. | ||
43 | cat >conf$$.file <<_ASEOF | ||
44 | #! /bin/sh | ||
45 | exit 0 | ||
46 | _ASEOF | ||
47 | chmod +x conf$$.file | ||
48 | if test -x conf$$.file >/dev/null 2>&1; then | ||
49 | ac_executable_p="test -x" | ||
50 | else | ||
51 | ac_executable_p="test -f" | ||
52 | fi | ||
53 | rm -f conf$$.file | ||
54 | |||
55 | # Extract the first word of "$2", so it can be a program name with args. | ||
56 | set dummy $2; ac_word=[$]2 | ||
57 | AC_MSG_CHECKING([for $ac_word]) | ||
58 | AC_CACHE_VAL(ac_cv_path_$1, | ||
59 | [case "[$]$1" in | ||
60 | [[\\/]]* | ?:[[\\/]]*) | ||
61 | ac_cv_path_$1="[$]$1" # Let the user override the test with a path. | ||
62 | ;; | ||
63 | *) | ||
64 | ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR | ||
65 | for ac_dir in ifelse([$5], , $PATH, [$5]); do | ||
66 | IFS="$ac_save_IFS" | ||
67 | test -z "$ac_dir" && ac_dir=. | ||
68 | for ac_exec_ext in '' $ac_executable_extensions; do | ||
69 | if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then | ||
70 | if [$3]; then | ||
71 | ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" | ||
72 | break 2 | ||
73 | fi | ||
74 | fi | ||
75 | done | ||
76 | done | ||
77 | IFS="$ac_save_IFS" | ||
78 | dnl If no 4th arg is given, leave the cache variable unset, | ||
79 | dnl so AC_PATH_PROGS will keep looking. | ||
80 | ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" | ||
81 | ])dnl | ||
82 | ;; | ||
83 | esac])dnl | ||
84 | $1="$ac_cv_path_$1" | ||
85 | if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then | ||
86 | AC_MSG_RESULT([$]$1) | ||
87 | else | ||
88 | AC_MSG_RESULT(no) | ||
89 | fi | ||
90 | AC_SUBST($1)dnl | ||
91 | ]) |
m4/restrict.m4
0 → 100644
1 | #serial 1003 | ||
2 | dnl Copyright (C) 2003 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 | # This macro can be removed once we can rely on Autoconf 2.57a or later, | ||
8 | # since we can then use its AC_C_RESTRICT. | ||
9 | |||
10 | # gl_C_RESTRICT | ||
11 | # -------------- | ||
12 | # Determine whether the C/C++ compiler supports the "restrict" keyword | ||
13 | # introduced in ANSI C99, or an equivalent. Do nothing if the compiler | ||
14 | # accepts it. Otherwise, if the compiler supports an equivalent, | ||
15 | # define "restrict" to be that. Here are some variants: | ||
16 | # - GCC supports both __restrict and __restrict__ | ||
17 | # - older DEC Alpha C compilers support only __restrict | ||
18 | # - _Restrict is the only spelling accepted by Sun WorkShop 6 update 2 C | ||
19 | # Otherwise, define "restrict" to be empty. | ||
20 | AC_DEFUN([gl_C_RESTRICT], | ||
21 | [AC_CACHE_CHECK([for C/C++ restrict keyword], gl_cv_c_restrict, | ||
22 | [gl_cv_c_restrict=no | ||
23 | # Try the official restrict keyword, then gcc's __restrict, and | ||
24 | # the less common variants. | ||
25 | for ac_kw in restrict __restrict __restrict__ _Restrict; do | ||
26 | AC_COMPILE_IFELSE([AC_LANG_SOURCE( | ||
27 | [float * $ac_kw x;])], | ||
28 | [gl_cv_c_restrict=$ac_kw; break]) | ||
29 | done | ||
30 | ]) | ||
31 | case $gl_cv_c_restrict in | ||
32 | restrict) ;; | ||
33 | no) AC_DEFINE(restrict,, | ||
34 | [Define to equivalent of C99 restrict keyword, or to nothing if this | ||
35 | is not supported. Do not define if restrict is supported directly.]) ;; | ||
36 | *) AC_DEFINE_UNQUOTED(restrict, $gl_cv_c_restrict) ;; | ||
37 | esac | ||
38 | ]) |
m4/setenv.m4
0 → 100644
1 | # setenv.m4 serial 5 | ||
2 | dnl Copyright (C) 2001-2004 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 | AC_DEFUN([gt_FUNC_SETENV], | ||
8 | [ | ||
9 | AC_REPLACE_FUNCS(setenv unsetenv) | ||
10 | if test $ac_cv_func_setenv = no; then | ||
11 | gl_PREREQ_SETENV | ||
12 | fi | ||
13 | if test $ac_cv_func_unsetenv = no; then | ||
14 | gl_PREREQ_UNSETENV | ||
15 | else | ||
16 | AC_CACHE_CHECK([for unsetenv() return type], gt_cv_func_unsetenv_ret, | ||
17 | [AC_TRY_COMPILE([#include <stdlib.h> | ||
18 | extern | ||
19 | #ifdef __cplusplus | ||
20 | "C" | ||
21 | #endif | ||
22 | #if defined(__STDC__) || defined(__cplusplus) | ||
23 | int unsetenv (const char *name); | ||
24 | #else | ||
25 | int unsetenv(); | ||
26 | #endif | ||
27 | ], , gt_cv_func_unsetenv_ret='int', gt_cv_func_unsetenv_ret='void')]) | ||
28 | if test $gt_cv_func_unsetenv_ret = 'void'; then | ||
29 | AC_DEFINE(VOID_UNSETENV, 1, [Define if unsetenv() returns void, not int.]) | ||
30 | fi | ||
31 | fi | ||
32 | ]) | ||
33 | |||
34 | # Check if a variable is properly declared. | ||
35 | # gt_CHECK_VAR_DECL(includes,variable) | ||
36 | AC_DEFUN([gt_CHECK_VAR_DECL], | ||
37 | [ | ||
38 | define([gt_cv_var], [gt_cv_var_]$2[_declaration]) | ||
39 | AC_MSG_CHECKING([if $2 is properly declared]) | ||
40 | AC_CACHE_VAL(gt_cv_var, [ | ||
41 | AC_TRY_COMPILE([$1 | ||
42 | extern struct { int foo; } $2;], | ||
43 | [$2.foo = 1;], | ||
44 | gt_cv_var=no, | ||
45 | gt_cv_var=yes)]) | ||
46 | AC_MSG_RESULT($gt_cv_var) | ||
47 | if test $gt_cv_var = yes; then | ||
48 | AC_DEFINE([HAVE_]translit($2, [a-z], [A-Z])[_DECL], 1, | ||
49 | [Define if you have the declaration of $2.]) | ||
50 | fi | ||
51 | ]) | ||
52 | |||
53 | # Prerequisites of lib/setenv.c. | ||
54 | AC_DEFUN([gl_PREREQ_SETENV], | ||
55 | [ | ||
56 | AC_REQUIRE([AC_FUNC_ALLOCA]) | ||
57 | AC_CHECK_HEADERS_ONCE(unistd.h) | ||
58 | AC_CHECK_HEADERS(search.h) | ||
59 | AC_CHECK_FUNCS(tsearch) | ||
60 | gt_CHECK_VAR_DECL([#include <errno.h>], errno) | ||
61 | gt_CHECK_VAR_DECL([#include <unistd.h>], environ) | ||
62 | ]) | ||
63 | |||
64 | # Prerequisites of lib/unsetenv.c. | ||
65 | AC_DEFUN([gl_PREREQ_UNSETENV], | ||
66 | [ | ||
67 | AC_CHECK_HEADERS_ONCE(unistd.h) | ||
68 | gt_CHECK_VAR_DECL([#include <errno.h>], errno) | ||
69 | gt_CHECK_VAR_DECL([#include <unistd.h>], environ) | ||
70 | ]) |
m4/signed.m4
0 → 100644
1 | # signed.m4 serial 1 (gettext-0.10.40) | ||
2 | dnl Copyright (C) 2001-2002 Free Software Foundation, Inc. | ||
3 | dnl This file is free software, distributed under the terms of the GNU | ||
4 | dnl General Public License. As a special exception to the GNU General | ||
5 | dnl Public License, this file may be distributed as part of a program | ||
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | |||
9 | dnl From Bruno Haible. | ||
10 | |||
11 | AC_DEFUN([bh_C_SIGNED], | ||
12 | [ | ||
13 | AC_CACHE_CHECK([for signed], bh_cv_c_signed, | ||
14 | [AC_TRY_COMPILE(, [signed char x;], bh_cv_c_signed=yes, bh_cv_c_signed=no)]) | ||
15 | if test $bh_cv_c_signed = no; then | ||
16 | AC_DEFINE(signed, , | ||
17 | [Define to empty if the C compiler doesn't support this keyword.]) | ||
18 | fi | ||
19 | ]) |
m4/size_max.m4
0 → 100644
1 | # size_max.m4 serial 2 | ||
2 | dnl Copyright (C) 2003 Free Software Foundation, Inc. | ||
3 | dnl This file is free software, distributed under the terms of the GNU | ||
4 | dnl General Public License. As a special exception to the GNU General | ||
5 | dnl Public License, this file may be distributed as part of a program | ||
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | |||
9 | dnl From Bruno Haible. | ||
10 | |||
11 | AC_DEFUN([gl_SIZE_MAX], | ||
12 | [ | ||
13 | AC_CHECK_HEADERS(stdint.h) | ||
14 | dnl First test whether the system already has SIZE_MAX. | ||
15 | AC_MSG_CHECKING([for SIZE_MAX]) | ||
16 | result= | ||
17 | AC_EGREP_CPP([Found it], [ | ||
18 | #include <limits.h> | ||
19 | #if HAVE_STDINT_H | ||
20 | #include <stdint.h> | ||
21 | #endif | ||
22 | #ifdef SIZE_MAX | ||
23 | Found it | ||
24 | #endif | ||
25 | ], result=yes) | ||
26 | if test -z "$result"; then | ||
27 | dnl Define it ourselves. Here we assume that the type 'size_t' is not wider | ||
28 | dnl than the type 'unsigned long'. | ||
29 | dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses 'expr', | ||
30 | dnl which is guaranteed to work from LONG_MIN to LONG_MAX. | ||
31 | _AC_COMPUTE_INT([~(size_t)0 / 10], res_hi, | ||
32 | [#include <stddef.h>], result=?) | ||
33 | _AC_COMPUTE_INT([~(size_t)0 % 10], res_lo, | ||
34 | [#include <stddef.h>], result=?) | ||
35 | _AC_COMPUTE_INT([sizeof (size_t) <= sizeof (unsigned int)], fits_in_uint, | ||
36 | [#include <stddef.h>], result=?) | ||
37 | if test "$fits_in_uint" = 1; then | ||
38 | dnl Even though SIZE_MAX fits in an unsigned int, it must be of type | ||
39 | dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. | ||
40 | AC_TRY_COMPILE([#include <stddef.h> | ||
41 | extern size_t foo; | ||
42 | extern unsigned long foo; | ||
43 | ], [], fits_in_uint=0) | ||
44 | fi | ||
45 | if test -z "$result"; then | ||
46 | if test "$fits_in_uint" = 1; then | ||
47 | result="$res_hi$res_lo"U | ||
48 | else | ||
49 | result="$res_hi$res_lo"UL | ||
50 | fi | ||
51 | else | ||
52 | dnl Shouldn't happen, but who knows... | ||
53 | result='~(size_t)0' | ||
54 | fi | ||
55 | fi | ||
56 | AC_MSG_RESULT([$result]) | ||
57 | if test "$result" != yes; then | ||
58 | AC_DEFINE_UNQUOTED([SIZE_MAX], [$result], | ||
59 | [Define as the maximum value of type 'size_t', if the system doesn't define it.]) | ||
60 | fi | ||
61 | ]) |
m4/snprintf.m4
0 → 100644
1 | # snprintf.m4 serial 2 | ||
2 | dnl Copyright (C) 2002, 2003, 2004 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 | AC_DEFUN([gl_FUNC_SNPRINTF], | ||
8 | [ | ||
9 | AC_REPLACE_FUNCS(snprintf) | ||
10 | AC_CHECK_DECLS_ONCE(snprintf) | ||
11 | gl_PREREQ_SNPRINTF | ||
12 | ]) | ||
13 | |||
14 | # Prerequisites of lib/snprintf.c. | ||
15 | AC_DEFUN([gl_PREREQ_SNPRINTF], [:]) |
m4/ssize_t.m4
0 → 100644
1 | # ssize_t.m4 serial 3 (gettext-0.13) | ||
2 | dnl Copyright (C) 2001-2003 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 ssize_t is defined. | ||
9 | |||
10 | AC_DEFUN([gt_TYPE_SSIZE_T], | ||
11 | [ | ||
12 | AC_CACHE_CHECK([for ssize_t], gt_cv_ssize_t, | ||
13 | [AC_TRY_COMPILE([#include <sys/types.h>], | ||
14 | [int x = sizeof (ssize_t *) + sizeof (ssize_t);], | ||
15 | gt_cv_ssize_t=yes, gt_cv_ssize_t=no)]) | ||
16 | if test $gt_cv_ssize_t = no; then | ||
17 | AC_DEFINE(ssize_t, int, | ||
18 | [Define as a signed type of the same size as size_t.]) | ||
19 | fi | ||
20 | ]) |
m4/stdbool.m4
0 → 100644
1 | # Check for stdbool.h that conforms to C99. | ||
2 | |||
3 | dnl Copyright (C) 2002-2004 Free Software Foundation, 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 | # Prepare for substituting <stdbool.h> if it is not supported. | ||
9 | |||
10 | AC_DEFUN([AM_STDBOOL_H], | ||
11 | [ | ||
12 | AC_REQUIRE([AC_HEADER_STDBOOL]) | ||
13 | |||
14 | # Define two additional variables used in the Makefile substitution. | ||
15 | |||
16 | if test "$ac_cv_header_stdbool_h" = yes; then | ||
17 | STDBOOL_H='' | ||
18 | else | ||
19 | STDBOOL_H='stdbool.h' | ||
20 | fi | ||
21 | AC_SUBST([STDBOOL_H]) | ||
22 | |||
23 | if test "$ac_cv_type__Bool" = yes; then | ||
24 | HAVE__BOOL=1 | ||
25 | else | ||
26 | HAVE__BOOL=0 | ||
27 | fi | ||
28 | AC_SUBST([HAVE__BOOL]) | ||
29 | ]) | ||
30 | |||
31 | # This macro is only needed in autoconf <= 2.59. Newer versions of autoconf | ||
32 | # have this macro built-in. | ||
33 | |||
34 | AC_DEFUN([AC_HEADER_STDBOOL], | ||
35 | [AC_CACHE_CHECK([for stdbool.h that conforms to C99], | ||
36 | [ac_cv_header_stdbool_h], | ||
37 | [AC_TRY_COMPILE( | ||
38 | [ | ||
39 | #include <stdbool.h> | ||
40 | #ifndef bool | ||
41 | "error: bool is not defined" | ||
42 | #endif | ||
43 | #ifndef false | ||
44 | "error: false is not defined" | ||
45 | #endif | ||
46 | #if false | ||
47 | "error: false is not 0" | ||
48 | #endif | ||
49 | #ifndef true | ||
50 | "error: true is not defined" | ||
51 | #endif | ||
52 | #if true != 1 | ||
53 | "error: true is not 1" | ||
54 | #endif | ||
55 | #ifndef __bool_true_false_are_defined | ||
56 | "error: __bool_true_false_are_defined is not defined" | ||
57 | #endif | ||
58 | |||
59 | struct s { _Bool s: 1; _Bool t; } s; | ||
60 | |||
61 | char a[true == 1 ? 1 : -1]; | ||
62 | char b[false == 0 ? 1 : -1]; | ||
63 | char c[__bool_true_false_are_defined == 1 ? 1 : -1]; | ||
64 | char d[(bool) -0.5 == true ? 1 : -1]; | ||
65 | bool e = &s; | ||
66 | char f[(_Bool) -0.0 == false ? 1 : -1]; | ||
67 | char g[true]; | ||
68 | char h[sizeof (_Bool)]; | ||
69 | char i[sizeof s.t]; | ||
70 | enum { j = false, k = true, l = false * true, m = true * 256 }; | ||
71 | _Bool n[m]; | ||
72 | char o[sizeof n == m * sizeof n[0] ? 1 : -1]; | ||
73 | ], | ||
74 | [ | ||
75 | return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !j + !k + !l | ||
76 | + !m + !n + !o); | ||
77 | ], | ||
78 | [ac_cv_header_stdbool_h=yes], | ||
79 | [ac_cv_header_stdbool_h=no])]) | ||
80 | AC_CHECK_TYPES([_Bool]) | ||
81 | if test $ac_cv_header_stdbool_h = yes; then | ||
82 | AC_DEFINE(HAVE_STDBOOL_H, 1, [Define to 1 if stdbool.h conforms to C99.]) | ||
83 | fi]) |
m4/stdint_h_gl.m4
0 → 100644
1 | # stdint_h.m4 serial 5 | ||
2 | dnl Copyright (C) 1997-2004 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 | # Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists, | ||
10 | # doesn't clash with <sys/types.h>, and declares uintmax_t. | ||
11 | |||
12 | AC_DEFUN([gl_AC_HEADER_STDINT_H], | ||
13 | [ | ||
14 | AC_CACHE_CHECK([for stdint.h], gl_cv_header_stdint_h, | ||
15 | [AC_TRY_COMPILE( | ||
16 | [#include <sys/types.h> | ||
17 | #include <stdint.h>], | ||
18 | [uintmax_t i = (uintmax_t) -1;], | ||
19 | gl_cv_header_stdint_h=yes, | ||
20 | gl_cv_header_stdint_h=no)]) | ||
21 | if test $gl_cv_header_stdint_h = yes; then | ||
22 | AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1, | ||
23 | [Define if <stdint.h> exists, doesn't clash with <sys/types.h>, | ||
24 | and declares uintmax_t. ]) | ||
25 | fi | ||
26 | ]) |
m4/strcase.m4
0 → 100644
1 | # strcase.m4 serial 1 | ||
2 | dnl Copyright (C) 2002 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 | AC_DEFUN([gl_STRCASE], | ||
8 | [ | ||
9 | gl_FUNC_STRCASECMP | ||
10 | gl_FUNC_STRNCASECMP | ||
11 | ]) | ||
12 | |||
13 | AC_DEFUN([gl_FUNC_STRCASECMP], | ||
14 | [ | ||
15 | MU_REPLACE_FUNCS(strcasecmp) | ||
16 | if test $ac_cv_func_strcasecmp = no; then | ||
17 | gl_PREREQ_STRCASECMP | ||
18 | fi | ||
19 | ]) | ||
20 | |||
21 | AC_DEFUN([gl_FUNC_STRNCASECMP], | ||
22 | [ | ||
23 | MU_REPLACE_FUNCS(strncasecmp) | ||
24 | if test $ac_cv_func_strncasecmp = no; then | ||
25 | gl_PREREQ_STRNCASECMP | ||
26 | fi | ||
27 | ]) | ||
28 | |||
29 | # Prerequisites of lib/strcasecmp.c. | ||
30 | AC_DEFUN([gl_PREREQ_STRCASECMP], [ | ||
31 | : | ||
32 | ]) | ||
33 | |||
34 | # Prerequisites of lib/strncasecmp.c. | ||
35 | AC_DEFUN([gl_PREREQ_STRNCASECMP], [ | ||
36 | : | ||
37 | ]) |
m4/strchrnul.m4
0 → 100644
1 | # strchrnul.m4 serial 3 | ||
2 | dnl Copyright (C) 2003 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 | AC_DEFUN([gl_FUNC_STRCHRNUL], | ||
8 | [ | ||
9 | dnl Persuade glibc <string.h> to declare strchrnul(). | ||
10 | AC_REQUIRE([AC_GNU_SOURCE]) | ||
11 | |||
12 | MU_REPLACE_FUNCS(strchrnul) | ||
13 | if test $ac_cv_func_strchrnul = no; then | ||
14 | gl_PREREQ_STRCHRNUL | ||
15 | fi | ||
16 | ]) | ||
17 | |||
18 | # Prerequisites of lib/strchrnul.c. | ||
19 | AC_DEFUN([gl_PREREQ_STRCHRNUL], [:]) |
m4/strerror_r.m4
0 → 100644
1 | #serial 1004 | ||
2 | # This file is not needed if you can assume Autoconf 2.54 or later. | ||
3 | # Experimental replacement for the function in the latest CVS autoconf. | ||
4 | # Use with the error.c file in ../lib. | ||
5 | |||
6 | # Copyright (C) 2001 Free Software Foundation, Inc. | ||
7 | # This file is free software; the Free Software Foundation | ||
8 | # gives unlimited permission to copy and/or distribute it, | ||
9 | # with or without modifications, as long as this notice is preserved. | ||
10 | |||
11 | undefine([AC_FUNC_STRERROR_R]) | ||
12 | |||
13 | # AC_FUNC_STRERROR_R | ||
14 | # ------------------ | ||
15 | AC_DEFUN([AC_FUNC_STRERROR_R], | ||
16 | [AC_CHECK_DECLS([strerror_r]) | ||
17 | AC_CHECK_FUNCS([strerror_r]) | ||
18 | AC_CACHE_CHECK([whether strerror_r returns char *], | ||
19 | ac_cv_func_strerror_r_char_p, | ||
20 | [ | ||
21 | ac_cv_func_strerror_r_char_p=no | ||
22 | if test $ac_cv_have_decl_strerror_r = yes; then | ||
23 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], | ||
24 | [[ | ||
25 | char buf[100]; | ||
26 | char x = *strerror_r (0, buf, sizeof buf); | ||
27 | char *p = strerror_r (0, buf, sizeof buf); | ||
28 | ]])], | ||
29 | ac_cv_func_strerror_r_char_p=yes) | ||
30 | else | ||
31 | # strerror_r is not declared. Choose between | ||
32 | # systems that have relatively inaccessible declarations for the | ||
33 | # function. BeOS and DEC UNIX 4.0 fall in this category, but the | ||
34 | # former has a strerror_r that returns char*, while the latter | ||
35 | # has a strerror_r that returns `int'. | ||
36 | # This test should segfault on the DEC system. | ||
37 | AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT | ||
38 | extern char *strerror_r ();], | ||
39 | [[char buf[100]; | ||
40 | char x = *strerror_r (0, buf, sizeof buf); | ||
41 | exit (!isalpha (x));]])], | ||
42 | ac_cv_func_strerror_r_char_p=yes, , :) | ||
43 | fi | ||
44 | ]) | ||
45 | if test $ac_cv_func_strerror_r_char_p = yes; then | ||
46 | AC_DEFINE([STRERROR_R_CHAR_P], 1, | ||
47 | [Define to 1 if strerror_r returns char *.]) | ||
48 | fi | ||
49 | ])# AC_FUNC_STRERROR_R |
m4/strndup.m4
0 → 100644
1 | # strndup.m4 serial 3 | ||
2 | dnl Copyright (C) 2002, 2003 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 | AC_DEFUN([gl_FUNC_STRNDUP], | ||
8 | [ | ||
9 | dnl Persuade glibc <string.h> to declare strndup(). | ||
10 | AC_REQUIRE([AC_GNU_SOURCE]) | ||
11 | |||
12 | MU_REPLACE_FUNCS(strndup) | ||
13 | if test $ac_cv_func_strndup = no; then | ||
14 | gl_PREREQ_STRNDUP | ||
15 | fi | ||
16 | ]) | ||
17 | |||
18 | # Prerequisites of lib/strndup.c. | ||
19 | AC_DEFUN([gl_PREREQ_STRNDUP], [ | ||
20 | AC_CHECK_DECLS(strnlen) | ||
21 | ]) |
m4/strnlen.m4
0 → 100644
1 | # strnlen.m4 serial 4 | ||
2 | dnl Copyright (C) 2002-2003 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 | AC_DEFUN([gl_FUNC_STRNLEN], | ||
8 | [ | ||
9 | dnl Persuade glibc <string.h> to declare strnlen(). | ||
10 | AC_REQUIRE([AC_GNU_SOURCE]) | ||
11 | |||
12 | AC_FUNC_STRNLEN | ||
13 | if test $ac_cv_func_strnlen_working = no; then | ||
14 | # This is necessary because automake-1.6.1 doens't understand | ||
15 | # that the above use of AC_FUNC_STRNLEN means we may have to use | ||
16 | # lib/strnlen.c. | ||
17 | #MU_LIBOBJ(strnlen) | ||
18 | AC_DEFINE(strnlen, rpl_strnlen, | ||
19 | [Define to rpl_strnlen if the replacement function should be used.]) | ||
20 | gl_PREREQ_STRNLEN | ||
21 | fi | ||
22 | ]) | ||
23 | |||
24 | # Prerequisites of lib/strnlen.c. | ||
25 | AC_DEFUN([gl_PREREQ_STRNLEN], [:]) |
m4/strtok_r.m4
0 → 100644
1 | # strtok_r.m4 serial 2 | ||
2 | dnl Copyright (C) 2002, 2003, 2004 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 | AC_DEFUN([gl_FUNC_STRTOK_R], | ||
8 | [ | ||
9 | MU_REPLACE_FUNCS(strtok_r) | ||
10 | AC_CHECK_DECLS_ONCE(strtok_r) | ||
11 | gl_PREREQ_STRTOK_R | ||
12 | ]) | ||
13 | |||
14 | # Prerequisites of lib/strtok_r.h and lib/strtok_r.c. | ||
15 | AC_DEFUN([gl_PREREQ_STRTOK_R], [ | ||
16 | AC_REQUIRE([gl_C_RESTRICT]) | ||
17 | ]) |
m4/sysexits.m4
0 → 100644
1 | # sysexits.m4 serial 2 | ||
2 | dnl Copyright (C) 2003,2005 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 | AC_DEFUN([gl_SYSEXITS], | ||
8 | [ | ||
9 | AC_CHECK_HEADERS(sysexits.h, | ||
10 | [SYSEXITS_H=], | ||
11 | [SYSEXITS_H=sysexits.h]) | ||
12 | AC_SUBST([SYSEXITS_H]) | ||
13 | ]) |
m4/uint32_t.m4
0 → 100644
1 | # uint32_t.m4 serial 4 | ||
2 | |||
3 | # Copyright (C) 2004 Free Software Foundation, Inc. | ||
4 | # This file is free software; the Free Software Foundation | ||
5 | # gives unlimited permission to copy and/or distribute it, | ||
6 | # with or without modifications, as long as this notice is preserved. | ||
7 | |||
8 | # Written by Paul Eggert. | ||
9 | |||
10 | AC_DEFUN([gl_AC_TYPE_UINT32_T], | ||
11 | [ | ||
12 | AC_CACHE_CHECK([for uint32_t], gl_cv_c_uint32_t, | ||
13 | [gl_cv_c_uint32_t=no | ||
14 | for ac_type in "uint32_t" "unsigned int" \ | ||
15 | "unsigned long int" "unsigned short int"; do | ||
16 | AC_COMPILE_IFELSE( | ||
17 | [AC_LANG_BOOL_COMPILE_TRY( | ||
18 | [AC_INCLUDES_DEFAULT], | ||
19 | [[($ac_type) -1 == 4294967295U]])], | ||
20 | [gl_cv_c_uint32_t=$ac_type]) | ||
21 | test "$gl_cv_c_uint32_t" != no && break | ||
22 | done]) | ||
23 | case "$gl_cv_c_uint32_t" in | ||
24 | no|uint32_t) ;; | ||
25 | *) | ||
26 | AC_DEFINE(_UINT32_T, 1, | ||
27 | [Define for Solaris 2.5.1 so uint32_t typedef from <sys/synch.h>, | ||
28 | <pthread.h>, or <semaphore.h> is not used. If the typedef was | ||
29 | allowed, the #define below would cause a syntax error.]) | ||
30 | AC_DEFINE_UNQUOTED(uint32_t, $gl_cv_c_uint32_t, | ||
31 | [Define to the type of a unsigned integer type of width exactly 32 bits | ||
32 | if such a type exists and the standard includes do not define it.]) | ||
33 | ;; | ||
34 | esac | ||
35 | |||
36 | AC_CACHE_CHECK([for UINT32_MAX], gl_cv_c_uint32_max, | ||
37 | [AC_COMPILE_IFELSE( | ||
38 | [AC_LANG_BOOL_COMPILE_TRY( | ||
39 | [AC_INCLUDES_DEFAULT], | ||
40 | [[UINT32_MAX == 4294967295U]])], | ||
41 | [gl_cv_c_uint32_max=yes], | ||
42 | [gl_cv_c_uint32_max=no])]) | ||
43 | case $gl_cv_c_uint32_max,$gl_cv_c_uint32_t in | ||
44 | yes,*) ;; | ||
45 | *,no) ;; | ||
46 | *) | ||
47 | AC_DEFINE(UINT32_MAX, 4294967295U, | ||
48 | [Define to its maximum value if an unsigned integer type of width | ||
49 | exactly 32 bits exists and the standard includes do not define | ||
50 | UINT32_MAX.]) | ||
51 | ;; | ||
52 | esac | ||
53 | ]) |
m4/uintmax_t_gl.m4
0 → 100644
1 | # uintmax_t.m4 serial 9 | ||
2 | dnl Copyright (C) 1997-2004 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([gl_AC_TYPE_UNSIGNED_LONG_LONG]) | ||
20 | test $ac_cv_type_unsigned_long_long = 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 | ]) |
m4/ulonglong_gl.m4
0 → 100644
1 | # ulonglong.m4 serial 4 | ||
2 | dnl Copyright (C) 1999-2004 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 | # Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works. | ||
10 | |||
11 | AC_DEFUN([gl_AC_TYPE_UNSIGNED_LONG_LONG], | ||
12 | [ | ||
13 | AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long, | ||
14 | [AC_TRY_LINK([unsigned long long ull = 1ULL; int i = 63;], | ||
15 | [unsigned long long ullmax = (unsigned long long) -1; | ||
16 | return ull << i | ull >> i | ullmax / ull | ullmax % ull;], | ||
17 | ac_cv_type_unsigned_long_long=yes, | ||
18 | ac_cv_type_unsigned_long_long=no)]) | ||
19 | if test $ac_cv_type_unsigned_long_long = yes; then | ||
20 | AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1, | ||
21 | [Define if you have the 'unsigned long long' type.]) | ||
22 | fi | ||
23 | ]) |
m4/vasnprintf.m4
0 → 100644
1 | # vasnprintf.m4 serial 5 | ||
2 | dnl Copyright (C) 2002-2004 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 | AC_DEFUN([gl_FUNC_VASNPRINTF], | ||
8 | [ | ||
9 | AC_REQUIRE([gl_EOVERFLOW]) | ||
10 | MU_REPLACE_FUNCS(vasnprintf) | ||
11 | if test $ac_cv_func_vasnprintf = no; then | ||
12 | MU_LIBOBJ(printf-args) | ||
13 | MU_LIBOBJ(printf-parse) | ||
14 | MU_LIBOBJ(asnprintf) | ||
15 | gl_PREREQ_PRINTF_ARGS | ||
16 | gl_PREREQ_PRINTF_PARSE | ||
17 | gl_PREREQ_VASNPRINTF | ||
18 | gl_PREREQ_ASNPRINTF | ||
19 | fi | ||
20 | ]) | ||
21 | |||
22 | # Prequisites of lib/printf-args.h, lib/printf-args.c. | ||
23 | AC_DEFUN([gl_PREREQ_PRINTF_ARGS], | ||
24 | [ | ||
25 | AC_REQUIRE([bh_C_SIGNED]) | ||
26 | AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) | ||
27 | AC_REQUIRE([gt_TYPE_LONGDOUBLE]) | ||
28 | AC_REQUIRE([gt_TYPE_WCHAR_T]) | ||
29 | AC_REQUIRE([gt_TYPE_WINT_T]) | ||
30 | ]) | ||
31 | |||
32 | # Prequisites of lib/printf-parse.h, lib/printf-parse.c. | ||
33 | AC_DEFUN([gl_PREREQ_PRINTF_PARSE], | ||
34 | [ | ||
35 | AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) | ||
36 | AC_REQUIRE([gt_TYPE_LONGDOUBLE]) | ||
37 | AC_REQUIRE([gt_TYPE_WCHAR_T]) | ||
38 | AC_REQUIRE([gt_TYPE_WINT_T]) | ||
39 | AC_REQUIRE([AC_TYPE_SIZE_T]) | ||
40 | AC_CHECK_TYPES(ptrdiff_t) | ||
41 | AC_REQUIRE([gt_AC_TYPE_INTMAX_T]) | ||
42 | ]) | ||
43 | |||
44 | # Prerequisites of lib/vasnprintf.c. | ||
45 | AC_DEFUN([gl_PREREQ_VASNPRINTF], | ||
46 | [ | ||
47 | AC_REQUIRE([AC_FUNC_ALLOCA]) | ||
48 | AC_REQUIRE([gl_AC_TYPE_LONG_LONG]) | ||
49 | AC_REQUIRE([gt_TYPE_LONGDOUBLE]) | ||
50 | AC_REQUIRE([gt_TYPE_WCHAR_T]) | ||
51 | AC_REQUIRE([gt_TYPE_WINT_T]) | ||
52 | AC_CHECK_FUNCS(snprintf wcslen) | ||
53 | ]) | ||
54 | |||
55 | # Prerequisites of lib/asnprintf.c. | ||
56 | AC_DEFUN([gl_PREREQ_ASNPRINTF], | ||
57 | [ | ||
58 | ]) |
m4/vasprintf.m4
0 → 100644
1 | # vasprintf.m4 serial 1 | ||
2 | dnl Copyright (C) 2002-2003 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 | AC_DEFUN([gl_FUNC_VASPRINTF], | ||
8 | [ | ||
9 | AC_REPLACE_FUNCS(vasprintf) | ||
10 | if test $ac_cv_func_vasprintf = no; then | ||
11 | AC_LIBOBJ(asprintf) | ||
12 | gl_PREREQ_VASPRINTF | ||
13 | gl_PREREQ_ASPRINTF | ||
14 | fi | ||
15 | ]) | ||
16 | |||
17 | # Prerequisites of lib/vasprintf.c. | ||
18 | AC_DEFUN([gl_PREREQ_VASPRINTF], | ||
19 | [ | ||
20 | ]) | ||
21 | |||
22 | # Prerequisites of lib/asprintf.c. | ||
23 | AC_DEFUN([gl_PREREQ_ASPRINTF], | ||
24 | [ | ||
25 | ]) |
m4/vsnprintf.m4
0 → 100644
1 | # vsnprintf.m4 serial 2 | ||
2 | dnl Copyright (C) 2002, 2003, 2004 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 | AC_DEFUN([gl_FUNC_VSNPRINTF], | ||
8 | [ | ||
9 | MU_REPLACE_FUNCS(vsnprintf) | ||
10 | AC_CHECK_DECLS_ONCE(vsnprintf) | ||
11 | gl_PREREQ_VSNPRINTF | ||
12 | ]) | ||
13 | |||
14 | # Prerequisites of lib/vsnprintf.c. | ||
15 | AC_DEFUN([gl_PREREQ_VSNPRINTF], [:]) |
m4/wchar_t.m4
0 → 100644
1 | # wchar_t.m4 serial 1 (gettext-0.12) | ||
2 | dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. | ||
3 | dnl This file is free software, distributed under the terms of the GNU | ||
4 | dnl General Public License. As a special exception to the GNU General | ||
5 | dnl Public License, this file may be distributed as part of a program | ||
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | |||
9 | dnl From Bruno Haible. | ||
10 | dnl Test whether <stddef.h> has the 'wchar_t' type. | ||
11 | dnl Prerequisite: AC_PROG_CC | ||
12 | |||
13 | AC_DEFUN([gt_TYPE_WCHAR_T], | ||
14 | [ | ||
15 | AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t, | ||
16 | [AC_TRY_COMPILE([#include <stddef.h> | ||
17 | wchar_t foo = (wchar_t)'\0';], , | ||
18 | gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)]) | ||
19 | if test $gt_cv_c_wchar_t = yes; then | ||
20 | AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.]) | ||
21 | fi | ||
22 | ]) |
m4/wint_t.m4
0 → 100644
1 | # wint_t.m4 serial 1 (gettext-0.12) | ||
2 | dnl Copyright (C) 2003 Free Software Foundation, Inc. | ||
3 | dnl This file is free software, distributed under the terms of the GNU | ||
4 | dnl General Public License. As a special exception to the GNU General | ||
5 | dnl Public License, this file may be distributed as part of a program | ||
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | |||
9 | dnl From Bruno Haible. | ||
10 | dnl Test whether <wchar.h> has the 'wint_t' type. | ||
11 | dnl Prerequisite: AC_PROG_CC | ||
12 | |||
13 | AC_DEFUN([gt_TYPE_WINT_T], | ||
14 | [ | ||
15 | AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t, | ||
16 | [AC_TRY_COMPILE([#include <wchar.h> | ||
17 | wint_t foo = (wchar_t)'\0';], , | ||
18 | gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)]) | ||
19 | if test $gt_cv_c_wint_t = yes; then | ||
20 | AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.]) | ||
21 | fi | ||
22 | ]) |
m4/xalloc.m4
0 → 100644
1 | # xalloc.m4 serial 11 | ||
2 | dnl Copyright (C) 2002, 2003, 2004 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 | AC_DEFUN([gl_XALLOC], | ||
8 | [ | ||
9 | gl_PREREQ_XALLOC | ||
10 | gl_PREREQ_XMALLOC | ||
11 | ]) | ||
12 | |||
13 | # Prerequisites of lib/xalloc.h. | ||
14 | AC_DEFUN([gl_PREREQ_XALLOC], [ | ||
15 | : | ||
16 | ]) | ||
17 | |||
18 | # Prerequisites of lib/xmalloc.c. | ||
19 | AC_DEFUN([gl_PREREQ_XMALLOC], [ | ||
20 | AC_REQUIRE([AC_C_INLINE]) | ||
21 | : | ||
22 | ]) |
m4/xsize.m4
0 → 100644
1 | # xsize.m4 serial 2 | ||
2 | dnl Copyright (C) 2003 Free Software Foundation, Inc. | ||
3 | dnl This file is free software, distributed under the terms of the GNU | ||
4 | dnl General Public License. As a special exception to the GNU General | ||
5 | dnl Public License, this file may be distributed as part of a program | ||
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | |||
9 | AC_DEFUN([gl_XSIZE], | ||
10 | [ | ||
11 | dnl Prerequisites of lib/xsize.h. | ||
12 | AC_REQUIRE([gl_SIZE_MAX]) | ||
13 | AC_CHECK_HEADERS(stdint.h) | ||
14 | ]) |
m4/xstrtol.m4
0 → 100644
1 | # xstrtol.m4 serial 5 | ||
2 | dnl Copyright (C) 2002, 2003, 2004 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 | AC_DEFUN([gl_XSTRTOL], | ||
8 | [ | ||
9 | AC_REQUIRE([gl_PREREQ_XSTRTOL]) | ||
10 | AC_REQUIRE([gl_PREREQ_XSTRTOUL]) | ||
11 | ]) | ||
12 | |||
13 | # Prerequisites of lib/xstrtol.h. | ||
14 | AC_DEFUN([gl_PREREQ_XSTRTOL_H], | ||
15 | [ | ||
16 | AC_REQUIRE([gl_AC_TYPE_INTMAX_T]) | ||
17 | AC_REQUIRE([gl_AC_TYPE_UINTMAX_T]) | ||
18 | ]) | ||
19 | |||
20 | # Prerequisites of lib/xstrtol.c. | ||
21 | AC_DEFUN([gl_PREREQ_XSTRTOL], | ||
22 | [ | ||
23 | AC_REQUIRE([gl_PREREQ_XSTRTOL_H]) | ||
24 | AC_REQUIRE([AC_HEADER_STDC]) | ||
25 | AC_CHECK_FUNCS_ONCE(isascii) | ||
26 | AC_CHECK_DECLS([strtoimax, strtoumax]) | ||
27 | ]) | ||
28 | |||
29 | # Prerequisites of lib/xstrtoul.c. | ||
30 | AC_DEFUN([gl_PREREQ_XSTRTOUL], | ||
31 | [ | ||
32 | AC_REQUIRE([gl_PREREQ_XSTRTOL]) | ||
33 | ]) |
mailbox/alloca.c
0 → 100644
This diff is collapsed.
Click to expand it.
mailbox/alloca_.h
0 → 100644
1 | /* Memory allocation on the stack. | ||
2 | |||
3 | Copyright (C) 1995, 1999, 2001, 2002, 2003, 2004 Free Software | ||
4 | Foundation, Inc. | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify it | ||
7 | under the terms of the GNU General Public License as published | ||
8 | by the Free Software Foundation; either version 2, or (at your option) | ||
9 | 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 GNU | ||
14 | General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public | ||
17 | License along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | ||
19 | USA. */ | ||
20 | |||
21 | /* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H | ||
22 | means there is a real alloca function. */ | ||
23 | #ifndef _GNULIB_ALLOCA_H | ||
24 | # define _GNULIB_ALLOCA_H | ||
25 | |||
26 | /* alloca (N) returns a pointer to N bytes of memory | ||
27 | allocated on the stack, which will last until the function returns. | ||
28 | Use of alloca should be avoided: | ||
29 | - inside arguments of function calls - undefined behaviour, | ||
30 | - in inline functions - the allocation may actually last until the | ||
31 | calling function returns, | ||
32 | - for huge N (say, N >= 65536) - you never know how large (or small) | ||
33 | the stack is, and when the stack cannot fulfill the memory allocation | ||
34 | request, the program just crashes. | ||
35 | */ | ||
36 | |||
37 | #ifdef __GNUC__ | ||
38 | # define alloca __builtin_alloca | ||
39 | #elif defined _AIX | ||
40 | # define alloca __alloca | ||
41 | #elif defined _MSC_VER | ||
42 | # include <malloc.h> | ||
43 | # define alloca _alloca | ||
44 | #else | ||
45 | # include <stddef.h> | ||
46 | # ifdef __cplusplus | ||
47 | extern "C" | ||
48 | # endif | ||
49 | void *alloca (size_t); | ||
50 | #endif | ||
51 | |||
52 | #endif /* _GNULIB_ALLOCA_H */ |
mailbox/asnprintf.c
0 → 100644
1 | /* Formatted output to strings. | ||
2 | Copyright (C) 1999, 2002 Free Software Foundation, Inc. | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 2, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License along | ||
15 | with this program; if not, write to the Free Software Foundation, | ||
16 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
17 | |||
18 | #ifdef HAVE_CONFIG_H | ||
19 | # include <config.h> | ||
20 | #endif | ||
21 | |||
22 | /* Specification. */ | ||
23 | #include "vasnprintf.h" | ||
24 | |||
25 | #include <stdarg.h> | ||
26 | |||
27 | char * | ||
28 | asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) | ||
29 | { | ||
30 | va_list args; | ||
31 | char *result; | ||
32 | |||
33 | va_start (args, format); | ||
34 | result = vasnprintf (resultbuf, lengthp, format, args); | ||
35 | va_end (args); | ||
36 | return result; | ||
37 | } |
mailbox/getndelim2.c
0 → 100644
1 | /* getndelim2 - Read a line from a stream, stopping at one of 2 delimiters, | ||
2 | with bounded memory allocation. | ||
3 | |||
4 | Copyright (C) 1993, 1996, 1997, 1998, 2000, 2003, 2004 Free Software | ||
5 | Foundation, Inc. | ||
6 | |||
7 | This program is free software; you can redistribute it and/or modify | ||
8 | it under the terms of the GNU General Public License as published by | ||
9 | the Free Software Foundation; either version 2, or (at your option) | ||
10 | any later version. | ||
11 | |||
12 | This program is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | GNU General Public License for more details. | ||
16 | |||
17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program; if not, write to the Free Software Foundation, | ||
19 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
20 | |||
21 | /* Originally written by Jan Brittenson, bson@gnu.ai.mit.edu. */ | ||
22 | |||
23 | #if HAVE_CONFIG_H | ||
24 | # include <config.h> | ||
25 | #endif | ||
26 | |||
27 | #include "getndelim2.h" | ||
28 | |||
29 | #include <stdlib.h> | ||
30 | #include <stddef.h> | ||
31 | |||
32 | #if USE_UNLOCKED_IO | ||
33 | # include "unlocked-io.h" | ||
34 | #endif | ||
35 | |||
36 | #include <limits.h> | ||
37 | #if HAVE_INTTYPES_H | ||
38 | # include <inttypes.h> | ||
39 | #endif | ||
40 | #if HAVE_STDINT_H | ||
41 | # include <stdint.h> | ||
42 | #endif | ||
43 | #ifndef PTRDIFF_MAX | ||
44 | # define PTRDIFF_MAX ((ptrdiff_t) (SIZE_MAX / 2)) | ||
45 | #endif | ||
46 | #ifndef SIZE_MAX | ||
47 | # define SIZE_MAX ((size_t) -1) | ||
48 | #endif | ||
49 | #ifndef SSIZE_MAX | ||
50 | # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) | ||
51 | #endif | ||
52 | |||
53 | /* The maximum value that getndelim2 can return without suffering from | ||
54 | overflow problems, either internally (because of pointer | ||
55 | subtraction overflow) or due to the API (because of ssize_t). */ | ||
56 | #define GETNDELIM2_MAXIMUM (PTRDIFF_MAX < SSIZE_MAX ? PTRDIFF_MAX : SSIZE_MAX) | ||
57 | |||
58 | /* Try to add at least this many bytes when extending the buffer. | ||
59 | MIN_CHUNK must be no greater than GETNDELIM2_MAXIMUM. */ | ||
60 | #define MIN_CHUNK 64 | ||
61 | |||
62 | ssize_t | ||
63 | getndelim2 (char **lineptr, size_t *linesize, size_t offset, size_t nmax, | ||
64 | int delim1, int delim2, FILE *stream) | ||
65 | { | ||
66 | size_t nbytes_avail; /* Allocated but unused bytes in *LINEPTR. */ | ||
67 | char *read_pos; /* Where we're reading into *LINEPTR. */ | ||
68 | ssize_t bytes_stored = -1; | ||
69 | char *ptr = *lineptr; | ||
70 | size_t size = *linesize; | ||
71 | |||
72 | if (!ptr) | ||
73 | { | ||
74 | size = nmax < MIN_CHUNK ? nmax : MIN_CHUNK; | ||
75 | ptr = malloc (size); | ||
76 | if (!ptr) | ||
77 | return -1; | ||
78 | } | ||
79 | |||
80 | if (size < offset) | ||
81 | goto done; | ||
82 | |||
83 | nbytes_avail = size - offset; | ||
84 | read_pos = ptr + offset; | ||
85 | |||
86 | if (nbytes_avail == 0 && nmax <= size) | ||
87 | goto done; | ||
88 | |||
89 | for (;;) | ||
90 | { | ||
91 | /* Here always ptr + size == read_pos + nbytes_avail. */ | ||
92 | |||
93 | int c; | ||
94 | |||
95 | /* We always want at least one byte left in the buffer, since we | ||
96 | always (unless we get an error while reading the first byte) | ||
97 | NUL-terminate the line buffer. */ | ||
98 | |||
99 | if (nbytes_avail < 2 && size < nmax) | ||
100 | { | ||
101 | size_t newsize = size < MIN_CHUNK ? size + MIN_CHUNK : 2 * size; | ||
102 | char *newptr; | ||
103 | |||
104 | if (! (size < newsize && newsize <= nmax)) | ||
105 | newsize = nmax; | ||
106 | |||
107 | if (GETNDELIM2_MAXIMUM < newsize - offset) | ||
108 | { | ||
109 | size_t newsizemax = offset + GETNDELIM2_MAXIMUM + 1; | ||
110 | if (size == newsizemax) | ||
111 | goto done; | ||
112 | newsize = newsizemax; | ||
113 | } | ||
114 | |||
115 | nbytes_avail = newsize - (read_pos - ptr); | ||
116 | newptr = realloc (ptr, newsize); | ||
117 | if (!newptr) | ||
118 | goto done; | ||
119 | ptr = newptr; | ||
120 | size = newsize; | ||
121 | read_pos = size - nbytes_avail + ptr; | ||
122 | } | ||
123 | |||
124 | c = getc (stream); | ||
125 | if (c == EOF) | ||
126 | { | ||
127 | /* Return partial line, if any. */ | ||
128 | if (read_pos == ptr) | ||
129 | goto done; | ||
130 | else | ||
131 | break; | ||
132 | } | ||
133 | |||
134 | if (nbytes_avail >= 2) | ||
135 | { | ||
136 | *read_pos++ = c; | ||
137 | nbytes_avail--; | ||
138 | } | ||
139 | |||
140 | if (c == delim1 || c == delim2) | ||
141 | /* Return the line. */ | ||
142 | break; | ||
143 | } | ||
144 | |||
145 | /* Done - NUL terminate and return the number of bytes read. | ||
146 | At this point we know that nbytes_avail >= 1. */ | ||
147 | *read_pos = '\0'; | ||
148 | |||
149 | bytes_stored = read_pos - (ptr + offset); | ||
150 | |||
151 | done: | ||
152 | *lineptr = ptr; | ||
153 | *linesize = size; | ||
154 | return bytes_stored; | ||
155 | } |
mailbox/getndelim2.h
0 → 100644
1 | /* getndelim2 - Read a line from a stream, stopping at one of 2 delimiters, | ||
2 | with bounded memory allocation. | ||
3 | |||
4 | Copyright (C) 2003, 2004 Free Software 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 2, or (at your option) | ||
9 | 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, write to the Free Software Foundation, | ||
18 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
19 | |||
20 | #ifndef GETNDELIM2_H | ||
21 | #define GETNDELIM2_H 1 | ||
22 | |||
23 | #include <stdio.h> | ||
24 | #include <sys/types.h> | ||
25 | |||
26 | #define GETNLINE_NO_LIMIT ((size_t) -1) | ||
27 | |||
28 | /* Read into a buffer *LINEPTR returned from malloc (or NULL), | ||
29 | pointing to *LINESIZE bytes of space. Store the input bytes | ||
30 | starting at *LINEPTR + OFFSET, and null-terminate them. Reallocate | ||
31 | the buffer as necessary, but if NMAX is not GETNLINE_NO_LIMIT | ||
32 | then do not allocate more than NMAX bytes; if the line is longer | ||
33 | than that, read and discard the extra bytes. Stop reading after | ||
34 | after the first occurrence of DELIM1 or DELIM2, whichever comes | ||
35 | first; a delimiter equal to EOF stands for no delimiter. Read the | ||
36 | input bytes from STREAM. | ||
37 | Return the number of bytes read and stored at *LINEPTR + OFFSET (not | ||
38 | including the NUL terminator), or -1 on error or EOF. */ | ||
39 | extern ssize_t getndelim2 (char **lineptr, size_t *linesize, size_t offset, | ||
40 | size_t nmax, int delim1, int delim2, | ||
41 | FILE *stream); | ||
42 | |||
43 | #endif /* GETNDELIM2_H */ |
mailbox/getopt_.h
0 → 100644
1 | /* Declarations for getopt. | ||
2 | Copyright (C) 1989-1994,1996-1999,2001,2003,2004 | ||
3 | Free Software Foundation, Inc. | ||
4 | This file is part of the GNU C Library. | ||
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 2, or (at your option) | ||
9 | 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 along | ||
17 | with this program; if not, write to the Free Software Foundation, | ||
18 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
19 | |||
20 | #ifndef _GETOPT_H | ||
21 | |||
22 | #ifndef __need_getopt | ||
23 | # define _GETOPT_H 1 | ||
24 | #endif | ||
25 | |||
26 | /* Standalone applications should #define __GETOPT_PREFIX to an | ||
27 | identifier that prefixes the external functions and variables | ||
28 | defined in this header. When this happens, include the | ||
29 | headers that might declare getopt so that they will not cause | ||
30 | confusion if included after this file. Then systematically rename | ||
31 | identifiers so that they do not collide with the system functions | ||
32 | and variables. Renaming avoids problems with some compilers and | ||
33 | linkers. */ | ||
34 | #if defined __GETOPT_PREFIX && !defined __need_getopt | ||
35 | # include <stdlib.h> | ||
36 | # include <stdio.h> | ||
37 | # if HAVE_UNISTD_H | ||
38 | # include <unistd.h> | ||
39 | # endif | ||
40 | # undef __need_getopt | ||
41 | # undef getopt | ||
42 | # undef getopt_long | ||
43 | # undef getopt_long_only | ||
44 | # undef optarg | ||
45 | # undef opterr | ||
46 | # undef optind | ||
47 | # undef optopt | ||
48 | # define __GETOPT_CONCAT(x, y) x ## y | ||
49 | # define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y) | ||
50 | # define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y) | ||
51 | # define getopt __GETOPT_ID (getopt) | ||
52 | # define getopt_long __GETOPT_ID (getopt_long) | ||
53 | # define getopt_long_only __GETOPT_ID (getopt_long_only) | ||
54 | # define optarg __GETOPT_ID (optarg) | ||
55 | # define opterr __GETOPT_ID (opterr) | ||
56 | # define optind __GETOPT_ID (optind) | ||
57 | # define optopt __GETOPT_ID (optopt) | ||
58 | #endif | ||
59 | |||
60 | /* Standalone applications get correct prototypes for getopt_long and | ||
61 | getopt_long_only; they declare "char **argv". libc uses prototypes | ||
62 | with "char *const *argv" that are incorrect because getopt_long and | ||
63 | getopt_long_only can permute argv; this is required for backward | ||
64 | compatibility (e.g., for LSB 2.0.1). | ||
65 | |||
66 | This used to be `#if defined __GETOPT_PREFIX && !defined __need_getopt', | ||
67 | but it caused redefinition warnings if both unistd.h and getopt.h were | ||
68 | included, since unistd.h includes getopt.h having previously defined | ||
69 | __need_getopt. | ||
70 | |||
71 | The only place where __getopt_argv_const is used is in definitions | ||
72 | of getopt_long and getopt_long_only below, but these are visible | ||
73 | only if __need_getopt is not defined, so it is quite safe to rewrite | ||
74 | the conditional as follows: | ||
75 | */ | ||
76 | #if !defined __need_getopt | ||
77 | # if defined __GETOPT_PREFIX | ||
78 | # define __getopt_argv_const /* empty */ | ||
79 | # else | ||
80 | # define __getopt_argv_const const | ||
81 | # endif | ||
82 | #endif | ||
83 | |||
84 | /* If __GNU_LIBRARY__ is not already defined, either we are being used | ||
85 | standalone, or this is the first header included in the source file. | ||
86 | If we are being used with glibc, we need to include <features.h>, but | ||
87 | that does not exist if we are standalone. So: if __GNU_LIBRARY__ is | ||
88 | not defined, include <ctype.h>, which will pull in <features.h> for us | ||
89 | if it's from glibc. (Why ctype.h? It's guaranteed to exist and it | ||
90 | doesn't flood the namespace with stuff the way some other headers do.) */ | ||
91 | #if !defined __GNU_LIBRARY__ | ||
92 | # include <ctype.h> | ||
93 | #endif | ||
94 | |||
95 | #ifndef __THROW | ||
96 | # ifndef __GNUC_PREREQ | ||
97 | # define __GNUC_PREREQ(maj, min) (0) | ||
98 | # endif | ||
99 | # if defined __cplusplus && __GNUC_PREREQ (2,8) | ||
100 | # define __THROW throw () | ||
101 | # else | ||
102 | # define __THROW | ||
103 | # endif | ||
104 | #endif | ||
105 | |||
106 | #ifdef __cplusplus | ||
107 | extern "C" { | ||
108 | #endif | ||
109 | |||
110 | /* For communication from `getopt' to the caller. | ||
111 | When `getopt' finds an option that takes an argument, | ||
112 | the argument value is returned here. | ||
113 | Also, when `ordering' is RETURN_IN_ORDER, | ||
114 | each non-option ARGV-element is returned here. */ | ||
115 | |||
116 | extern char *optarg; | ||
117 | |||
118 | /* Index in ARGV of the next element to be scanned. | ||
119 | This is used for communication to and from the caller | ||
120 | and for communication between successive calls to `getopt'. | ||
121 | |||
122 | On entry to `getopt', zero means this is the first call; initialize. | ||
123 | |||
124 | When `getopt' returns -1, this is the index of the first of the | ||
125 | non-option elements that the caller should itself scan. | ||
126 | |||
127 | Otherwise, `optind' communicates from one call to the next | ||
128 | how much of ARGV has been scanned so far. */ | ||
129 | |||
130 | extern int optind; | ||
131 | |||
132 | /* Callers store zero here to inhibit the error message `getopt' prints | ||
133 | for unrecognized options. */ | ||
134 | |||
135 | extern int opterr; | ||
136 | |||
137 | /* Set to an option character which was unrecognized. */ | ||
138 | |||
139 | extern int optopt; | ||
140 | |||
141 | #ifndef __need_getopt | ||
142 | /* Describe the long-named options requested by the application. | ||
143 | The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector | ||
144 | of `struct option' terminated by an element containing a name which is | ||
145 | zero. | ||
146 | |||
147 | The field `has_arg' is: | ||
148 | no_argument (or 0) if the option does not take an argument, | ||
149 | required_argument (or 1) if the option requires an argument, | ||
150 | optional_argument (or 2) if the option takes an optional argument. | ||
151 | |||
152 | If the field `flag' is not NULL, it points to a variable that is set | ||
153 | to the value given in the field `val' when the option is found, but | ||
154 | left unchanged if the option is not found. | ||
155 | |||
156 | To have a long-named option do something other than set an `int' to | ||
157 | a compiled-in constant, such as set a value from `optarg', set the | ||
158 | option's `flag' field to zero and its `val' field to a nonzero | ||
159 | value (the equivalent single-letter option character, if there is | ||
160 | one). For long options that have a zero `flag' field, `getopt' | ||
161 | returns the contents of the `val' field. */ | ||
162 | |||
163 | struct option | ||
164 | { | ||
165 | const char *name; | ||
166 | /* has_arg can't be an enum because some compilers complain about | ||
167 | type mismatches in all the code that assumes it is an int. */ | ||
168 | int has_arg; | ||
169 | int *flag; | ||
170 | int val; | ||
171 | }; | ||
172 | |||
173 | /* Names for the values of the `has_arg' field of `struct option'. */ | ||
174 | |||
175 | # define no_argument 0 | ||
176 | # define required_argument 1 | ||
177 | # define optional_argument 2 | ||
178 | #endif /* need getopt */ | ||
179 | |||
180 | |||
181 | /* Get definitions and prototypes for functions to process the | ||
182 | arguments in ARGV (ARGC of them, minus the program name) for | ||
183 | options given in OPTS. | ||
184 | |||
185 | Return the option character from OPTS just read. Return -1 when | ||
186 | there are no more options. For unrecognized options, or options | ||
187 | missing arguments, `optopt' is set to the option letter, and '?' is | ||
188 | returned. | ||
189 | |||
190 | The OPTS string is a list of characters which are recognized option | ||
191 | letters, optionally followed by colons, specifying that that letter | ||
192 | takes an argument, to be placed in `optarg'. | ||
193 | |||
194 | If a letter in OPTS is followed by two colons, its argument is | ||
195 | optional. This behavior is specific to the GNU `getopt'. | ||
196 | |||
197 | The argument `--' causes premature termination of argument | ||
198 | scanning, explicitly telling `getopt' that there are no more | ||
199 | options. | ||
200 | |||
201 | If OPTS begins with `--', then non-option arguments are treated as | ||
202 | arguments to the option '\0'. This behavior is specific to the GNU | ||
203 | `getopt'. */ | ||
204 | |||
205 | extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) | ||
206 | __THROW; | ||
207 | |||
208 | #ifndef __need_getopt | ||
209 | extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv, | ||
210 | const char *__shortopts, | ||
211 | const struct option *__longopts, int *__longind) | ||
212 | __THROW; | ||
213 | extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv, | ||
214 | const char *__shortopts, | ||
215 | const struct option *__longopts, int *__longind) | ||
216 | __THROW; | ||
217 | |||
218 | #endif | ||
219 | |||
220 | #ifdef __cplusplus | ||
221 | } | ||
222 | #endif | ||
223 | |||
224 | /* Make sure we later can get all the definitions and declarations. */ | ||
225 | #undef __need_getopt | ||
226 | |||
227 | #endif /* getopt.h */ |
mailbox/getopt_int.h
0 → 100644
1 | /* Internal declarations for getopt. | ||
2 | Copyright (C) 1989-1994,1996-1999,2001,2003,2004 | ||
3 | Free Software Foundation, Inc. | ||
4 | This file is part of the GNU C Library. | ||
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 2, or (at your option) | ||
9 | 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 along | ||
17 | with this program; if not, write to the Free Software Foundation, | ||
18 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
19 | |||
20 | #ifndef _GETOPT_INT_H | ||
21 | #define _GETOPT_INT_H 1 | ||
22 | |||
23 | extern int _getopt_internal (int ___argc, char **___argv, | ||
24 | const char *__shortopts, | ||
25 | const struct option *__longopts, int *__longind, | ||
26 | int __long_only, int __posixly_correct); | ||
27 | |||
28 | |||
29 | /* Reentrant versions which can handle parsing multiple argument | ||
30 | vectors at the same time. */ | ||
31 | |||
32 | /* Data type for reentrant functions. */ | ||
33 | struct _getopt_data | ||
34 | { | ||
35 | /* These have exactly the same meaning as the corresponding global | ||
36 | variables, except that they are used for the reentrant | ||
37 | versions of getopt. */ | ||
38 | int optind; | ||
39 | int opterr; | ||
40 | int optopt; | ||
41 | char *optarg; | ||
42 | |||
43 | /* Internal members. */ | ||
44 | |||
45 | /* True if the internal members have been initialized. */ | ||
46 | int __initialized; | ||
47 | |||
48 | /* The next char to be scanned in the option-element | ||
49 | in which the last option character we returned was found. | ||
50 | This allows us to pick up the scan where we left off. | ||
51 | |||
52 | If this is zero, or a null string, it means resume the scan | ||
53 | by advancing to the next ARGV-element. */ | ||
54 | char *__nextchar; | ||
55 | |||
56 | /* Describe how to deal with options that follow non-option ARGV-elements. | ||
57 | |||
58 | If the caller did not specify anything, | ||
59 | the default is REQUIRE_ORDER if the environment variable | ||
60 | POSIXLY_CORRECT is defined, PERMUTE otherwise. | ||
61 | |||
62 | REQUIRE_ORDER means don't recognize them as options; | ||
63 | stop option processing when the first non-option is seen. | ||
64 | This is what Unix does. | ||
65 | This mode of operation is selected by either setting the environment | ||
66 | variable POSIXLY_CORRECT, or using `+' as the first character | ||
67 | of the list of option characters, or by calling getopt. | ||
68 | |||
69 | PERMUTE is the default. We permute the contents of ARGV as we | ||
70 | scan, so that eventually all the non-options are at the end. | ||
71 | This allows options to be given in any order, even with programs | ||
72 | that were not written to expect this. | ||
73 | |||
74 | RETURN_IN_ORDER is an option available to programs that were | ||
75 | written to expect options and other ARGV-elements in any order | ||
76 | and that care about the ordering of the two. We describe each | ||
77 | non-option ARGV-element as if it were the argument of an option | ||
78 | with character code 1. Using `-' as the first character of the | ||
79 | list of option characters selects this mode of operation. | ||
80 | |||
81 | The special argument `--' forces an end of option-scanning regardless | ||
82 | of the value of `ordering'. In the case of RETURN_IN_ORDER, only | ||
83 | `--' can cause `getopt' to return -1 with `optind' != ARGC. */ | ||
84 | |||
85 | enum | ||
86 | { | ||
87 | REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER | ||
88 | } __ordering; | ||
89 | |||
90 | /* If the POSIXLY_CORRECT environment variable is set | ||
91 | or getopt was called. */ | ||
92 | int __posixly_correct; | ||
93 | |||
94 | |||
95 | /* Handle permutation of arguments. */ | ||
96 | |||
97 | /* Describe the part of ARGV that contains non-options that have | ||
98 | been skipped. `first_nonopt' is the index in ARGV of the first | ||
99 | of them; `last_nonopt' is the index after the last of them. */ | ||
100 | |||
101 | int __first_nonopt; | ||
102 | int __last_nonopt; | ||
103 | |||
104 | #if defined _LIBC && defined USE_NONOPTION_FLAGS | ||
105 | int __nonoption_flags_max_len; | ||
106 | int __nonoption_flags_len; | ||
107 | # endif | ||
108 | }; | ||
109 | |||
110 | /* The initializer is necessary to set OPTIND and OPTERR to their | ||
111 | default values and to clear the initialization flag. */ | ||
112 | #define _GETOPT_DATA_INITIALIZER { 1, 1 } | ||
113 | |||
114 | extern int _getopt_internal_r (int ___argc, char **___argv, | ||
115 | const char *__shortopts, | ||
116 | const struct option *__longopts, int *__longind, | ||
117 | int __long_only, int __posixly_correct, | ||
118 | struct _getopt_data *__data); | ||
119 | |||
120 | extern int _getopt_long_r (int ___argc, char **___argv, | ||
121 | const char *__shortopts, | ||
122 | const struct option *__longopts, int *__longind, | ||
123 | struct _getopt_data *__data); | ||
124 | |||
125 | extern int _getopt_long_only_r (int ___argc, char **___argv, | ||
126 | const char *__shortopts, | ||
127 | const struct option *__longopts, | ||
128 | int *__longind, | ||
129 | struct _getopt_data *__data); | ||
130 | |||
131 | #endif /* getopt_int.h */ |
mailbox/gettext.h
0 → 100644
1 | /* Convenience header for conditional use of GNU <libintl.h>. | ||
2 | Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc. | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 2, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License along | ||
15 | with this program; if not, write to the Free Software Foundation, | ||
16 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
17 | |||
18 | #ifndef _LIBGETTEXT_H | ||
19 | #define _LIBGETTEXT_H 1 | ||
20 | |||
21 | /* NLS can be disabled through the configure --disable-nls option. */ | ||
22 | #if ENABLE_NLS | ||
23 | |||
24 | /* Get declarations of GNU message catalog functions. */ | ||
25 | # include <libintl.h> | ||
26 | |||
27 | #else | ||
28 | |||
29 | /* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which | ||
30 | chokes if dcgettext is defined as a macro. So include it now, to make | ||
31 | later inclusions of <locale.h> a NOP. We don't include <libintl.h> | ||
32 | as well because people using "gettext.h" will not include <libintl.h>, | ||
33 | and also including <libintl.h> would fail on SunOS 4, whereas <locale.h> | ||
34 | is OK. */ | ||
35 | #if defined(__sun) | ||
36 | # include <locale.h> | ||
37 | #endif | ||
38 | |||
39 | /* Disabled NLS. | ||
40 | The casts to 'const char *' serve the purpose of producing warnings | ||
41 | for invalid uses of the value returned from these functions. | ||
42 | On pre-ANSI systems without 'const', the config.h file is supposed to | ||
43 | contain "#define const". */ | ||
44 | # define gettext(Msgid) ((const char *) (Msgid)) | ||
45 | # define dgettext(Domainname, Msgid) ((const char *) (Msgid)) | ||
46 | # define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) | ||
47 | # define ngettext(Msgid1, Msgid2, N) \ | ||
48 | ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) | ||
49 | # define dngettext(Domainname, Msgid1, Msgid2, N) \ | ||
50 | ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) | ||
51 | # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ | ||
52 | ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) | ||
53 | # define textdomain(Domainname) ((const char *) (Domainname)) | ||
54 | # define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname)) | ||
55 | # define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset)) | ||
56 | |||
57 | #endif | ||
58 | |||
59 | /* A pseudo function call that serves as a marker for the automated | ||
60 | extraction of messages, but does not call gettext(). The run-time | ||
61 | translation is done at a different place in the code. | ||
62 | The argument, String, should be a literal string. Concatenated strings | ||
63 | and other string expressions won't work. | ||
64 | The macro's expansion is not parenthesized, so that it is suitable as | ||
65 | initializer for static 'char[]' or 'const char[]' variables. */ | ||
66 | #define gettext_noop(String) String | ||
67 | |||
68 | #endif /* _LIBGETTEXT_H */ |
mailbox/mempcpy.c
0 → 100644
1 | /* Copy memory area and return pointer after last written byte. | ||
2 | Copyright (C) 2003 Free Software Foundation, Inc. | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 2, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program; if not, write to the Free Software Foundation, | ||
16 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
17 | |||
18 | /* Specification. */ | ||
19 | #include "mempcpy.h" | ||
20 | |||
21 | #include <string.h> | ||
22 | |||
23 | /* Copy N bytes of SRC to DEST, return pointer to bytes after the | ||
24 | last written byte. */ | ||
25 | void * | ||
26 | mempcpy (void *dest, const void *src, size_t n) | ||
27 | { | ||
28 | return (char *) memcpy (dest, src, n) + n; | ||
29 | } |
mailbox/mempcpy.h
0 → 100644
1 | /* Copy memory area and return pointer after last written byte. | ||
2 | Copyright (C) 2003, 2004 Free Software Foundation, Inc. | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 2, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program; if not, write to the Free Software Foundation, | ||
16 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
17 | |||
18 | #ifndef mempcpy | ||
19 | |||
20 | # if HAVE_MEMPCPY | ||
21 | |||
22 | /* Get mempcpy() declaration. */ | ||
23 | # include <string.h> | ||
24 | |||
25 | # else | ||
26 | |||
27 | /* Get size_t */ | ||
28 | # include <stddef.h> | ||
29 | |||
30 | /* Copy N bytes of SRC to DEST, return pointer to bytes after the | ||
31 | last written byte. */ | ||
32 | extern void *mempcpy (void *dest, const void *src, size_t n); | ||
33 | |||
34 | # endif | ||
35 | |||
36 | #endif |
mailbox/minmax.h
0 → 100644
1 | /* MIN, MAX macros. | ||
2 | Copyright (C) 1995, 1998, 2001, 2003 Free Software Foundation, Inc. | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 2, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program; if not, write to the Free Software Foundation, | ||
16 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
17 | |||
18 | #ifndef _MINMAX_H | ||
19 | #define _MINMAX_H | ||
20 | |||
21 | /* Note: MIN, MAX are also defined in <sys/param.h> on some systems | ||
22 | (glibc, IRIX, HP-UX, OSF/1). Therefore you might get warnings about | ||
23 | MIN, MAX macro redefinitions on some systems; the workaround is to | ||
24 | #include this file as the last one among the #include list. */ | ||
25 | |||
26 | /* Before we define the following symbols we get the <limits.h> file | ||
27 | since otherwise we get redefinitions on some systems. */ | ||
28 | #include <limits.h> | ||
29 | |||
30 | /* Note: MIN and MAX should be used with two arguments of the | ||
31 | same type. They might not return the minimum and maximum of their two | ||
32 | arguments, if the arguments have different types or have unusual | ||
33 | floating-point values. For example, on a typical host with 32-bit 'int', | ||
34 | 64-bit 'long long', and 64-bit IEEE 754 'double' types: | ||
35 | |||
36 | MAX (-1, 2147483648) returns 4294967295. | ||
37 | MAX (9007199254740992.0, 9007199254740993) returns 9007199254740992.0. | ||
38 | MAX (NaN, 0.0) returns 0.0. | ||
39 | MAX (+0.0, -0.0) returns -0.0. | ||
40 | |||
41 | and in each case the answer is in some sense bogus. */ | ||
42 | |||
43 | /* MAX(a,b) returns the maximum of A and B. */ | ||
44 | #ifndef MAX | ||
45 | # define MAX(a,b) ((a) > (b) ? (a) : (b)) | ||
46 | #endif | ||
47 | |||
48 | /* MIN(a,b) returns the minimum of A and B. */ | ||
49 | #ifndef MIN | ||
50 | # define MIN(a,b) ((a) < (b) ? (a) : (b)) | ||
51 | #endif | ||
52 | |||
53 | #endif /* _MINMAX_H */ |
mailbox/printf-args.c
0 → 100644
1 | /* Decomposed printf argument list. | ||
2 | Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc. | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 2, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License along | ||
15 | with this program; if not, write to the Free Software Foundation, | ||
16 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
17 | |||
18 | #ifdef HAVE_CONFIG_H | ||
19 | # include <config.h> | ||
20 | #endif | ||
21 | |||
22 | /* Specification. */ | ||
23 | #include "printf-args.h" | ||
24 | |||
25 | #ifdef STATIC | ||
26 | STATIC | ||
27 | #endif | ||
28 | int | ||
29 | printf_fetchargs (va_list args, arguments *a) | ||
30 | { | ||
31 | size_t i; | ||
32 | argument *ap; | ||
33 | |||
34 | for (i = 0, ap = &a->arg[0]; i < a->count; i++, ap++) | ||
35 | switch (ap->type) | ||
36 | { | ||
37 | case TYPE_SCHAR: | ||
38 | ap->a.a_schar = va_arg (args, /*signed char*/ int); | ||
39 | break; | ||
40 | case TYPE_UCHAR: | ||
41 | ap->a.a_uchar = va_arg (args, /*unsigned char*/ int); | ||
42 | break; | ||
43 | case TYPE_SHORT: | ||
44 | ap->a.a_short = va_arg (args, /*short*/ int); | ||
45 | break; | ||
46 | case TYPE_USHORT: | ||
47 | ap->a.a_ushort = va_arg (args, /*unsigned short*/ int); | ||
48 | break; | ||
49 | case TYPE_INT: | ||
50 | ap->a.a_int = va_arg (args, int); | ||
51 | break; | ||
52 | case TYPE_UINT: | ||
53 | ap->a.a_uint = va_arg (args, unsigned int); | ||
54 | break; | ||
55 | case TYPE_LONGINT: | ||
56 | ap->a.a_longint = va_arg (args, long int); | ||
57 | break; | ||
58 | case TYPE_ULONGINT: | ||
59 | ap->a.a_ulongint = va_arg (args, unsigned long int); | ||
60 | break; | ||
61 | #ifdef HAVE_LONG_LONG | ||
62 | case TYPE_LONGLONGINT: | ||
63 | ap->a.a_longlongint = va_arg (args, long long int); | ||
64 | break; | ||
65 | case TYPE_ULONGLONGINT: | ||
66 | ap->a.a_ulonglongint = va_arg (args, unsigned long long int); | ||
67 | break; | ||
68 | #endif | ||
69 | case TYPE_DOUBLE: | ||
70 | ap->a.a_double = va_arg (args, double); | ||
71 | break; | ||
72 | #ifdef HAVE_LONG_DOUBLE | ||
73 | case TYPE_LONGDOUBLE: | ||
74 | ap->a.a_longdouble = va_arg (args, long double); | ||
75 | break; | ||
76 | #endif | ||
77 | case TYPE_CHAR: | ||
78 | ap->a.a_char = va_arg (args, int); | ||
79 | break; | ||
80 | #ifdef HAVE_WINT_T | ||
81 | case TYPE_WIDE_CHAR: | ||
82 | ap->a.a_wide_char = va_arg (args, wint_t); | ||
83 | break; | ||
84 | #endif | ||
85 | case TYPE_STRING: | ||
86 | ap->a.a_string = va_arg (args, const char *); | ||
87 | break; | ||
88 | #ifdef HAVE_WCHAR_T | ||
89 | case TYPE_WIDE_STRING: | ||
90 | ap->a.a_wide_string = va_arg (args, const wchar_t *); | ||
91 | break; | ||
92 | #endif | ||
93 | case TYPE_POINTER: | ||
94 | ap->a.a_pointer = va_arg (args, void *); | ||
95 | break; | ||
96 | case TYPE_COUNT_SCHAR_POINTER: | ||
97 | ap->a.a_count_schar_pointer = va_arg (args, signed char *); | ||
98 | break; | ||
99 | case TYPE_COUNT_SHORT_POINTER: | ||
100 | ap->a.a_count_short_pointer = va_arg (args, short *); | ||
101 | break; | ||
102 | case TYPE_COUNT_INT_POINTER: | ||
103 | ap->a.a_count_int_pointer = va_arg (args, int *); | ||
104 | break; | ||
105 | case TYPE_COUNT_LONGINT_POINTER: | ||
106 | ap->a.a_count_longint_pointer = va_arg (args, long int *); | ||
107 | break; | ||
108 | #ifdef HAVE_LONG_LONG | ||
109 | case TYPE_COUNT_LONGLONGINT_POINTER: | ||
110 | ap->a.a_count_longlongint_pointer = va_arg (args, long long int *); | ||
111 | break; | ||
112 | #endif | ||
113 | default: | ||
114 | /* Unknown type. */ | ||
115 | return -1; | ||
116 | } | ||
117 | return 0; | ||
118 | } |
mailbox/printf-args.h
0 → 100644
1 | /* Decomposed printf argument list. | ||
2 | Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc. | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 2, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License along | ||
15 | with this program; if not, write to the Free Software Foundation, | ||
16 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
17 | |||
18 | #ifndef _PRINTF_ARGS_H | ||
19 | #define _PRINTF_ARGS_H | ||
20 | |||
21 | /* Get size_t. */ | ||
22 | #include <stddef.h> | ||
23 | |||
24 | /* Get wchar_t. */ | ||
25 | #ifdef HAVE_WCHAR_T | ||
26 | # include <stddef.h> | ||
27 | #endif | ||
28 | |||
29 | /* Get wint_t. */ | ||
30 | #ifdef HAVE_WINT_T | ||
31 | # include <wchar.h> | ||
32 | #endif | ||
33 | |||
34 | /* Get va_list. */ | ||
35 | #include <stdarg.h> | ||
36 | |||
37 | |||
38 | /* Argument types */ | ||
39 | typedef enum | ||
40 | { | ||
41 | TYPE_NONE, | ||
42 | TYPE_SCHAR, | ||
43 | TYPE_UCHAR, | ||
44 | TYPE_SHORT, | ||
45 | TYPE_USHORT, | ||
46 | TYPE_INT, | ||
47 | TYPE_UINT, | ||
48 | TYPE_LONGINT, | ||
49 | TYPE_ULONGINT, | ||
50 | #ifdef HAVE_LONG_LONG | ||
51 | TYPE_LONGLONGINT, | ||
52 | TYPE_ULONGLONGINT, | ||
53 | #endif | ||
54 | TYPE_DOUBLE, | ||
55 | #ifdef HAVE_LONG_DOUBLE | ||
56 | TYPE_LONGDOUBLE, | ||
57 | #endif | ||
58 | TYPE_CHAR, | ||
59 | #ifdef HAVE_WINT_T | ||
60 | TYPE_WIDE_CHAR, | ||
61 | #endif | ||
62 | TYPE_STRING, | ||
63 | #ifdef HAVE_WCHAR_T | ||
64 | TYPE_WIDE_STRING, | ||
65 | #endif | ||
66 | TYPE_POINTER, | ||
67 | TYPE_COUNT_SCHAR_POINTER, | ||
68 | TYPE_COUNT_SHORT_POINTER, | ||
69 | TYPE_COUNT_INT_POINTER, | ||
70 | TYPE_COUNT_LONGINT_POINTER | ||
71 | #ifdef HAVE_LONG_LONG | ||
72 | , TYPE_COUNT_LONGLONGINT_POINTER | ||
73 | #endif | ||
74 | } arg_type; | ||
75 | |||
76 | /* Polymorphic argument */ | ||
77 | typedef struct | ||
78 | { | ||
79 | arg_type type; | ||
80 | union | ||
81 | { | ||
82 | signed char a_schar; | ||
83 | unsigned char a_uchar; | ||
84 | short a_short; | ||
85 | unsigned short a_ushort; | ||
86 | int a_int; | ||
87 | unsigned int a_uint; | ||
88 | long int a_longint; | ||
89 | unsigned long int a_ulongint; | ||
90 | #ifdef HAVE_LONG_LONG | ||
91 | long long int a_longlongint; | ||
92 | unsigned long long int a_ulonglongint; | ||
93 | #endif | ||
94 | float a_float; | ||
95 | double a_double; | ||
96 | #ifdef HAVE_LONG_DOUBLE | ||
97 | long double a_longdouble; | ||
98 | #endif | ||
99 | int a_char; | ||
100 | #ifdef HAVE_WINT_T | ||
101 | wint_t a_wide_char; | ||
102 | #endif | ||
103 | const char* a_string; | ||
104 | #ifdef HAVE_WCHAR_T | ||
105 | const wchar_t* a_wide_string; | ||
106 | #endif | ||
107 | void* a_pointer; | ||
108 | signed char * a_count_schar_pointer; | ||
109 | short * a_count_short_pointer; | ||
110 | int * a_count_int_pointer; | ||
111 | long int * a_count_longint_pointer; | ||
112 | #ifdef HAVE_LONG_LONG | ||
113 | long long int * a_count_longlongint_pointer; | ||
114 | #endif | ||
115 | } | ||
116 | a; | ||
117 | } | ||
118 | argument; | ||
119 | |||
120 | typedef struct | ||
121 | { | ||
122 | size_t count; | ||
123 | argument *arg; | ||
124 | } | ||
125 | arguments; | ||
126 | |||
127 | |||
128 | /* Fetch the arguments, putting them into a. */ | ||
129 | #ifdef STATIC | ||
130 | STATIC | ||
131 | #else | ||
132 | extern | ||
133 | #endif | ||
134 | int printf_fetchargs (va_list args, arguments *a); | ||
135 | |||
136 | #endif /* _PRINTF_ARGS_H */ |
mailbox/printf-parse.c
0 → 100644
This diff is collapsed.
Click to expand it.
mailbox/printf-parse.h
0 → 100644
1 | /* Parse printf format string. | ||
2 | Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc. | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 2, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License along | ||
15 | with this program; if not, write to the Free Software Foundation, | ||
16 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
17 | |||
18 | #ifndef _PRINTF_PARSE_H | ||
19 | #define _PRINTF_PARSE_H | ||
20 | |||
21 | #include "printf-args.h" | ||
22 | |||
23 | |||
24 | /* Flags */ | ||
25 | #define FLAG_GROUP 1 /* ' flag */ | ||
26 | #define FLAG_LEFT 2 /* - flag */ | ||
27 | #define FLAG_SHOWSIGN 4 /* + flag */ | ||
28 | #define FLAG_SPACE 8 /* space flag */ | ||
29 | #define FLAG_ALT 16 /* # flag */ | ||
30 | #define FLAG_ZERO 32 | ||
31 | |||
32 | /* arg_index value indicating that no argument is consumed. */ | ||
33 | #define ARG_NONE (~(size_t)0) | ||
34 | |||
35 | /* A parsed directive. */ | ||
36 | typedef struct | ||
37 | { | ||
38 | const char* dir_start; | ||
39 | const char* dir_end; | ||
40 | int flags; | ||
41 | const char* width_start; | ||
42 | const char* width_end; | ||
43 | size_t width_arg_index; | ||
44 | const char* precision_start; | ||
45 | const char* precision_end; | ||
46 | size_t precision_arg_index; | ||
47 | char conversion; /* d i o u x X f e E g G c s p n U % but not C S */ | ||
48 | size_t arg_index; | ||
49 | } | ||
50 | char_directive; | ||
51 | |||
52 | /* A parsed format string. */ | ||
53 | typedef struct | ||
54 | { | ||
55 | size_t count; | ||
56 | char_directive *dir; | ||
57 | size_t max_width_length; | ||
58 | size_t max_precision_length; | ||
59 | } | ||
60 | char_directives; | ||
61 | |||
62 | |||
63 | /* Parses the format string. Fills in the number N of directives, and fills | ||
64 | in directives[0], ..., directives[N-1], and sets directives[N].dir_start | ||
65 | to the end of the format string. Also fills in the arg_type fields of the | ||
66 | arguments and the needed count of arguments. */ | ||
67 | #ifdef STATIC | ||
68 | STATIC | ||
69 | #else | ||
70 | extern | ||
71 | #endif | ||
72 | int printf_parse (const char *format, char_directives *d, arguments *a); | ||
73 | |||
74 | #endif /* _PRINTF_PARSE_H */ |
mailbox/regex.h
0 → 100644
This diff is collapsed.
Click to expand it.
mailbox/strcase.h
0 → 100644
1 | /* Case-insensitive string comparison functions. | ||
2 | Copyright (C) 1995-1996, 2001, 2003 Free Software Foundation, Inc. | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 2, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program; if not, write to the Free Software Foundation, | ||
16 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
17 | |||
18 | #ifndef _STRCASE_H | ||
19 | #define _STRCASE_H | ||
20 | |||
21 | #include <stddef.h> | ||
22 | |||
23 | |||
24 | #ifdef __cplusplus | ||
25 | extern "C" { | ||
26 | #endif | ||
27 | |||
28 | |||
29 | /* Compare strings S1 and S2, ignoring case, returning less than, equal to or | ||
30 | greater than zero if S1 is lexicographically less than, equal to or greater | ||
31 | than S2. | ||
32 | Note: This function does not work correctly in multibyte locales. */ | ||
33 | extern int strcasecmp (const char *s1, const char *s2); | ||
34 | |||
35 | /* Compare no more than N characters of strings S1 and S2, ignoring case, | ||
36 | returning less than, equal to or greater than zero if S1 is | ||
37 | lexicographically less than, equal to or greater than S2. | ||
38 | Note: This function can not work correctly in multibyte locales. */ | ||
39 | extern int strncasecmp (const char *s1, const char *s2, size_t n); | ||
40 | |||
41 | |||
42 | #ifdef __cplusplus | ||
43 | } | ||
44 | #endif | ||
45 | |||
46 | |||
47 | #endif /* _STRCASE_H */ |
mailbox/strcasecmp.c
0 → 100644
1 | /* strcasecmp.c -- case insensitive string comparator | ||
2 | Copyright (C) 1998, 1999 Free Software Foundation, Inc. | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 2, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program; if not, write to the Free Software Foundation, | ||
16 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
17 | |||
18 | #if HAVE_CONFIG_H | ||
19 | # include <config.h> | ||
20 | #endif | ||
21 | |||
22 | #ifdef LENGTH_LIMIT | ||
23 | # define STRXCASECMP_FUNCTION strncasecmp | ||
24 | # define STRXCASECMP_DECLARE_N , size_t n | ||
25 | # define LENGTH_LIMIT_EXPR(Expr) Expr | ||
26 | #else | ||
27 | # define STRXCASECMP_FUNCTION strcasecmp | ||
28 | # define STRXCASECMP_DECLARE_N /* empty */ | ||
29 | # define LENGTH_LIMIT_EXPR(Expr) 0 | ||
30 | #endif | ||
31 | |||
32 | #include <stddef.h> | ||
33 | #include <ctype.h> | ||
34 | |||
35 | #define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch)) | ||
36 | |||
37 | /* Compare {{no more than N characters of }}strings S1 and S2, | ||
38 | ignoring case, returning less than, equal to or | ||
39 | greater than zero if S1 is lexicographically less | ||
40 | than, equal to or greater than S2. */ | ||
41 | |||
42 | int | ||
43 | STRXCASECMP_FUNCTION (const char *s1, const char *s2 STRXCASECMP_DECLARE_N) | ||
44 | { | ||
45 | register const unsigned char *p1 = (const unsigned char *) s1; | ||
46 | register const unsigned char *p2 = (const unsigned char *) s2; | ||
47 | unsigned char c1, c2; | ||
48 | |||
49 | if (p1 == p2 || LENGTH_LIMIT_EXPR (n == 0)) | ||
50 | return 0; | ||
51 | |||
52 | do | ||
53 | { | ||
54 | c1 = TOLOWER (*p1); | ||
55 | c2 = TOLOWER (*p2); | ||
56 | |||
57 | if (LENGTH_LIMIT_EXPR (--n == 0) || c1 == '\0') | ||
58 | break; | ||
59 | |||
60 | ++p1; | ||
61 | ++p2; | ||
62 | } | ||
63 | while (c1 == c2); | ||
64 | |||
65 | return c1 - c2; | ||
66 | } |
mailbox/strchrnul.h
0 → 100644
1 | /* Searching in a string. | ||
2 | Copyright (C) 2003 Free Software Foundation, Inc. | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 2, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program; if not, write to the Free Software Foundation, | ||
16 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
17 | |||
18 | #if HAVE_STRCHRNUL | ||
19 | |||
20 | /* Get strchrnul() declaration. */ | ||
21 | #include <string.h> | ||
22 | |||
23 | #else | ||
24 | |||
25 | /* Find the first occurrence of C in S or the final NUL byte. */ | ||
26 | extern char *strchrnul (const char *s, int c_in); | ||
27 | |||
28 | #endif |
mailbox/strncasecmp.c
0 → 100644
mailbox/strndup.h
0 → 100644
1 | /* Duplicate a size-bounded string. | ||
2 | Copyright (C) 2003 Free Software Foundation, Inc. | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 2, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program; if not, write to the Free Software Foundation, | ||
16 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
17 | |||
18 | #if HAVE_STRNDUP | ||
19 | |||
20 | /* Get strndup() declaration. */ | ||
21 | #include <string.h> | ||
22 | |||
23 | #else | ||
24 | |||
25 | #include <stddef.h> | ||
26 | |||
27 | /* Return a newly allocated copy of at most N bytes of STRING. */ | ||
28 | extern char *strndup (const char *string, size_t n); | ||
29 | |||
30 | #endif |
mailbox/strtok_r.h
0 → 100644
1 | /* Split string into tokens | ||
2 | Copyright (C) 2004 Free Software Foundation, Inc. | ||
3 | Written by Simon Josefsson. | ||
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 2, or (at your option) | ||
8 | 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 along | ||
16 | with this program; if not, write to the Free Software Foundation, | ||
17 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
18 | |||
19 | #ifndef STRTOK_R_H | ||
20 | #define STRTOK_R_H | ||
21 | |||
22 | /* Get strtok_r declaration, if available. */ | ||
23 | #include <string.h> | ||
24 | |||
25 | /* Parse S into tokens separated by characters in DELIM. | ||
26 | If S is NULL, the saved pointer in SAVE_PTR is used as | ||
27 | the next starting point. For example: | ||
28 | char s[] = "-abc-=-def"; | ||
29 | char *sp; | ||
30 | x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def" | ||
31 | x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL | ||
32 | x = strtok_r(NULL, "=", &sp); // x = NULL | ||
33 | // s = "abc\0-def\0" | ||
34 | |||
35 | This is a variant of strtok() that is multithread-safe. | ||
36 | |||
37 | For the POSIX documentation for this function, see: | ||
38 | http://www.opengroup.org/onlinepubs/009695399/functions/strtok.html | ||
39 | |||
40 | Caveat: It modifies the original string. | ||
41 | Caveat: These functions cannot be used on constant strings. | ||
42 | Caveat: The identity of the delimiting character is lost. | ||
43 | Caveat: It doesn't work with multibyte strings unless all of the delimiter | ||
44 | characters are ASCII characters < 0x30. | ||
45 | |||
46 | See also strsep(). | ||
47 | */ | ||
48 | #if defined HAVE_DECL_STRTOK_R && !HAVE_DECL_STRTOK_R | ||
49 | extern char *strtok_r(char *restrict s, const char *restrict sep, | ||
50 | char **restrict lasts); | ||
51 | #endif | ||
52 | |||
53 | #endif /* STRTOK_R_H */ |
mailbox/sysexit_.h
0 → 100644
1 | /* exit() exit codes for some BSD system programs. | ||
2 | Copyright (C) 2003 Free Software Foundation, Inc. | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 2, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program; if not, write to the Free Software Foundation, | ||
16 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
17 | |||
18 | /* Written by Simon Josefsson based on sysexits(3) man page */ | ||
19 | |||
20 | #ifndef _SYSEXITS_H | ||
21 | #define _SYSEXITS_H | ||
22 | |||
23 | #define EX_USAGE 64 | ||
24 | #define EX_DATAERR 65 | ||
25 | #define EX_NOINPUT 66 | ||
26 | #define EX_NOUSER 67 | ||
27 | #define EX_NOHOST 68 | ||
28 | #define EX_UNAVAILABLE 69 | ||
29 | #define EX_SOFTWARE 70 | ||
30 | #define EX_OSERR 71 | ||
31 | #define EX_OSFILE 72 | ||
32 | #define EX_CANTCREAT 73 | ||
33 | #define EX_IOERR 74 | ||
34 | #define EX_TEMPFAIL 75 | ||
35 | #define EX_PROTOCOL 76 | ||
36 | #define EX_NOPERM 77 | ||
37 | #define EX_CONFIG 78 | ||
38 | |||
39 | #endif /* _SYSEXITS_H */ |
mailbox/vasnprintf.c
0 → 100644
This diff is collapsed.
Click to expand it.
mailbox/vasnprintf.h
0 → 100644
1 | /* vsprintf with automatic memory allocation. | ||
2 | Copyright (C) 2002-2004 Free Software Foundation, Inc. | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 2, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License along | ||
15 | with this program; if not, write to the Free Software Foundation, | ||
16 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
17 | |||
18 | #ifndef _VASNPRINTF_H | ||
19 | #define _VASNPRINTF_H | ||
20 | |||
21 | /* Get va_list. */ | ||
22 | #include <stdarg.h> | ||
23 | |||
24 | /* Get size_t. */ | ||
25 | #include <stddef.h> | ||
26 | |||
27 | #ifndef __attribute__ | ||
28 | /* This feature is available in gcc versions 2.5 and later. */ | ||
29 | # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__ | ||
30 | # define __attribute__(Spec) /* empty */ | ||
31 | # endif | ||
32 | /* The __-protected variants of `format' and `printf' attributes | ||
33 | are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */ | ||
34 | # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) | ||
35 | # define __format__ format | ||
36 | # define __printf__ printf | ||
37 | # endif | ||
38 | #endif | ||
39 | |||
40 | #ifdef __cplusplus | ||
41 | extern "C" { | ||
42 | #endif | ||
43 | |||
44 | /* Write formatted output to a string dynamically allocated with malloc(). | ||
45 | You can pass a preallocated buffer for the result in RESULTBUF and its | ||
46 | size in *LENGTHP; otherwise you pass RESULTBUF = NULL. | ||
47 | If successful, return the address of the string (this may be = RESULTBUF | ||
48 | if no dynamic memory allocation was necessary) and set *LENGTHP to the | ||
49 | number of resulting bytes, excluding the trailing NUL. Upon error, set | ||
50 | errno and return NULL. | ||
51 | |||
52 | When dynamic memory allocation occurs, the preallocated buffer is left | ||
53 | alone (with possibly modified contents). This makes it possible to use | ||
54 | a statically allocated or stack-allocated buffer, like this: | ||
55 | |||
56 | char buf[100]; | ||
57 | size_t len = sizeof (buf); | ||
58 | char *output = vasnprintf (buf, &len, format, args); | ||
59 | if (output == NULL) | ||
60 | ... error handling ...; | ||
61 | else | ||
62 | { | ||
63 | ... use the output string ...; | ||
64 | if (output != buf) | ||
65 | free (output); | ||
66 | } | ||
67 | */ | ||
68 | extern char * asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) | ||
69 | __attribute__ ((__format__ (__printf__, 3, 4))); | ||
70 | extern char * vasnprintf (char *resultbuf, size_t *lengthp, const char *format, va_list args) | ||
71 | __attribute__ ((__format__ (__printf__, 3, 0))); | ||
72 | |||
73 | #ifdef __cplusplus | ||
74 | } | ||
75 | #endif | ||
76 | |||
77 | #endif /* _VASNPRINTF_H */ |
mailbox/vsnprintf.c
0 → 100644
1 | /* Formatted output to strings. | ||
2 | Copyright (C) 2004 Free Software Foundation, Inc. | ||
3 | Written by Simon Josefsson and Yoann Vandoorselaere <yoann@prelude-ids.org>. | ||
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 2, or (at your option) | ||
8 | 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 along | ||
16 | with this program; if not, write to the Free Software Foundation, | ||
17 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
18 | |||
19 | #ifdef HAVE_CONFIG_H | ||
20 | # include <config.h> | ||
21 | #endif | ||
22 | |||
23 | /* Specification. */ | ||
24 | #include "vsnprintf.h" | ||
25 | |||
26 | #include <stdarg.h> | ||
27 | #include <stdio.h> | ||
28 | #include <stdlib.h> | ||
29 | #include <string.h> | ||
30 | |||
31 | #include "vasnprintf.h" | ||
32 | |||
33 | /* Print formatted output to string STR. Similar to vsprintf, but | ||
34 | additional length SIZE limit how much is written into STR. Returns | ||
35 | string length of formatted string (which may be larger than SIZE). | ||
36 | STR may be NULL, in which case nothing will be written. On error, | ||
37 | return a negative value. */ | ||
38 | int | ||
39 | vsnprintf (char *str, size_t size, const char *format, va_list args) | ||
40 | { | ||
41 | char *output; | ||
42 | size_t len; | ||
43 | |||
44 | len = size; | ||
45 | output = vasnprintf (str, &len, format, args); | ||
46 | |||
47 | if (!output) | ||
48 | return -1; | ||
49 | |||
50 | if (str != NULL) | ||
51 | if (len > size - 1) /* equivalent to: (size > 0 && len >= size) */ | ||
52 | str[size - 1] = '\0'; | ||
53 | |||
54 | if (output != str) | ||
55 | free (output); | ||
56 | |||
57 | return len; | ||
58 | } |
mailbox/vsnprintf.h
0 → 100644
1 | /* Formatted output to strings. | ||
2 | Copyright (C) 2004 Free Software Foundation, Inc. | ||
3 | Written by Simon Josefsson and Yoann Vandoorselaere <yoann@prelude-ids.org>. | ||
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 2, or (at your option) | ||
8 | 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 along | ||
16 | with this program; if not, write to the Free Software Foundation, | ||
17 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
18 | |||
19 | #ifndef VSNPRINTF_H | ||
20 | #define VSNPRINTF_H | ||
21 | |||
22 | #include <stdarg.h> | ||
23 | |||
24 | /* Get vsnprintf declaration, if available. */ | ||
25 | #include <stdio.h> | ||
26 | |||
27 | #if defined HAVE_DECL_VSNPRINTF && !HAVE_DECL_VSNPRINTF | ||
28 | int vsnprintf (char *str, size_t size, const char *format, va_list args); | ||
29 | #endif | ||
30 | |||
31 | #endif /* VSNPRINTF_H */ |
mailbox/xsize.h
0 → 100644
1 | /* xsize.h -- Checked size_t computations. | ||
2 | |||
3 | Copyright (C) 2003 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 2, or (at your option) | ||
8 | 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, write to the Free Software Foundation, | ||
17 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | ||
18 | |||
19 | #ifndef _XSIZE_H | ||
20 | #define _XSIZE_H | ||
21 | |||
22 | /* Get size_t. */ | ||
23 | #include <stddef.h> | ||
24 | |||
25 | /* Get SIZE_MAX. */ | ||
26 | #include <limits.h> | ||
27 | #if HAVE_STDINT_H | ||
28 | # include <stdint.h> | ||
29 | #endif | ||
30 | |||
31 | /* The size of memory objects is often computed through expressions of | ||
32 | type size_t. Example: | ||
33 | void* p = malloc (header_size + n * element_size). | ||
34 | These computations can lead to overflow. When this happens, malloc() | ||
35 | returns a piece of memory that is way too small, and the program then | ||
36 | crashes while attempting to fill the memory. | ||
37 | To avoid this, the functions and macros in this file check for overflow. | ||
38 | The convention is that SIZE_MAX represents overflow. | ||
39 | malloc (SIZE_MAX) is not guaranteed to fail -- think of a malloc | ||
40 | implementation that uses mmap --, it's recommended to use size_overflow_p() | ||
41 | or size_in_bounds_p() before invoking malloc(). | ||
42 | The example thus becomes: | ||
43 | size_t size = xsum (header_size, xtimes (n, element_size)); | ||
44 | void *p = (size_in_bounds_p (size) ? malloc (size) : NULL); | ||
45 | */ | ||
46 | |||
47 | /* Convert an arbitrary value >= 0 to type size_t. */ | ||
48 | #define xcast_size_t(N) \ | ||
49 | ((N) <= SIZE_MAX ? (size_t) (N) : SIZE_MAX) | ||
50 | |||
51 | /* Sum of two sizes, with overflow check. */ | ||
52 | static inline size_t | ||
53 | #if __GNUC__ >= 3 | ||
54 | __attribute__ ((__pure__)) | ||
55 | #endif | ||
56 | xsum (size_t size1, size_t size2) | ||
57 | { | ||
58 | size_t sum = size1 + size2; | ||
59 | return (sum >= size1 ? sum : SIZE_MAX); | ||
60 | } | ||
61 | |||
62 | /* Sum of three sizes, with overflow check. */ | ||
63 | static inline size_t | ||
64 | #if __GNUC__ >= 3 | ||
65 | __attribute__ ((__pure__)) | ||
66 | #endif | ||
67 | xsum3 (size_t size1, size_t size2, size_t size3) | ||
68 | { | ||
69 | return xsum (xsum (size1, size2), size3); | ||
70 | } | ||
71 | |||
72 | /* Sum of four sizes, with overflow check. */ | ||
73 | static inline size_t | ||
74 | #if __GNUC__ >= 3 | ||
75 | __attribute__ ((__pure__)) | ||
76 | #endif | ||
77 | xsum4 (size_t size1, size_t size2, size_t size3, size_t size4) | ||
78 | { | ||
79 | return xsum (xsum (xsum (size1, size2), size3), size4); | ||
80 | } | ||
81 | |||
82 | /* Maximum of two sizes, with overflow check. */ | ||
83 | static inline size_t | ||
84 | #if __GNUC__ >= 3 | ||
85 | __attribute__ ((__pure__)) | ||
86 | #endif | ||
87 | xmax (size_t size1, size_t size2) | ||
88 | { | ||
89 | /* No explicit check is needed here, because for any n: | ||
90 | max (SIZE_MAX, n) == SIZE_MAX and max (n, SIZE_MAX) == SIZE_MAX. */ | ||
91 | return (size1 >= size2 ? size1 : size2); | ||
92 | } | ||
93 | |||
94 | /* Multiplication of a count with an element size, with overflow check. | ||
95 | The count must be >= 0 and the element size must be > 0. | ||
96 | This is a macro, not an inline function, so that it works correctly even | ||
97 | when N is of a wider tupe and N > SIZE_MAX. */ | ||
98 | #define xtimes(N, ELSIZE) \ | ||
99 | ((N) <= SIZE_MAX / (ELSIZE) ? (size_t) (N) * (ELSIZE) : SIZE_MAX) | ||
100 | |||
101 | /* Check for overflow. */ | ||
102 | #define size_overflow_p(SIZE) \ | ||
103 | ((SIZE) == SIZE_MAX) | ||
104 | /* Check against overflow. */ | ||
105 | #define size_in_bounds_p(SIZE) \ | ||
106 | ((SIZE) != SIZE_MAX) | ||
107 | |||
108 | #endif /* _XSIZE_H */ |
scripts/config.rpath
0 → 100755
This diff is collapsed.
Click to expand it.
-
Please register or sign in to post a comment