diff options
88 files changed, 2362 insertions, 1507 deletions
@@ -16,3 +16,7 @@ mkinstalldirs | |||
16 | missing | 16 | missing |
17 | depcomp | 17 | depcomp |
18 | THANKS | 18 | THANKS |
19 | libtool | ||
20 | ltmain.sh | ||
21 | compile | ||
22 | INSTALL | ||
diff --git a/Makefile.am b/Makefile.am index a4664aab..28367a94 100644 --- a/Makefile.am +++ b/Makefile.am | |||
@@ -1,6 +1,6 @@ | |||
1 | ## Process this file with automake to produce Makefile.in | 1 | ## Process this file with automake to produce Makefile.in |
2 | 2 | ||
3 | SUBDIRS = intl lib plugins plugins-scripts plugins-root m4 po | 3 | SUBDIRS = lib plugins plugins-scripts plugins-root m4 po |
4 | 4 | ||
5 | EXTRA_DIST = config.rpath \ | 5 | EXTRA_DIST = config.rpath \ |
6 | ABOUT-NLS ACKNOWLEDGEMENTS AUTHORS BUGS CHANGES CODING FAQ LEGAL \ | 6 | ABOUT-NLS ACKNOWLEDGEMENTS AUTHORS BUGS CHANGES CODING FAQ LEGAL \ |
diff --git a/configure.in b/configure.in index 0fba2d39..5e1debdc 100644 --- a/configure.in +++ b/configure.in | |||
@@ -145,9 +145,6 @@ dnl Check for miscellaneous stuff | |||
145 | dnl | 145 | dnl |
146 | 146 | ||
147 | case $host_vender-$host_os in | 147 | case $host_vender-$host_os in |
148 | sun*) | ||
149 | AC_DEFINE(__EXTENSIONS__,1,[Sun's netdb.h needs this for getaddrinfo]) | ||
150 | ;; | ||
151 | osf*) | 148 | osf*) |
152 | AC_DEFINE(_OSF_SOURCE,1,[OSF needs this for getaddrinfo]) | 149 | AC_DEFINE(_OSF_SOURCE,1,[OSF needs this for getaddrinfo]) |
153 | ;; | 150 | ;; |
@@ -1662,7 +1659,7 @@ AC_SUBST(EXTRAS_ROOT) | |||
1662 | AC_SUBST(EXTRA_NETOBJS) | 1659 | AC_SUBST(EXTRA_NETOBJS) |
1663 | AC_SUBST(DEPLIBS) | 1660 | AC_SUBST(DEPLIBS) |
1664 | 1661 | ||
1665 | AM_GNU_GETTEXT([no-libtool], [need-ngettext]) | 1662 | AM_GNU_GETTEXT([external], [need-ngettext]) |
1666 | AM_GNU_GETTEXT_VERSION(0.11.5) | 1663 | AM_GNU_GETTEXT_VERSION(0.11.5) |
1667 | 1664 | ||
1668 | dnl Check for Redhat spopen problem | 1665 | dnl Check for Redhat spopen problem |
@@ -1710,7 +1707,6 @@ AC_OUTPUT( | |||
1710 | command.cfg | 1707 | command.cfg |
1711 | test.pl | 1708 | test.pl |
1712 | pkg/solaris/pkginfo | 1709 | pkg/solaris/pkginfo |
1713 | intl/Makefile | ||
1714 | po/Makefile.in | 1710 | po/Makefile.in |
1715 | ) | 1711 | ) |
1716 | 1712 | ||
diff --git a/doc/developer-guidelines.sgml b/doc/developer-guidelines.sgml index 911067e9..3c3eea44 100644 --- a/doc/developer-guidelines.sgml +++ b/doc/developer-guidelines.sgml | |||
@@ -11,7 +11,7 @@ | |||
11 | </author> | 11 | </author> |
12 | </authorgroup> | 12 | </authorgroup> |
13 | 13 | ||
14 | <pubdate>2005</pubdate> | 14 | <pubdate>2006</pubdate> |
15 | <title>Nagios plug-in development guidelines</title> | 15 | <title>Nagios plug-in development guidelines</title> |
16 | 16 | ||
17 | <revhistory> | 17 | <revhistory> |
@@ -22,7 +22,7 @@ | |||
22 | </revhistory> | 22 | </revhistory> |
23 | 23 | ||
24 | <copyright> | 24 | <copyright> |
25 | <year>2000 - 2005</year> | 25 | <year>2000 - 2006</year> |
26 | <holder>Nagios Plugins Development Team</holder> | 26 | <holder>Nagios Plugins Development Team</holder> |
27 | </copyright> | 27 | </copyright> |
28 | 28 | ||
@@ -34,7 +34,7 @@ | |||
34 | the plug-in developers and encourage the standarization of the | 34 | the plug-in developers and encourage the standarization of the |
35 | different kind of plug-ins: C, shell, perl, python, etc.</para> | 35 | different kind of plug-ins: C, shell, perl, python, etc.</para> |
36 | 36 | ||
37 | <para>Nagios Plug-in Development Guidelines Copyright (C) 2000-2005 | 37 | <para>Nagios Plug-in Development Guidelines Copyright (C) 2000-2006 |
38 | (Nagios Plugins Team)</para> | 38 | (Nagios Plugins Team)</para> |
39 | 39 | ||
40 | <para>Permission is granted to make and distribute verbatim | 40 | <para>Permission is granted to make and distribute verbatim |
@@ -57,7 +57,6 @@ | |||
57 | gnu make 3.79 | 57 | gnu make 3.79 |
58 | automake 1.8 | 58 | automake 1.8 |
59 | autoconf 2.58 | 59 | autoconf 2.58 |
60 | gettext 0.11.5 | ||
61 | gnu libtool 1.5.6 | 60 | gnu libtool 1.5.6 |
62 | </literallayout> | 61 | </literallayout> |
63 | 62 | ||
@@ -69,6 +68,11 @@ | |||
69 | make install | 68 | make install |
70 | </literallayout> | 69 | </literallayout> |
71 | </para> | 70 | </para> |
71 | |||
72 | <para>Note: gettext is no longer a developer platform requirement. A lot of the files in lib/ and m4/ | ||
73 | are synced with the coreutils project and we use the same levels of gettext that they | ||
74 | distribute. | ||
75 | </para> | ||
72 | </section> | 76 | </section> |
73 | 77 | ||
74 | <section id="PlugOutput"><title>Plugin Output for Nagios</title> | 78 | <section id="PlugOutput"><title>Plugin Output for Nagios</title> |
diff --git a/lib/Makefile.am b/lib/Makefile.am index 0612a759..0d69089e 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am | |||
@@ -6,29 +6,28 @@ noinst_LIBRARIES = libcoreutils.a libnagiosplug.a | |||
6 | libcoreutils_a_SOURCES = \ | 6 | libcoreutils_a_SOURCES = \ |
7 | cloexec.c cloexec.h \ | 7 | cloexec.c cloexec.h \ |
8 | exit.h \ | 8 | exit.h \ |
9 | exitfail.c exitfail.h \ | ||
10 | fsusage.h \ | ||
11 | full-read.c full-read.h \ | 9 | full-read.c full-read.h \ |
12 | full-write.c full-write.h \ | 10 | full-write.c full-write.h \ |
13 | getopt.c getopt.h getopt1.c \ | ||
14 | gettext.h \ | 11 | gettext.h \ |
15 | mountlist.h \ | ||
16 | safe-read.c safe-read.h \ | 12 | safe-read.c safe-read.h \ |
17 | safe-write.c safe-write.h \ | 13 | safe-write.c safe-write.h xalloc-die.c |
18 | unlocked-io.h \ | ||
19 | xalloc.h \ | ||
20 | xmalloc.c \ | ||
21 | xstrdup.c | ||
22 | 14 | ||
23 | other_coreutils_files = \ | 15 | other_coreutils_files = \ |
24 | error.c error.h \ | 16 | error.c error.h \ |
25 | fsusage.c \ | 17 | fsusage.c \ |
26 | getloadaavg.c \ | 18 | getloadavg.c \ |
27 | malloc.c \ | 19 | malloc.c \ |
28 | mountlist.c \ | 20 | mountlist.c \ |
29 | realloc.c \ | 21 | realloc.c \ |
30 | stdbool_.h \ | 22 | strtod.c \ |
31 | strtod.c | 23 | exitfail.c exitfail.h \ |
24 | fsusage.h \ | ||
25 | getopt.c getopt1.c \ | ||
26 | mountlist.h \ | ||
27 | unlocked-io.h \ | ||
28 | xalloc.h \ | ||
29 | xmalloc.c | ||
30 | |||
32 | 31 | ||
33 | libcoreutils_a_LIBADD = $(LIBOBJS) | 32 | libcoreutils_a_LIBADD = $(LIBOBJS) |
34 | libcoreutils_a_DEPENDENCIES = $(libcoreutils_a_LIBADD) | 33 | libcoreutils_a_DEPENDENCIES = $(libcoreutils_a_LIBADD) |
@@ -37,6 +36,10 @@ libnagiosplug_a_SOURCES = snprintf.c | |||
37 | 36 | ||
38 | INCLUDES = -I$(srcdir) -I$(top_srcdir)/intl | 37 | INCLUDES = -I$(srcdir) -I$(top_srcdir)/intl |
39 | 38 | ||
39 | print_coreutil_files: | ||
40 | @echo $(libcoreutils_a_SOURCES) $(other_coreutils_files) $(EXTRA_DIST) | ||
41 | |||
42 | # Below are from coreutil's lib/Makefile.am | ||
40 | BUILT_SOURCES = $(STDBOOL_H) | 43 | BUILT_SOURCES = $(STDBOOL_H) |
41 | EXTRA_DIST = stdbool_.h | 44 | EXTRA_DIST = stdbool_.h |
42 | MOSTLYCLEANFILES = stdbool.h stdbool.ht | 45 | MOSTLYCLEANFILES = stdbool.h stdbool.ht |
@@ -45,3 +48,14 @@ stdbool.h: stdbool_.h | |||
45 | sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' $(srcdir)/stdbool_.h > $@t | 48 | sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' $(srcdir)/stdbool_.h > $@t |
46 | mv $@t $@ | 49 | mv $@t $@ |
47 | 50 | ||
51 | BUILT_SOURCES += $(GETOPT_H) | ||
52 | EXTRA_DIST += getopt_.h getopt_int.h | ||
53 | |||
54 | # We need the following in order to create an <getopt.h> when the system | ||
55 | # doesn't have one that works with the given compiler. | ||
56 | all-local $(lib_OBJECTS): $(GETOPT_H) | ||
57 | getopt.h: getopt_.h | ||
58 | cp $(srcdir)/getopt_.h $@-t | ||
59 | mv $@-t $@ | ||
60 | MOSTLYCLEANFILES += getopt.h getopt.h-t | ||
61 | |||
diff --git a/lib/cloexec.c b/lib/cloexec.c index 20f30db4..cf2308ca 100644 --- a/lib/cloexec.c +++ b/lib/cloexec.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* closexec.c - set or clear the close-on-exec descriptor flag | 1 | /* closexec.c - set or clear the close-on-exec descriptor flag |
2 | Copyright (C) 1991, 2004 Free Software Foundation, Inc. | 2 | Copyright (C) 1991, 2004, 2005 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software; you can redistribute it and/or modify | 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 | 5 | it under the terms of the GNU General Public License as published by |
@@ -13,23 +13,18 @@ | |||
13 | 13 | ||
14 | You should have received a copy of the GNU General Public License | 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, | 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. | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
17 | 17 | ||
18 | The code is taken from glibc/manual/llio.texi */ | 18 | The code is taken from glibc/manual/llio.texi */ |
19 | 19 | ||
20 | #if HAVE_CONFIG_H | 20 | #ifdef HAVE_CONFIG_H |
21 | # include <config.h> | 21 | # include <config.h> |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | #include "cloexec.h" | 24 | #include "cloexec.h" |
25 | 25 | ||
26 | #if HAVE_UNISTD_H | 26 | #include <unistd.h> |
27 | # include <unistd.h> | 27 | #include <fcntl.h> |
28 | #endif | ||
29 | |||
30 | #if HAVE_FCNTL_H | ||
31 | # include <fcntl.h> | ||
32 | #endif | ||
33 | 28 | ||
34 | #ifndef FD_CLOEXEC | 29 | #ifndef FD_CLOEXEC |
35 | # define FD_CLOEXEC 1 | 30 | # define FD_CLOEXEC 1 |
@@ -37,27 +32,29 @@ | |||
37 | 32 | ||
38 | /* Set the `FD_CLOEXEC' flag of DESC if VALUE is true, | 33 | /* Set the `FD_CLOEXEC' flag of DESC if VALUE is true, |
39 | or clear the flag if VALUE is false. | 34 | or clear the flag if VALUE is false. |
40 | Return true on success, or false on error with `errno' set. */ | 35 | Return 0 on success, or -1 on error with `errno' set. */ |
41 | 36 | ||
42 | bool | 37 | int |
43 | set_cloexec_flag (int desc, bool value) | 38 | set_cloexec_flag (int desc, bool value) |
44 | { | 39 | { |
45 | #if defined F_GETFD && defined F_SETFD | 40 | #if defined F_GETFD && defined F_SETFD |
46 | 41 | ||
47 | int flags = fcntl (desc, F_GETFD, 0); | 42 | int flags = fcntl (desc, F_GETFD, 0); |
48 | int newflags; | ||
49 | 43 | ||
50 | if (flags < 0) | 44 | if (0 <= flags) |
51 | return false; | 45 | { |
46 | int newflags = (value ? flags | FD_CLOEXEC : flags & ~FD_CLOEXEC); | ||
52 | 47 | ||
53 | newflags = (value ? flags | FD_CLOEXEC : flags & ~FD_CLOEXEC); | 48 | if (flags == newflags |
49 | || fcntl (desc, F_SETFD, newflags) != -1) | ||
50 | return 0; | ||
51 | } | ||
54 | 52 | ||
55 | return (flags == newflags | 53 | return -1; |
56 | || fcntl (desc, F_SETFD, newflags) != -1); | ||
57 | 54 | ||
58 | #else | 55 | #else |
59 | 56 | ||
60 | return true; | 57 | return 0; |
61 | 58 | ||
62 | #endif | 59 | #endif |
63 | } | 60 | } |
diff --git a/lib/cloexec.h b/lib/cloexec.h index ecad8d71..c25921d6 100644 --- a/lib/cloexec.h +++ b/lib/cloexec.h | |||
@@ -1,2 +1,2 @@ | |||
1 | #include <stdbool.h> | 1 | #include <stdbool.h> |
2 | bool set_cloexec_flag (int desc, bool value); | 2 | int set_cloexec_flag (int desc, bool value); |
diff --git a/lib/error.c b/lib/error.c index 1149235a..45698be8 100644 --- a/lib/error.c +++ b/lib/error.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Error handler for noninteractive utilities | 1 | /* Error handler for noninteractive utilities |
2 | Copyright (C) 1990-1998, 2000-2002, 2003 Free Software Foundation, Inc. | 2 | Copyright (C) 1990-1998, 2000-2003, 2004 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. | 3 | This file is part of the GNU C Library. |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
@@ -14,7 +14,7 @@ | |||
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License along | 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, | 16 | with this program; if not, write to the Free Software Foundation, |
17 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | 17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
18 | 18 | ||
19 | /* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */ | 19 | /* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */ |
20 | 20 | ||
@@ -29,9 +29,7 @@ | |||
29 | #include <stdlib.h> | 29 | #include <stdlib.h> |
30 | #include <string.h> | 30 | #include <string.h> |
31 | 31 | ||
32 | #ifdef _LIBC | 32 | #if !_LIBC && ENABLE_NLS |
33 | # include <libintl.h> | ||
34 | #else | ||
35 | # include "gettext.h" | 33 | # include "gettext.h" |
36 | #endif | 34 | #endif |
37 | 35 | ||
@@ -40,7 +38,7 @@ | |||
40 | # define mbsrtowcs __mbsrtowcs | 38 | # define mbsrtowcs __mbsrtowcs |
41 | #endif | 39 | #endif |
42 | 40 | ||
43 | #if !_LIBC | 41 | #if USE_UNLOCKED_IO |
44 | # include "unlocked-io.h" | 42 | # include "unlocked-io.h" |
45 | #endif | 43 | #endif |
46 | 44 | ||
@@ -106,7 +104,7 @@ extern char *program_name; | |||
106 | static void | 104 | static void |
107 | print_errno_message (int errnum) | 105 | print_errno_message (int errnum) |
108 | { | 106 | { |
109 | char const *s; | 107 | char const *s = NULL; |
110 | 108 | ||
111 | #if defined HAVE_STRERROR_R || _LIBC | 109 | #if defined HAVE_STRERROR_R || _LIBC |
112 | char errbuf[1024]; | 110 | char errbuf[1024]; |
@@ -115,15 +113,11 @@ print_errno_message (int errnum) | |||
115 | # else | 113 | # else |
116 | if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0) | 114 | if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0) |
117 | s = errbuf; | 115 | s = errbuf; |
118 | else | ||
119 | s = 0; | ||
120 | # endif | 116 | # endif |
121 | #else | ||
122 | s = strerror (errnum); | ||
123 | #endif | 117 | #endif |
124 | 118 | ||
125 | #if !_LIBC | 119 | #if !_LIBC |
126 | if (! s) | 120 | if (! s && ! (s = strerror (errnum))) |
127 | s = _("Unknown system error"); | 121 | s = _("Unknown system error"); |
128 | #endif | 122 | #endif |
129 | 123 | ||
diff --git a/lib/error.h b/lib/error.h index 8ed63595..e5220a2f 100644 --- a/lib/error.h +++ b/lib/error.h | |||
@@ -14,7 +14,7 @@ | |||
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License along | 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, | 16 | with this program; if not, write to the Free Software Foundation, |
17 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | 17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
18 | 18 | ||
19 | #ifndef _ERROR_H | 19 | #ifndef _ERROR_H |
20 | #define _ERROR_H 1 | 20 | #define _ERROR_H 1 |
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | You should have received a copy of the GNU General Public License | 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, | 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. */ | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | 17 | ||
18 | #ifndef _EXIT_H | 18 | #ifndef _EXIT_H |
19 | #define _EXIT_H | 19 | #define _EXIT_H |
diff --git a/lib/exitfail.c b/lib/exitfail.c index 2ae5f695..27d38c32 100644 --- a/lib/exitfail.c +++ b/lib/exitfail.c | |||
@@ -15,9 +15,9 @@ | |||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; see the file COPYING. | 16 | along with this program; see the file COPYING. |
17 | If not, write to the Free Software Foundation, | 17 | If not, write to the Free Software Foundation, |
18 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | 18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | 19 | ||
20 | #if HAVE_CONFIG_H | 20 | #ifdef HAVE_CONFIG_H |
21 | # include <config.h> | 21 | # include <config.h> |
22 | #endif | 22 | #endif |
23 | 23 | ||
diff --git a/lib/exitfail.h b/lib/exitfail.h index cf5ab719..e46cf9c1 100644 --- a/lib/exitfail.h +++ b/lib/exitfail.h | |||
@@ -15,6 +15,6 @@ | |||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; see the file COPYING. | 16 | along with this program; see the file COPYING. |
17 | If not, write to the Free Software Foundation, | 17 | If not, write to the Free Software Foundation, |
18 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | 18 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | 19 | ||
20 | extern int volatile exit_failure; | 20 | extern int volatile exit_failure; |
diff --git a/lib/fsusage.c b/lib/fsusage.c index d9260293..b1377907 100644 --- a/lib/fsusage.c +++ b/lib/fsusage.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* fsusage.c -- return space usage of mounted filesystems | 1 | /* fsusage.c -- return space usage of mounted file systems |
2 | 2 | ||
3 | Copyright (C) 1991, 1992, 1996, 1998, 1999, 2002, 2003 Free | 3 | Copyright (C) 1991, 1992, 1996, 1998, 1999, 2002, 2003, 2004, 2005 |
4 | Software Foundation, Inc. | 4 | Free Software Foundation, Inc. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 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 | 7 | it under the terms of the GNU General Public License as published by |
@@ -15,19 +15,19 @@ | |||
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 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, | 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. */ | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | 19 | ||
20 | #if HAVE_CONFIG_H | 20 | #ifdef HAVE_CONFIG_H |
21 | # include <config.h> | 21 | # include <config.h> |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | #if HAVE_INTTYPES_H | 24 | #if HAVE_INTTYPES_H |
25 | # include <inttypes.h> | 25 | # include <inttypes.h> |
26 | #else | ||
27 | # if HAVE_STDINT_H | ||
28 | # include <stdint.h> | ||
29 | # endif | ||
30 | #endif | 26 | #endif |
27 | #if HAVE_STDINT_H | ||
28 | # include <stdint.h> | ||
29 | #endif | ||
30 | #include <unistd.h> | ||
31 | #ifndef UINTMAX_MAX | 31 | #ifndef UINTMAX_MAX |
32 | # define UINTMAX_MAX ((uintmax_t) -1) | 32 | # define UINTMAX_MAX ((uintmax_t) -1) |
33 | #endif | 33 | #endif |
@@ -58,9 +58,7 @@ | |||
58 | # include <sys/filsys.h> /* SVR2 */ | 58 | # include <sys/filsys.h> /* SVR2 */ |
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | #if HAVE_FCNTL_H | 61 | #include <fcntl.h> |
62 | # include <fcntl.h> | ||
63 | #endif | ||
64 | 62 | ||
65 | #if HAVE_SYS_STATFS_H | 63 | #if HAVE_SYS_STATFS_H |
66 | # include <sys/statfs.h> | 64 | # include <sys/statfs.h> |
@@ -72,7 +70,6 @@ | |||
72 | 70 | ||
73 | #if HAVE_SYS_STATVFS_H /* SVR4 */ | 71 | #if HAVE_SYS_STATVFS_H /* SVR4 */ |
74 | # include <sys/statvfs.h> | 72 | # include <sys/statvfs.h> |
75 | int statvfs (); | ||
76 | #endif | 73 | #endif |
77 | 74 | ||
78 | #include "full-read.h" | 75 | #include "full-read.h" |
@@ -102,20 +99,20 @@ int statvfs (); | |||
102 | #define PROPAGATE_TOP_BIT(x) ((x) | ~ (EXTRACT_TOP_BIT (x) - 1)) | 99 | #define PROPAGATE_TOP_BIT(x) ((x) | ~ (EXTRACT_TOP_BIT (x) - 1)) |
103 | 100 | ||
104 | /* Fill in the fields of FSP with information about space usage for | 101 | /* Fill in the fields of FSP with information about space usage for |
105 | the filesystem on which PATH resides. | 102 | the file system on which FILE resides. |
106 | DISK is the device on which PATH is mounted, for space-getting | 103 | DISK is the device on which FILE is mounted, for space-getting |
107 | methods that need to know it. | 104 | methods that need to know it. |
108 | Return 0 if successful, -1 if not. When returning -1, ensure that | 105 | Return 0 if successful, -1 if not. When returning -1, ensure that |
109 | ERRNO is either a system error value, or zero if DISK is NULL | 106 | ERRNO is either a system error value, or zero if DISK is NULL |
110 | on a system that requires a non-NULL value. */ | 107 | on a system that requires a non-NULL value. */ |
111 | int | 108 | int |
112 | get_fs_usage (const char *path, const char *disk, struct fs_usage *fsp) | 109 | get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp) |
113 | { | 110 | { |
114 | #ifdef STAT_STATFS3_OSF1 | 111 | #ifdef STAT_STATFS3_OSF1 |
115 | 112 | ||
116 | struct statfs fsd; | 113 | struct statfs fsd; |
117 | 114 | ||
118 | if (statfs (path, &fsd, sizeof (struct statfs)) != 0) | 115 | if (statfs (file, &fsd, sizeof (struct statfs)) != 0) |
119 | return -1; | 116 | return -1; |
120 | 117 | ||
121 | fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize); | 118 | fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize); |
@@ -126,7 +123,7 @@ get_fs_usage (const char *path, const char *disk, struct fs_usage *fsp) | |||
126 | 123 | ||
127 | struct fs_data fsd; | 124 | struct fs_data fsd; |
128 | 125 | ||
129 | if (statfs (path, &fsd) != 1) | 126 | if (statfs (file, &fsd) != 1) |
130 | return -1; | 127 | return -1; |
131 | 128 | ||
132 | fsp->fsu_blocksize = 1024; | 129 | fsp->fsu_blocksize = 1024; |
@@ -180,7 +177,7 @@ get_fs_usage (const char *path, const char *disk, struct fs_usage *fsp) | |||
180 | 177 | ||
181 | struct statfs fsd; | 178 | struct statfs fsd; |
182 | 179 | ||
183 | if (statfs (path, &fsd) < 0) | 180 | if (statfs (file, &fsd) < 0) |
184 | return -1; | 181 | return -1; |
185 | 182 | ||
186 | fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_bsize); | 183 | fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_bsize); |
@@ -206,7 +203,7 @@ get_fs_usage (const char *path, const char *disk, struct fs_usage *fsp) | |||
206 | 203 | ||
207 | struct statfs fsd; | 204 | struct statfs fsd; |
208 | 205 | ||
209 | if (statfs (path, &fsd) < 0) | 206 | if (statfs (file, &fsd) < 0) |
210 | return -1; | 207 | return -1; |
211 | 208 | ||
212 | fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize); | 209 | fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize); |
@@ -221,7 +218,7 @@ get_fs_usage (const char *path, const char *disk, struct fs_usage *fsp) | |||
221 | 218 | ||
222 | struct statfs fsd; | 219 | struct statfs fsd; |
223 | 220 | ||
224 | if (statfs (path, &fsd, sizeof fsd, 0) < 0) | 221 | if (statfs (file, &fsd, sizeof fsd, 0) < 0) |
225 | return -1; | 222 | return -1; |
226 | 223 | ||
227 | /* Empirically, the block counts on most SVR3 and SVR3-derived | 224 | /* Empirically, the block counts on most SVR3 and SVR3-derived |
@@ -239,7 +236,7 @@ get_fs_usage (const char *path, const char *disk, struct fs_usage *fsp) | |||
239 | 236 | ||
240 | struct statvfs fsd; | 237 | struct statvfs fsd; |
241 | 238 | ||
242 | if (statvfs (path, &fsd) < 0) | 239 | if (statvfs (file, &fsd) < 0) |
243 | return -1; | 240 | return -1; |
244 | 241 | ||
245 | /* f_frsize isn't guaranteed to be supported. */ | 242 | /* f_frsize isn't guaranteed to be supported. */ |
@@ -268,12 +265,12 @@ get_fs_usage (const char *path, const char *disk, struct fs_usage *fsp) | |||
268 | /* AIX PS/2 does not supply statfs. */ | 265 | /* AIX PS/2 does not supply statfs. */ |
269 | 266 | ||
270 | int | 267 | int |
271 | statfs (char *path, struct statfs *fsb) | 268 | statfs (char *file, struct statfs *fsb) |
272 | { | 269 | { |
273 | struct stat stats; | 270 | struct stat stats; |
274 | struct dustat fsd; | 271 | struct dustat fsd; |
275 | 272 | ||
276 | if (stat (path, &stats)) | 273 | if (stat (file, &stats) != 0) |
277 | return -1; | 274 | return -1; |
278 | if (dustat (stats.st_dev, 0, &fsd, sizeof (fsd))) | 275 | if (dustat (stats.st_dev, 0, &fsd, sizeof (fsd))) |
279 | return -1; | 276 | return -1; |
diff --git a/lib/fsusage.h b/lib/fsusage.h index e2cbbf12..f3eda2d0 100644 --- a/lib/fsusage.h +++ b/lib/fsusage.h | |||
@@ -1,6 +1,7 @@ | |||
1 | /* fsusage.h -- declarations for filesystem space usage info | 1 | /* fsusage.h -- declarations for file system space usage info |
2 | 2 | ||
3 | Copyright (C) 1991, 1992, 1997, 2003 Free Software Foundation, Inc. | 3 | Copyright (C) 1991, 1992, 1997, 2003, 2004, 2005 Free Software |
4 | Foundation, Inc. | ||
4 | 5 | ||
5 | This program is free software; you can redistribute it and/or modify | 6 | 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 | it under the terms of the GNU General Public License as published by |
@@ -14,24 +15,26 @@ | |||
14 | 15 | ||
15 | You should have received a copy of the GNU General Public License | 16 | 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 | 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 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
18 | 19 | ||
19 | /* Space usage statistics for a filesystem. Blocks are 512-byte. */ | 20 | /* Space usage statistics for a file system. Blocks are 512-byte. */ |
20 | 21 | ||
21 | #if !defined FSUSAGE_H_ | 22 | #if !defined FSUSAGE_H_ |
22 | # define FSUSAGE_H_ | 23 | # define FSUSAGE_H_ |
23 | 24 | ||
25 | # include <stdbool.h> | ||
26 | |||
24 | struct fs_usage | 27 | struct fs_usage |
25 | { | 28 | { |
26 | int fsu_blocksize; /* Size of a block. */ | 29 | uintmax_t fsu_blocksize; /* Size of a block. */ |
27 | uintmax_t fsu_blocks; /* Total blocks. */ | 30 | uintmax_t fsu_blocks; /* Total blocks. */ |
28 | uintmax_t fsu_bfree; /* Free blocks available to superuser. */ | 31 | uintmax_t fsu_bfree; /* Free blocks available to superuser. */ |
29 | uintmax_t fsu_bavail; /* Free blocks available to non-superuser. */ | 32 | uintmax_t fsu_bavail; /* Free blocks available to non-superuser. */ |
30 | int fsu_bavail_top_bit_set; /* 1 if fsu_bavail represents a value < 0. */ | 33 | bool fsu_bavail_top_bit_set; /* 1 if fsu_bavail represents a value < 0. */ |
31 | uintmax_t fsu_files; /* Total file nodes. */ | 34 | uintmax_t fsu_files; /* Total file nodes. */ |
32 | uintmax_t fsu_ffree; /* Free file nodes. */ | 35 | uintmax_t fsu_ffree; /* Free file nodes. */ |
33 | }; | 36 | }; |
34 | 37 | ||
35 | int get_fs_usage (const char *path, const char *disk, struct fs_usage *fsp); | 38 | int get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp); |
36 | 39 | ||
37 | #endif | 40 | #endif |
diff --git a/lib/full-read.c b/lib/full-read.c index 1dc3e377..8c3472a4 100644 --- a/lib/full-read.c +++ b/lib/full-read.c | |||
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | You should have received a copy of the GNU General Public License | 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, | 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. */ | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | 17 | ||
18 | #define FULL_READ | 18 | #define FULL_READ |
19 | #include "full-write.c" | 19 | #include "full-write.c" |
diff --git a/lib/full-read.h b/lib/full-read.h index 71f19a3b..05d83a76 100644 --- a/lib/full-read.h +++ b/lib/full-read.h | |||
@@ -14,7 +14,7 @@ | |||
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, read to the Free Software Foundation, | 16 | along with this program; if not, read to the Free Software Foundation, |
17 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | 17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
18 | 18 | ||
19 | #include <stddef.h> | 19 | #include <stddef.h> |
20 | 20 | ||
diff --git a/lib/full-write.c b/lib/full-write.c index 15137056..106f3c7e 100644 --- a/lib/full-write.c +++ b/lib/full-write.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* An interface to read and write that retries (if necessary) until complete. | 1 | /* An interface to read and write that retries (if necessary) until complete. |
2 | 2 | ||
3 | Copyright (C) 1993, 1994, 1997-2003 Free Software Foundation, Inc. | 3 | Copyright (C) 1993, 1994, 1997, 1998, 1999, 2000, 2001, 2002, 2003, |
4 | 2004 Free Software Foundation, Inc. | ||
4 | 5 | ||
5 | This program is free software; you can redistribute it and/or modify | 6 | 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 | it under the terms of the GNU General Public License as published by |
@@ -14,9 +15,9 @@ | |||
14 | 15 | ||
15 | You should have received a copy of the GNU General Public License | 16 | 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 | 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 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
18 | 19 | ||
19 | #if HAVE_CONFIG_H | 20 | #ifdef HAVE_CONFIG_H |
20 | # include <config.h> | 21 | # include <config.h> |
21 | #endif | 22 | #endif |
22 | 23 | ||
@@ -28,9 +29,6 @@ | |||
28 | #endif | 29 | #endif |
29 | 30 | ||
30 | #include <errno.h> | 31 | #include <errno.h> |
31 | #ifndef errno | ||
32 | extern int errno; | ||
33 | #endif | ||
34 | 32 | ||
35 | #ifdef FULL_READ | 33 | #ifdef FULL_READ |
36 | # include "safe-read.h" | 34 | # include "safe-read.h" |
diff --git a/lib/full-write.h b/lib/full-write.h index 8cd2e815..d20d2fe4 100644 --- a/lib/full-write.h +++ b/lib/full-write.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* An interface to write() that writes all it is asked to write. | 1 | /* An interface to write() that writes all it is asked to write. |
2 | 2 | ||
3 | Copyright (C) 2002 Free Software Foundation, Inc. | 3 | Copyright (C) 2002-2003 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 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 | 6 | it under the terms of the GNU General Public License as published by |
@@ -14,11 +14,22 @@ | |||
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 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, | 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. */ | 17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
18 | 18 | ||
19 | #include <stddef.h> | 19 | #include <stddef.h> |
20 | 20 | ||
21 | |||
22 | #ifdef __cplusplus | ||
23 | extern "C" { | ||
24 | #endif | ||
25 | |||
26 | |||
21 | /* Write COUNT bytes at BUF to descriptor FD, retrying if interrupted | 27 | /* Write COUNT bytes at BUF to descriptor FD, retrying if interrupted |
22 | or if partial writes occur. Return the number of bytes successfully | 28 | or if partial writes occur. Return the number of bytes successfully |
23 | written, setting errno if that is less than COUNT. */ | 29 | written, setting errno if that is less than COUNT. */ |
24 | extern size_t full_write (int fd, const void *buf, size_t count); | 30 | extern size_t full_write (int fd, const void *buf, size_t count); |
31 | |||
32 | |||
33 | #ifdef __cplusplus | ||
34 | } | ||
35 | #endif | ||
diff --git a/lib/getloadavg.c b/lib/getloadavg.c index c6b6fee1..2a501314 100644 --- a/lib/getloadavg.c +++ b/lib/getloadavg.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* Get the system load averages. | 1 | /* Get the system load averages. |
2 | 2 | ||
3 | Copyright (C) 1985, 1986, 1987, 1988, 1989, 1991, 1992, 1993, 1994, | 3 | Copyright (C) 1985, 1986, 1987, 1988, 1989, 1991, 1992, 1993, 1994, |
4 | 1995, 1997, 1999, 2000, 2003, 2004 Free Software Foundation, Inc. | 4 | 1995, 1997, 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. |
5 | 5 | ||
6 | NOTE: The canonical source of this file is maintained with gnulib. | 6 | NOTE: The canonical source of this file is maintained with gnulib. |
7 | Bugs can be reported to bug-gnulib@gnu.org. | 7 | Bugs can be reported to bug-gnulib@gnu.org. |
@@ -18,7 +18,7 @@ | |||
18 | 18 | ||
19 | You should have received a copy of the GNU General Public License | 19 | You should have received a copy of the GNU General Public License |
20 | along with this program; if not, write to the Free Software | 20 | along with this program; if not, write to the Free Software |
21 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | 21 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
22 | USA. */ | 22 | USA. */ |
23 | 23 | ||
24 | /* Compile-time symbols that this file uses: | 24 | /* Compile-time symbols that this file uses: |
@@ -32,7 +32,7 @@ | |||
32 | AC_CHECK_FUNCS(pstat_getdynamic) in your | 32 | AC_CHECK_FUNCS(pstat_getdynamic) in your |
33 | configure.in file. | 33 | configure.in file. |
34 | FIXUP_KERNEL_SYMBOL_ADDR() Adjust address in returned struct nlist. | 34 | FIXUP_KERNEL_SYMBOL_ADDR() Adjust address in returned struct nlist. |
35 | KERNEL_FILE Pathname of the kernel to nlist. | 35 | KERNEL_FILE Name of the kernel file to nlist. |
36 | LDAV_CVT() Scale the load average from the kernel. | 36 | LDAV_CVT() Scale the load average from the kernel. |
37 | Returns a double. | 37 | Returns a double. |
38 | LDAV_SYMBOL Name of kernel symbol giving load average. | 38 | LDAV_SYMBOL Name of kernel symbol giving load average. |
@@ -47,9 +47,8 @@ | |||
47 | the nlist n_name element is a pointer, | 47 | the nlist n_name element is a pointer, |
48 | not an array. | 48 | not an array. |
49 | HAVE_STRUCT_NLIST_N_UN_N_NAME `n_un.n_name' is member of `struct nlist'. | 49 | HAVE_STRUCT_NLIST_N_UN_N_NAME `n_un.n_name' is member of `struct nlist'. |
50 | LINUX_LDAV_FILE [__linux__]: File containing load averages. | 50 | LINUX_LDAV_FILE [__linux__, __CYGWIN__]: File containing |
51 | HAVE_LOCALE_H locale.h is available. | 51 | load averages. |
52 | HAVE_SETLOCALE The `setlocale' function is available. | ||
53 | 52 | ||
54 | Specific system predefines this file uses, aside from setting | 53 | Specific system predefines this file uses, aside from setting |
55 | default values if not emacs: | 54 | default values if not emacs: |
@@ -70,9 +69,10 @@ | |||
70 | UMAX4_3 | 69 | UMAX4_3 |
71 | VMS | 70 | VMS |
72 | WINDOWS32 No-op for Windows95/NT. | 71 | WINDOWS32 No-op for Windows95/NT. |
73 | __linux__ Linux: assumes /proc filesystem mounted. | 72 | __linux__ Linux: assumes /proc file system mounted. |
74 | Support from Michael K. Johnson. | 73 | Support from Michael K. Johnson. |
75 | __NetBSD__ NetBSD: assumes /kern filesystem mounted. | 74 | __CYGWIN__ Cygwin emulates linux /proc/loadavg. |
75 | __NetBSD__ NetBSD: assumes /kern file system mounted. | ||
76 | 76 | ||
77 | In addition, to avoid nesting many #ifdefs, we internally set | 77 | In addition, to avoid nesting many #ifdefs, we internally set |
78 | LDAV_DONE to indicate that the load average has been computed. | 78 | LDAV_DONE to indicate that the load average has been computed. |
@@ -85,38 +85,29 @@ | |||
85 | # include <config.h> | 85 | # include <config.h> |
86 | #endif | 86 | #endif |
87 | 87 | ||
88 | #include <sys/types.h> | 88 | #include <errno.h> |
89 | 89 | #include <stdbool.h> | |
90 | /* Both the Emacs and non-Emacs sections want this. Some | 90 | #include <stdio.h> |
91 | configuration files' definitions for the LOAD_AVE_CVT macro (like | 91 | #include <stdlib.h> |
92 | sparc.h's) use macros like FSCALE, defined here. */ | ||
93 | #if defined (unix) || defined (__unix) | ||
94 | # include <sys/param.h> | ||
95 | #endif | ||
96 | |||
97 | 92 | ||
98 | /* Exclude all the code except the test program at the end | 93 | /* Exclude all the code except the test program at the end |
99 | if the system has its own `getloadavg' function. | 94 | if the system has its own `getloadavg' function. */ |
100 | 95 | ||
101 | The declaration of `errno' is needed by the test program | 96 | #ifndef HAVE_GETLOADAVG |
102 | as well as the function itself, so it comes first. */ | ||
103 | |||
104 | #include <errno.h> | ||
105 | |||
106 | #ifndef errno | ||
107 | extern int errno; | ||
108 | #endif | ||
109 | 97 | ||
110 | #ifdef HAVE_LOCALE_H | 98 | # include <sys/types.h> |
111 | # include <locale.h> | ||
112 | #endif | ||
113 | #ifndef HAVE_SETLOCALE | ||
114 | # define setlocale(Category, Locale) /* empty */ | ||
115 | #endif | ||
116 | 99 | ||
117 | #include "cloexec.h" | 100 | /* Both the Emacs and non-Emacs sections want this. Some |
101 | configuration files' definitions for the LOAD_AVE_CVT macro (like | ||
102 | sparc.h's) use macros like FSCALE, defined here. */ | ||
103 | # if defined (unix) || defined (__unix) | ||
104 | # include <sys/param.h> | ||
105 | # endif | ||
118 | 106 | ||
119 | #ifndef HAVE_GETLOADAVG | 107 | # include "c-strtod.h" |
108 | # include "cloexec.h" | ||
109 | # include "intprops.h" | ||
110 | # include "xalloc.h" | ||
120 | 111 | ||
121 | /* The existing Emacs configuration files define a macro called | 112 | /* The existing Emacs configuration files define a macro called |
122 | LOAD_AVE_CVT, which accepts a value of type LOAD_AVE_TYPE, and | 113 | LOAD_AVE_CVT, which accepts a value of type LOAD_AVE_TYPE, and |
@@ -357,11 +348,7 @@ extern int errno; | |||
357 | # define LDAV_SYMBOL "avenrun" | 348 | # define LDAV_SYMBOL "avenrun" |
358 | # endif | 349 | # endif |
359 | 350 | ||
360 | # ifdef HAVE_UNISTD_H | 351 | # include <unistd.h> |
361 | # include <unistd.h> | ||
362 | # endif | ||
363 | |||
364 | # include <stdio.h> | ||
365 | 352 | ||
366 | /* LOAD_AVE_TYPE should only get defined if we're going to use the | 353 | /* LOAD_AVE_TYPE should only get defined if we're going to use the |
367 | nlist method. */ | 354 | nlist method. */ |
@@ -435,7 +422,6 @@ extern int errno; | |||
435 | # endif /* sgi */ | 422 | # endif /* sgi */ |
436 | 423 | ||
437 | # ifdef UMAX | 424 | # ifdef UMAX |
438 | # include <stdio.h> | ||
439 | # include <signal.h> | 425 | # include <signal.h> |
440 | # include <sys/time.h> | 426 | # include <sys/time.h> |
441 | # include <sys/wait.h> | 427 | # include <sys/wait.h> |
@@ -461,17 +447,13 @@ extern int errno; | |||
461 | # include <sys/dg_sys_info.h> | 447 | # include <sys/dg_sys_info.h> |
462 | # endif | 448 | # endif |
463 | 449 | ||
464 | # if defined (HAVE_FCNTL_H) || defined (_POSIX_VERSION) | 450 | # include "fcntl--.h" |
465 | # include <fcntl.h> | ||
466 | # else | ||
467 | # include <sys/file.h> | ||
468 | # endif | ||
469 | 451 | ||
470 | /* Avoid static vars inside a function since in HPUX they dump as pure. */ | 452 | /* Avoid static vars inside a function since in HPUX they dump as pure. */ |
471 | 453 | ||
472 | # ifdef NeXT | 454 | # ifdef NeXT |
473 | static processor_set_t default_set; | 455 | static processor_set_t default_set; |
474 | static int getloadavg_initialized; | 456 | static bool getloadavg_initialized; |
475 | # endif /* NeXT */ | 457 | # endif /* NeXT */ |
476 | 458 | ||
477 | # ifdef UMAX | 459 | # ifdef UMAX |
@@ -486,8 +468,8 @@ static struct dg_sys_info_load_info load_info; /* what-a-mouthful! */ | |||
486 | # if !defined (HAVE_LIBKSTAT) && defined (LOAD_AVE_TYPE) | 468 | # if !defined (HAVE_LIBKSTAT) && defined (LOAD_AVE_TYPE) |
487 | /* File descriptor open to /dev/kmem or VMS load ave driver. */ | 469 | /* File descriptor open to /dev/kmem or VMS load ave driver. */ |
488 | static int channel; | 470 | static int channel; |
489 | /* Nonzero iff channel is valid. */ | 471 | /* True iff channel is valid. */ |
490 | static int getloadavg_initialized; | 472 | static bool getloadavg_initialized; |
491 | /* Offset in kmem to seek to read load average, or 0 means invalid. */ | 473 | /* Offset in kmem to seek to read load average, or 0 means invalid. */ |
492 | static long offset; | 474 | static long offset; |
493 | 475 | ||
@@ -583,7 +565,7 @@ getloadavg (double loadavg[], int nelem) | |||
583 | 565 | ||
584 | # endif /* hpux && HAVE_PSTAT_GETDYNAMIC */ | 566 | # endif /* hpux && HAVE_PSTAT_GETDYNAMIC */ |
585 | 567 | ||
586 | # if !defined (LDAV_DONE) && defined (__linux__) | 568 | # if !defined (LDAV_DONE) && (defined (__linux__) || defined (__CYGWIN__)) |
587 | # define LDAV_DONE | 569 | # define LDAV_DONE |
588 | # undef LOAD_AVE_TYPE | 570 | # undef LOAD_AVE_TYPE |
589 | 571 | ||
@@ -591,32 +573,36 @@ getloadavg (double loadavg[], int nelem) | |||
591 | # define LINUX_LDAV_FILE "/proc/loadavg" | 573 | # define LINUX_LDAV_FILE "/proc/loadavg" |
592 | # endif | 574 | # endif |
593 | 575 | ||
594 | char ldavgbuf[40]; | 576 | char ldavgbuf[3 * (INT_STRLEN_BOUND (int) + sizeof ".00 ")]; |
595 | double load_ave[3]; | 577 | char const *ptr = ldavgbuf; |
596 | int fd, count; | 578 | int fd, count; |
597 | 579 | ||
598 | fd = open (LINUX_LDAV_FILE, O_RDONLY); | 580 | fd = open (LINUX_LDAV_FILE, O_RDONLY); |
599 | if (fd == -1) | 581 | if (fd == -1) |
600 | return -1; | 582 | return -1; |
601 | count = read (fd, ldavgbuf, 40); | 583 | count = read (fd, ldavgbuf, sizeof ldavgbuf - 1); |
602 | (void) close (fd); | 584 | (void) close (fd); |
603 | if (count <= 0) | 585 | if (count <= 0) |
604 | return -1; | 586 | return -1; |
587 | ldavgbuf[count] = '\0'; | ||
605 | 588 | ||
606 | /* The following sscanf must use the C locale. */ | 589 | for (elem = 0; elem < nelem; elem++) |
607 | setlocale (LC_NUMERIC, "C"); | 590 | { |
608 | count = sscanf (ldavgbuf, "%lf %lf %lf", | 591 | char *endptr; |
609 | &load_ave[0], &load_ave[1], &load_ave[2]); | 592 | double d = c_strtod (ptr, &endptr); |
610 | setlocale (LC_NUMERIC, ""); | 593 | if (ptr == endptr) |
611 | if (count < 1) | 594 | { |
612 | return -1; | 595 | if (elem == 0) |
613 | 596 | return -1; | |
614 | for (elem = 0; elem < nelem && elem < count; elem++) | 597 | break; |
615 | loadavg[elem] = load_ave[elem]; | 598 | } |
599 | loadavg[elem] = d; | ||
600 | ptr = endptr; | ||
601 | } | ||
616 | 602 | ||
617 | return elem; | 603 | return elem; |
618 | 604 | ||
619 | # endif /* __linux__ */ | 605 | # endif /* __linux__ || __CYGWIN__ */ |
620 | 606 | ||
621 | # if !defined (LDAV_DONE) && defined (__NetBSD__) | 607 | # if !defined (LDAV_DONE) && defined (__NetBSD__) |
622 | # define LDAV_DONE | 608 | # define LDAV_DONE |
@@ -653,7 +639,7 @@ getloadavg (double loadavg[], int nelem) | |||
653 | 639 | ||
654 | host_t host; | 640 | host_t host; |
655 | struct processor_set_basic_info info; | 641 | struct processor_set_basic_info info; |
656 | unsigned info_count; | 642 | unsigned int info_count; |
657 | 643 | ||
658 | /* We only know how to get the 1-minute average for this system, | 644 | /* We only know how to get the 1-minute average for this system, |
659 | so even if the caller asks for more than 1, we only return 1. */ | 645 | so even if the caller asks for more than 1, we only return 1. */ |
@@ -661,7 +647,7 @@ getloadavg (double loadavg[], int nelem) | |||
661 | if (!getloadavg_initialized) | 647 | if (!getloadavg_initialized) |
662 | { | 648 | { |
663 | if (processor_set_default (host_self (), &default_set) == KERN_SUCCESS) | 649 | if (processor_set_default (host_self (), &default_set) == KERN_SUCCESS) |
664 | getloadavg_initialized = 1; | 650 | getloadavg_initialized = true; |
665 | } | 651 | } |
666 | 652 | ||
667 | if (getloadavg_initialized) | 653 | if (getloadavg_initialized) |
@@ -670,7 +656,7 @@ getloadavg (double loadavg[], int nelem) | |||
670 | if (processor_set_info (default_set, PROCESSOR_SET_BASIC_INFO, &host, | 656 | if (processor_set_info (default_set, PROCESSOR_SET_BASIC_INFO, &host, |
671 | (processor_set_info_t) &info, &info_count) | 657 | (processor_set_info_t) &info, &info_count) |
672 | != KERN_SUCCESS) | 658 | != KERN_SUCCESS) |
673 | getloadavg_initialized = 0; | 659 | getloadavg_initialized = false; |
674 | else | 660 | else |
675 | { | 661 | { |
676 | if (nelem > 0) | 662 | if (nelem > 0) |
@@ -831,7 +817,7 @@ getloadavg (double loadavg[], int nelem) | |||
831 | /* VMS specific code -- read from the Load Ave driver. */ | 817 | /* VMS specific code -- read from the Load Ave driver. */ |
832 | 818 | ||
833 | LOAD_AVE_TYPE load_ave[3]; | 819 | LOAD_AVE_TYPE load_ave[3]; |
834 | static int getloadavg_initialized = 0; | 820 | static bool getloadavg_initialized; |
835 | # ifdef eunice | 821 | # ifdef eunice |
836 | struct | 822 | struct |
837 | { | 823 | { |
@@ -851,7 +837,7 @@ getloadavg (double loadavg[], int nelem) | |||
851 | $DESCRIPTOR (descriptor, "LAV0:"); | 837 | $DESCRIPTOR (descriptor, "LAV0:"); |
852 | # endif | 838 | # endif |
853 | if (sys$assign (&descriptor, &channel, 0, 0) & 1) | 839 | if (sys$assign (&descriptor, &channel, 0, 0) & 1) |
854 | getloadavg_initialized = 1; | 840 | getloadavg_initialized = true; |
855 | } | 841 | } |
856 | 842 | ||
857 | /* Read the load average vector. */ | 843 | /* Read the load average vector. */ |
@@ -860,7 +846,7 @@ getloadavg (double loadavg[], int nelem) | |||
860 | load_ave, 12, 0, 0, 0, 0) & 1)) | 846 | load_ave, 12, 0, 0, 0, 0) & 1)) |
861 | { | 847 | { |
862 | sys$dassgn (channel); | 848 | sys$dassgn (channel); |
863 | getloadavg_initialized = 0; | 849 | getloadavg_initialized = false; |
864 | } | 850 | } |
865 | 851 | ||
866 | if (!getloadavg_initialized) | 852 | if (!getloadavg_initialized) |
@@ -913,7 +899,7 @@ getloadavg (double loadavg[], int nelem) | |||
913 | 899 | ||
914 | ldav_off = sysmp (MP_KERNADDR, MPKA_AVENRUN); | 900 | ldav_off = sysmp (MP_KERNADDR, MPKA_AVENRUN); |
915 | if (ldav_off != -1) | 901 | if (ldav_off != -1) |
916 | offset = (long) ldav_off & 0x7fffffff; | 902 | offset = (long int) ldav_off & 0x7fffffff; |
917 | # endif /* sgi */ | 903 | # endif /* sgi */ |
918 | } | 904 | } |
919 | 905 | ||
@@ -921,13 +907,13 @@ getloadavg (double loadavg[], int nelem) | |||
921 | if (!getloadavg_initialized) | 907 | if (!getloadavg_initialized) |
922 | { | 908 | { |
923 | # ifndef SUNOS_5 | 909 | # ifndef SUNOS_5 |
924 | channel = open ("/dev/kmem", 0); | 910 | channel = open ("/dev/kmem", O_RDONLY); |
925 | if (channel >= 0) | 911 | if (channel >= 0) |
926 | { | 912 | { |
927 | /* Set the channel to close on exec, so it does not | 913 | /* Set the channel to close on exec, so it does not |
928 | litter any child's descriptor table. */ | 914 | litter any child's descriptor table. */ |
929 | set_cloexec_flag (channel, true); | 915 | set_cloexec_flag (channel, true); |
930 | getloadavg_initialized = 1; | 916 | getloadavg_initialized = true; |
931 | } | 917 | } |
932 | # else /* SUNOS_5 */ | 918 | # else /* SUNOS_5 */ |
933 | /* We pass 0 for the kernel, corefile, and swapfile names | 919 | /* We pass 0 for the kernel, corefile, and swapfile names |
@@ -938,7 +924,7 @@ getloadavg (double loadavg[], int nelem) | |||
938 | /* nlist the currently running kernel. */ | 924 | /* nlist the currently running kernel. */ |
939 | kvm_nlist (kd, nl); | 925 | kvm_nlist (kd, nl); |
940 | offset = nl[0].n_value; | 926 | offset = nl[0].n_value; |
941 | getloadavg_initialized = 1; | 927 | getloadavg_initialized = true; |
942 | } | 928 | } |
943 | # endif /* SUNOS_5 */ | 929 | # endif /* SUNOS_5 */ |
944 | } | 930 | } |
@@ -953,14 +939,14 @@ getloadavg (double loadavg[], int nelem) | |||
953 | != sizeof (load_ave)) | 939 | != sizeof (load_ave)) |
954 | { | 940 | { |
955 | close (channel); | 941 | close (channel); |
956 | getloadavg_initialized = 0; | 942 | getloadavg_initialized = false; |
957 | } | 943 | } |
958 | # else /* SUNOS_5 */ | 944 | # else /* SUNOS_5 */ |
959 | if (kvm_read (kd, offset, (char *) load_ave, sizeof (load_ave)) | 945 | if (kvm_read (kd, offset, (char *) load_ave, sizeof (load_ave)) |
960 | != sizeof (load_ave)) | 946 | != sizeof (load_ave)) |
961 | { | 947 | { |
962 | kvm_close (kd); | 948 | kvm_close (kd); |
963 | getloadavg_initialized = 0; | 949 | getloadavg_initialized = false; |
964 | } | 950 | } |
965 | # endif /* SUNOS_5 */ | 951 | # endif /* SUNOS_5 */ |
966 | } | 952 | } |
@@ -980,20 +966,19 @@ getloadavg (double loadavg[], int nelem) | |||
980 | # define LDAV_DONE | 966 | # define LDAV_DONE |
981 | # endif /* !LDAV_DONE && LOAD_AVE_TYPE */ | 967 | # endif /* !LDAV_DONE && LOAD_AVE_TYPE */ |
982 | 968 | ||
983 | # ifdef LDAV_DONE | 969 | # if !defined LDAV_DONE |
984 | return elem; | ||
985 | # else | ||
986 | /* Set errno to zero to indicate that there was no particular error; | 970 | /* Set errno to zero to indicate that there was no particular error; |
987 | this function just can't work at all on this system. */ | 971 | this function just can't work at all on this system. */ |
988 | errno = 0; | 972 | errno = 0; |
989 | return -1; | 973 | elem = -1; |
990 | # endif | 974 | # endif |
975 | return elem; | ||
991 | } | 976 | } |
992 | 977 | ||
993 | #endif /* ! HAVE_GETLOADAVG */ | 978 | #endif /* ! HAVE_GETLOADAVG */ |
994 | 979 | ||
995 | #ifdef TEST | 980 | #ifdef TEST |
996 | void | 981 | int |
997 | main (int argc, char **argv) | 982 | main (int argc, char **argv) |
998 | { | 983 | { |
999 | int naptime = 0; | 984 | int naptime = 0; |
@@ -1011,7 +996,7 @@ main (int argc, char **argv) | |||
1011 | if (loads == -1) | 996 | if (loads == -1) |
1012 | { | 997 | { |
1013 | perror ("Error getting load average"); | 998 | perror ("Error getting load average"); |
1014 | exit (1); | 999 | return EXIT_FAILURE; |
1015 | } | 1000 | } |
1016 | if (loads > 0) | 1001 | if (loads > 0) |
1017 | printf ("1-minute: %f ", avg[0]); | 1002 | printf ("1-minute: %f ", avg[0]); |
@@ -1027,6 +1012,6 @@ main (int argc, char **argv) | |||
1027 | sleep (naptime); | 1012 | sleep (naptime); |
1028 | } | 1013 | } |
1029 | 1014 | ||
1030 | exit (0); | 1015 | return EXIT_SUCCESS; |
1031 | } | 1016 | } |
1032 | #endif /* TEST */ | 1017 | #endif /* TEST */ |
diff --git a/lib/getopt.c b/lib/getopt.c index 6dcdbebf..bcb81c83 100644 --- a/lib/getopt.c +++ b/lib/getopt.c | |||
@@ -2,11 +2,8 @@ | |||
2 | NOTE: getopt is now part of the C library, so if you don't know what | 2 | NOTE: getopt is now part of the C library, so if you don't know what |
3 | "Keep this file name-space clean" means, talk to drepper@gnu.org | 3 | "Keep this file name-space clean" means, talk to drepper@gnu.org |
4 | before changing it! | 4 | before changing it! |
5 | 5 | Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004 | |
6 | Copyright (C) 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, | 6 | Free Software Foundation, Inc. |
7 | 1996, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, | ||
8 | Inc. | ||
9 | |||
10 | This file is part of the GNU C Library. | 7 | This file is part of the GNU C Library. |
11 | 8 | ||
12 | This program is free software; you can redistribute it and/or modify | 9 | This program is free software; you can redistribute it and/or modify |
@@ -21,7 +18,7 @@ | |||
21 | 18 | ||
22 | You should have received a copy of the GNU General Public License along | 19 | You should have received a copy of the GNU General Public License along |
23 | with this program; if not, write to the Free Software Foundation, | 20 | with this program; if not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | 21 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
25 | 22 | ||
26 | /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. | 23 | /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. |
27 | Ditto for AIX 3.2 and <stdlib.h>. */ | 24 | Ditto for AIX 3.2 and <stdlib.h>. */ |
@@ -35,25 +32,6 @@ | |||
35 | 32 | ||
36 | #include <stdio.h> | 33 | #include <stdio.h> |
37 | 34 | ||
38 | /* Comment out all this code if we are using the GNU C Library, and are not | ||
39 | actually compiling the library itself. This code is part of the GNU C | ||
40 | Library, but also included in many other GNU distributions. Compiling | ||
41 | and linking in this code is a waste when using the GNU C library | ||
42 | (especially if it is a shared library). Rather than having every GNU | ||
43 | program understand `configure --with-gnu-libc' and omit the object files, | ||
44 | it is simpler to just do this in the source for each such file. */ | ||
45 | |||
46 | #define GETOPT_INTERFACE_VERSION 2 | ||
47 | #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 | ||
48 | # include <gnu-versions.h> | ||
49 | # if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION | ||
50 | # define ELIDE_CODE | ||
51 | # endif | ||
52 | #endif | ||
53 | |||
54 | #ifndef ELIDE_CODE | ||
55 | |||
56 | |||
57 | /* This needs to come after some library #include | 35 | /* This needs to come after some library #include |
58 | to get __GNU_LIBRARY__ defined. */ | 36 | to get __GNU_LIBRARY__ defined. */ |
59 | #ifdef __GNU_LIBRARY__ | 37 | #ifdef __GNU_LIBRARY__ |
@@ -72,10 +50,9 @@ | |||
72 | #ifdef _LIBC | 50 | #ifdef _LIBC |
73 | # include <libintl.h> | 51 | # include <libintl.h> |
74 | #else | 52 | #else |
75 | /* This is for other GNU distributions with internationalized messages. */ | ||
76 | # include "gettext.h" | 53 | # include "gettext.h" |
54 | # define _(msgid) gettext (msgid) | ||
77 | #endif | 55 | #endif |
78 | #define _(msgid) gettext (msgid) | ||
79 | 56 | ||
80 | #if defined _LIBC && defined USE_IN_LIBIO | 57 | #if defined _LIBC && defined USE_IN_LIBIO |
81 | # include <wchar.h> | 58 | # include <wchar.h> |
@@ -85,21 +62,22 @@ | |||
85 | # define attribute_hidden | 62 | # define attribute_hidden |
86 | #endif | 63 | #endif |
87 | 64 | ||
88 | /* This version of `getopt' appears to the caller like standard Unix `getopt' | 65 | /* Unlike standard Unix `getopt', functions like `getopt_long' |
89 | but it behaves differently for the user, since it allows the user | 66 | let the user intersperse the options with the other arguments. |
90 | to intersperse the options with the other arguments. | ||
91 | 67 | ||
92 | As `getopt' works, it permutes the elements of ARGV so that, | 68 | As `getopt_long' works, it permutes the elements of ARGV so that, |
93 | when it is done, all the options precede everything else. Thus | 69 | when it is done, all the options precede everything else. Thus |
94 | all application programs are extended to handle flexible argument order. | 70 | all application programs are extended to handle flexible argument order. |
95 | 71 | ||
96 | Setting the environment variable POSIXLY_CORRECT disables permutation. | 72 | Using `getopt' or setting the environment variable POSIXLY_CORRECT |
97 | Then the behavior is completely standard. | 73 | disables permutation. |
74 | Then the application's behavior is completely standard. | ||
98 | 75 | ||
99 | GNU application programs can use a third alternative mode in which | 76 | GNU application programs can use a third alternative mode in which |
100 | they can distinguish the relative order of options and other arguments. */ | 77 | they can distinguish the relative order of options and other arguments. */ |
101 | 78 | ||
102 | #include "getopt.h" | 79 | #include "getopt.h" |
80 | #include "getopt_int.h" | ||
103 | 81 | ||
104 | /* For communication from `getopt' to the caller. | 82 | /* For communication from `getopt' to the caller. |
105 | When `getopt' finds an option that takes an argument, | 83 | When `getopt' finds an option that takes an argument, |
@@ -124,21 +102,6 @@ char *optarg; | |||
124 | /* 1003.2 says this must be 1 before any call. */ | 102 | /* 1003.2 says this must be 1 before any call. */ |
125 | int optind = 1; | 103 | int optind = 1; |
126 | 104 | ||
127 | /* Formerly, initialization of getopt depended on optind==0, which | ||
128 | causes problems with re-calling getopt as programs generally don't | ||
129 | know that. */ | ||
130 | |||
131 | int __getopt_initialized attribute_hidden; | ||
132 | |||
133 | /* The next char to be scanned in the option-element | ||
134 | in which the last option character we returned was found. | ||
135 | This allows us to pick up the scan where we left off. | ||
136 | |||
137 | If this is zero, or a null string, it means resume the scan | ||
138 | by advancing to the next ARGV-element. */ | ||
139 | |||
140 | static char *nextchar; | ||
141 | |||
142 | /* Callers store zero here to inhibit the error message | 105 | /* Callers store zero here to inhibit the error message |
143 | for unrecognized options. */ | 106 | for unrecognized options. */ |
144 | 107 | ||
@@ -150,44 +113,12 @@ int opterr = 1; | |||
150 | 113 | ||
151 | int optopt = '?'; | 114 | int optopt = '?'; |
152 | 115 | ||
153 | /* Describe how to deal with options that follow non-option ARGV-elements. | 116 | /* Keep a global copy of all internal members of getopt_data. */ |
154 | |||
155 | If the caller did not specify anything, | ||
156 | the default is REQUIRE_ORDER if the environment variable | ||
157 | POSIXLY_CORRECT is defined, PERMUTE otherwise. | ||
158 | |||
159 | REQUIRE_ORDER means don't recognize them as options; | ||
160 | stop option processing when the first non-option is seen. | ||
161 | This is what Unix does. | ||
162 | This mode of operation is selected by either setting the environment | ||
163 | variable POSIXLY_CORRECT, or using `+' as the first character | ||
164 | of the list of option characters. | ||
165 | |||
166 | PERMUTE is the default. We permute the contents of ARGV as we scan, | ||
167 | so that eventually all the non-options are at the end. This allows options | ||
168 | to be given in any order, even with programs that were not written to | ||
169 | expect this. | ||
170 | |||
171 | RETURN_IN_ORDER is an option available to programs that were written | ||
172 | to expect options and other ARGV-elements in any order and that care about | ||
173 | the ordering of the two. We describe each non-option ARGV-element | ||
174 | as if it were the argument of an option with character code 1. | ||
175 | Using `-' as the first character of the list of option characters | ||
176 | selects this mode of operation. | ||
177 | 117 | ||
178 | The special argument `--' forces an end of option-scanning regardless | 118 | static struct _getopt_data getopt_data; |
179 | of the value of `ordering'. In the case of RETURN_IN_ORDER, only | ||
180 | `--' can cause `getopt' to return -1 with `optind' != ARGC. */ | ||
181 | 119 | ||
182 | static enum | ||
183 | { | ||
184 | REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER | ||
185 | } ordering; | ||
186 | |||
187 | /* Value of POSIXLY_CORRECT environment variable. */ | ||
188 | static char *posixly_correct; | ||
189 | 120 | ||
190 | #ifndef __GNU_LIBRARY__ | 121 | #ifndef __GNU_LIBRARY__ |
191 | 122 | ||
192 | /* Avoid depending on library functions or files | 123 | /* Avoid depending on library functions or files |
193 | whose names are inconsistent. */ | 124 | whose names are inconsistent. */ |
@@ -198,15 +129,6 @@ extern char *getenv (); | |||
198 | 129 | ||
199 | #endif /* not __GNU_LIBRARY__ */ | 130 | #endif /* not __GNU_LIBRARY__ */ |
200 | 131 | ||
201 | /* Handle permutation of arguments. */ | ||
202 | |||
203 | /* Describe the part of ARGV that contains non-options that have | ||
204 | been skipped. `first_nonopt' is the index in ARGV of the first of them; | ||
205 | `last_nonopt' is the index after the last of them. */ | ||
206 | |||
207 | static int first_nonopt; | ||
208 | static int last_nonopt; | ||
209 | |||
210 | #ifdef _LIBC | 132 | #ifdef _LIBC |
211 | /* Stored original parameters. | 133 | /* Stored original parameters. |
212 | XXX This is no good solution. We should rather copy the args so | 134 | XXX This is no good solution. We should rather copy the args so |
@@ -220,14 +142,11 @@ extern char **__libc_argv; | |||
220 | # ifdef USE_NONOPTION_FLAGS | 142 | # ifdef USE_NONOPTION_FLAGS |
221 | /* Defined in getopt_init.c */ | 143 | /* Defined in getopt_init.c */ |
222 | extern char *__getopt_nonoption_flags; | 144 | extern char *__getopt_nonoption_flags; |
223 | |||
224 | static int nonoption_flags_max_len; | ||
225 | static int nonoption_flags_len; | ||
226 | # endif | 145 | # endif |
227 | 146 | ||
228 | # ifdef USE_NONOPTION_FLAGS | 147 | # ifdef USE_NONOPTION_FLAGS |
229 | # define SWAP_FLAGS(ch1, ch2) \ | 148 | # define SWAP_FLAGS(ch1, ch2) \ |
230 | if (nonoption_flags_len > 0) \ | 149 | if (d->__nonoption_flags_len > 0) \ |
231 | { \ | 150 | { \ |
232 | char __tmp = __getopt_nonoption_flags[ch1]; \ | 151 | char __tmp = __getopt_nonoption_flags[ch1]; \ |
233 | __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ | 152 | __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ |
@@ -250,11 +169,11 @@ static int nonoption_flags_len; | |||
250 | the new indices of the non-options in ARGV after they are moved. */ | 169 | the new indices of the non-options in ARGV after they are moved. */ |
251 | 170 | ||
252 | static void | 171 | static void |
253 | exchange (char **argv) | 172 | exchange (char **argv, struct _getopt_data *d) |
254 | { | 173 | { |
255 | int bottom = first_nonopt; | 174 | int bottom = d->__first_nonopt; |
256 | int middle = last_nonopt; | 175 | int middle = d->__last_nonopt; |
257 | int top = optind; | 176 | int top = d->optind; |
258 | char *tem; | 177 | char *tem; |
259 | 178 | ||
260 | /* Exchange the shorter segment with the far end of the longer segment. | 179 | /* Exchange the shorter segment with the far end of the longer segment. |
@@ -266,19 +185,19 @@ exchange (char **argv) | |||
266 | /* First make sure the handling of the `__getopt_nonoption_flags' | 185 | /* First make sure the handling of the `__getopt_nonoption_flags' |
267 | string can work normally. Our top argument must be in the range | 186 | string can work normally. Our top argument must be in the range |
268 | of the string. */ | 187 | of the string. */ |
269 | if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) | 188 | if (d->__nonoption_flags_len > 0 && top >= d->__nonoption_flags_max_len) |
270 | { | 189 | { |
271 | /* We must extend the array. The user plays games with us and | 190 | /* We must extend the array. The user plays games with us and |
272 | presents new arguments. */ | 191 | presents new arguments. */ |
273 | char *new_str = malloc (top + 1); | 192 | char *new_str = malloc (top + 1); |
274 | if (new_str == NULL) | 193 | if (new_str == NULL) |
275 | nonoption_flags_len = nonoption_flags_max_len = 0; | 194 | d->__nonoption_flags_len = d->__nonoption_flags_max_len = 0; |
276 | else | 195 | else |
277 | { | 196 | { |
278 | memset (__mempcpy (new_str, __getopt_nonoption_flags, | 197 | memset (__mempcpy (new_str, __getopt_nonoption_flags, |
279 | nonoption_flags_max_len), | 198 | d->__nonoption_flags_max_len), |
280 | '\0', top + 1 - nonoption_flags_max_len); | 199 | '\0', top + 1 - d->__nonoption_flags_max_len); |
281 | nonoption_flags_max_len = top + 1; | 200 | d->__nonoption_flags_max_len = top + 1; |
282 | __getopt_nonoption_flags = new_str; | 201 | __getopt_nonoption_flags = new_str; |
283 | } | 202 | } |
284 | } | 203 | } |
@@ -324,70 +243,71 @@ exchange (char **argv) | |||
324 | 243 | ||
325 | /* Update records for the slots the non-options now occupy. */ | 244 | /* Update records for the slots the non-options now occupy. */ |
326 | 245 | ||
327 | first_nonopt += (optind - last_nonopt); | 246 | d->__first_nonopt += (d->optind - d->__last_nonopt); |
328 | last_nonopt = optind; | 247 | d->__last_nonopt = d->optind; |
329 | } | 248 | } |
330 | 249 | ||
331 | /* Initialize the internal data when the first call is made. */ | 250 | /* Initialize the internal data when the first call is made. */ |
332 | 251 | ||
333 | static const char * | 252 | static const char * |
334 | _getopt_initialize (int argc, char *const *argv, const char *optstring) | 253 | _getopt_initialize (int argc, char **argv, const char *optstring, |
254 | int posixly_correct, struct _getopt_data *d) | ||
335 | { | 255 | { |
336 | /* Start processing options with ARGV-element 1 (since ARGV-element 0 | 256 | /* Start processing options with ARGV-element 1 (since ARGV-element 0 |
337 | is the program name); the sequence of previously skipped | 257 | is the program name); the sequence of previously skipped |
338 | non-option ARGV-elements is empty. */ | 258 | non-option ARGV-elements is empty. */ |
339 | 259 | ||
340 | first_nonopt = last_nonopt = optind; | 260 | d->__first_nonopt = d->__last_nonopt = d->optind; |
341 | 261 | ||
342 | nextchar = NULL; | 262 | d->__nextchar = NULL; |
343 | 263 | ||
344 | posixly_correct = getenv ("POSIXLY_CORRECT"); | 264 | d->__posixly_correct = posixly_correct || !!getenv ("POSIXLY_CORRECT"); |
345 | 265 | ||
346 | /* Determine how to handle the ordering of options and nonoptions. */ | 266 | /* Determine how to handle the ordering of options and nonoptions. */ |
347 | 267 | ||
348 | if (optstring[0] == '-') | 268 | if (optstring[0] == '-') |
349 | { | 269 | { |
350 | ordering = RETURN_IN_ORDER; | 270 | d->__ordering = RETURN_IN_ORDER; |
351 | ++optstring; | 271 | ++optstring; |
352 | } | 272 | } |
353 | else if (optstring[0] == '+') | 273 | else if (optstring[0] == '+') |
354 | { | 274 | { |
355 | ordering = REQUIRE_ORDER; | 275 | d->__ordering = REQUIRE_ORDER; |
356 | ++optstring; | 276 | ++optstring; |
357 | } | 277 | } |
358 | else if (posixly_correct != NULL) | 278 | else if (d->__posixly_correct) |
359 | ordering = REQUIRE_ORDER; | 279 | d->__ordering = REQUIRE_ORDER; |
360 | else | 280 | else |
361 | ordering = PERMUTE; | 281 | d->__ordering = PERMUTE; |
362 | 282 | ||
363 | #if defined _LIBC && defined USE_NONOPTION_FLAGS | 283 | #if defined _LIBC && defined USE_NONOPTION_FLAGS |
364 | if (posixly_correct == NULL | 284 | if (!d->__posixly_correct |
365 | && argc == __libc_argc && argv == __libc_argv) | 285 | && argc == __libc_argc && argv == __libc_argv) |
366 | { | 286 | { |
367 | if (nonoption_flags_max_len == 0) | 287 | if (d->__nonoption_flags_max_len == 0) |
368 | { | 288 | { |
369 | if (__getopt_nonoption_flags == NULL | 289 | if (__getopt_nonoption_flags == NULL |
370 | || __getopt_nonoption_flags[0] == '\0') | 290 | || __getopt_nonoption_flags[0] == '\0') |
371 | nonoption_flags_max_len = -1; | 291 | d->__nonoption_flags_max_len = -1; |
372 | else | 292 | else |
373 | { | 293 | { |
374 | const char *orig_str = __getopt_nonoption_flags; | 294 | const char *orig_str = __getopt_nonoption_flags; |
375 | int len = nonoption_flags_max_len = strlen (orig_str); | 295 | int len = d->__nonoption_flags_max_len = strlen (orig_str); |
376 | if (nonoption_flags_max_len < argc) | 296 | if (d->__nonoption_flags_max_len < argc) |
377 | nonoption_flags_max_len = argc; | 297 | d->__nonoption_flags_max_len = argc; |
378 | __getopt_nonoption_flags = | 298 | __getopt_nonoption_flags = |
379 | (char *) malloc (nonoption_flags_max_len); | 299 | (char *) malloc (d->__nonoption_flags_max_len); |
380 | if (__getopt_nonoption_flags == NULL) | 300 | if (__getopt_nonoption_flags == NULL) |
381 | nonoption_flags_max_len = -1; | 301 | d->__nonoption_flags_max_len = -1; |
382 | else | 302 | else |
383 | memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), | 303 | memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), |
384 | '\0', nonoption_flags_max_len - len); | 304 | '\0', d->__nonoption_flags_max_len - len); |
385 | } | 305 | } |
386 | } | 306 | } |
387 | nonoption_flags_len = nonoption_flags_max_len; | 307 | d->__nonoption_flags_len = d->__nonoption_flags_max_len; |
388 | } | 308 | } |
389 | else | 309 | else |
390 | nonoption_flags_len = 0; | 310 | d->__nonoption_flags_len = 0; |
391 | #endif | 311 | #endif |
392 | 312 | ||
393 | return optstring; | 313 | return optstring; |
@@ -435,10 +355,6 @@ _getopt_initialize (int argc, char *const *argv, const char *optstring) | |||
435 | `flag' field is nonzero, the value of the option's `val' field | 355 | `flag' field is nonzero, the value of the option's `val' field |
436 | if the `flag' field is zero. | 356 | if the `flag' field is zero. |
437 | 357 | ||
438 | The elements of ARGV aren't really const, because we permute them. | ||
439 | But we pretend they're const in the prototype to be compatible | ||
440 | with other systems. | ||
441 | |||
442 | LONGOPTS is a vector of `struct option' terminated by an | 358 | LONGOPTS is a vector of `struct option' terminated by an |
443 | element containing a name which is zero. | 359 | element containing a name which is zero. |
444 | 360 | ||
@@ -447,28 +363,32 @@ _getopt_initialize (int argc, char *const *argv, const char *optstring) | |||
447 | recent call. | 363 | recent call. |
448 | 364 | ||
449 | If LONG_ONLY is nonzero, '-' as well as '--' can introduce | 365 | If LONG_ONLY is nonzero, '-' as well as '--' can introduce |
450 | long-named options. */ | 366 | long-named options. |
367 | |||
368 | If POSIXLY_CORRECT is nonzero, behave as if the POSIXLY_CORRECT | ||
369 | environment variable were set. */ | ||
451 | 370 | ||
452 | int | 371 | int |
453 | _getopt_internal (int argc, char *const *argv, | 372 | _getopt_internal_r (int argc, char **argv, const char *optstring, |
454 | const char *optstring, const struct option *longopts, | 373 | const struct option *longopts, int *longind, |
455 | int *longind, int long_only) | 374 | int long_only, int posixly_correct, struct _getopt_data *d) |
456 | { | 375 | { |
457 | int print_errors = opterr; | 376 | int print_errors = d->opterr; |
458 | if (optstring[0] == ':') | 377 | if (optstring[0] == ':') |
459 | print_errors = 0; | 378 | print_errors = 0; |
460 | 379 | ||
461 | if (argc < 1) | 380 | if (argc < 1) |
462 | return -1; | 381 | return -1; |
463 | 382 | ||
464 | optarg = NULL; | 383 | d->optarg = NULL; |
465 | 384 | ||
466 | if (optind == 0 || !__getopt_initialized) | 385 | if (d->optind == 0 || !d->__initialized) |
467 | { | 386 | { |
468 | if (optind == 0) | 387 | if (d->optind == 0) |
469 | optind = 1; /* Don't scan ARGV[0], the program name. */ | 388 | d->optind = 1; /* Don't scan ARGV[0], the program name. */ |
470 | optstring = _getopt_initialize (argc, argv, optstring); | 389 | optstring = _getopt_initialize (argc, argv, optstring, |
471 | __getopt_initialized = 1; | 390 | posixly_correct, d); |
391 | d->__initialized = 1; | ||
472 | } | 392 | } |
473 | 393 | ||
474 | /* Test whether ARGV[optind] points to a non-option argument. | 394 | /* Test whether ARGV[optind] points to a non-option argument. |
@@ -476,40 +396,41 @@ _getopt_internal (int argc, char *const *argv, | |||
476 | from the shell indicating it is not an option. The later information | 396 | from the shell indicating it is not an option. The later information |
477 | is only used when the used in the GNU libc. */ | 397 | is only used when the used in the GNU libc. */ |
478 | #if defined _LIBC && defined USE_NONOPTION_FLAGS | 398 | #if defined _LIBC && defined USE_NONOPTION_FLAGS |
479 | # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ | 399 | # define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0' \ |
480 | || (optind < nonoption_flags_len \ | 400 | || (d->optind < d->__nonoption_flags_len \ |
481 | && __getopt_nonoption_flags[optind] == '1')) | 401 | && __getopt_nonoption_flags[d->optind] == '1')) |
482 | #else | 402 | #else |
483 | # define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') | 403 | # define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0') |
484 | #endif | 404 | #endif |
485 | 405 | ||
486 | if (nextchar == NULL || *nextchar == '\0') | 406 | if (d->__nextchar == NULL || *d->__nextchar == '\0') |
487 | { | 407 | { |
488 | /* Advance to the next ARGV-element. */ | 408 | /* Advance to the next ARGV-element. */ |
489 | 409 | ||
490 | /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been | 410 | /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been |
491 | moved back by the user (who may also have changed the arguments). */ | 411 | moved back by the user (who may also have changed the arguments). */ |
492 | if (last_nonopt > optind) | 412 | if (d->__last_nonopt > d->optind) |
493 | last_nonopt = optind; | 413 | d->__last_nonopt = d->optind; |
494 | if (first_nonopt > optind) | 414 | if (d->__first_nonopt > d->optind) |
495 | first_nonopt = optind; | 415 | d->__first_nonopt = d->optind; |
496 | 416 | ||
497 | if (ordering == PERMUTE) | 417 | if (d->__ordering == PERMUTE) |
498 | { | 418 | { |
499 | /* If we have just processed some options following some non-options, | 419 | /* If we have just processed some options following some non-options, |
500 | exchange them so that the options come first. */ | 420 | exchange them so that the options come first. */ |
501 | 421 | ||
502 | if (first_nonopt != last_nonopt && last_nonopt != optind) | 422 | if (d->__first_nonopt != d->__last_nonopt |
503 | exchange ((char **) argv); | 423 | && d->__last_nonopt != d->optind) |
504 | else if (last_nonopt != optind) | 424 | exchange ((char **) argv, d); |
505 | first_nonopt = optind; | 425 | else if (d->__last_nonopt != d->optind) |
426 | d->__first_nonopt = d->optind; | ||
506 | 427 | ||
507 | /* Skip any additional non-options | 428 | /* Skip any additional non-options |
508 | and extend the range of non-options previously skipped. */ | 429 | and extend the range of non-options previously skipped. */ |
509 | 430 | ||
510 | while (optind < argc && NONOPTION_P) | 431 | while (d->optind < argc && NONOPTION_P) |
511 | optind++; | 432 | d->optind++; |
512 | last_nonopt = optind; | 433 | d->__last_nonopt = d->optind; |
513 | } | 434 | } |
514 | 435 | ||
515 | /* The special ARGV-element `--' means premature end of options. | 436 | /* The special ARGV-element `--' means premature end of options. |
@@ -517,28 +438,29 @@ _getopt_internal (int argc, char *const *argv, | |||
517 | then exchange with previous non-options as if it were an option, | 438 | then exchange with previous non-options as if it were an option, |
518 | then skip everything else like a non-option. */ | 439 | then skip everything else like a non-option. */ |
519 | 440 | ||
520 | if (optind != argc && !strcmp (argv[optind], "--")) | 441 | if (d->optind != argc && !strcmp (argv[d->optind], "--")) |
521 | { | 442 | { |
522 | optind++; | 443 | d->optind++; |
523 | 444 | ||
524 | if (first_nonopt != last_nonopt && last_nonopt != optind) | 445 | if (d->__first_nonopt != d->__last_nonopt |
525 | exchange ((char **) argv); | 446 | && d->__last_nonopt != d->optind) |
526 | else if (first_nonopt == last_nonopt) | 447 | exchange ((char **) argv, d); |
527 | first_nonopt = optind; | 448 | else if (d->__first_nonopt == d->__last_nonopt) |
528 | last_nonopt = argc; | 449 | d->__first_nonopt = d->optind; |
450 | d->__last_nonopt = argc; | ||
529 | 451 | ||
530 | optind = argc; | 452 | d->optind = argc; |
531 | } | 453 | } |
532 | 454 | ||
533 | /* If we have done all the ARGV-elements, stop the scan | 455 | /* If we have done all the ARGV-elements, stop the scan |
534 | and back over any non-options that we skipped and permuted. */ | 456 | and back over any non-options that we skipped and permuted. */ |
535 | 457 | ||
536 | if (optind == argc) | 458 | if (d->optind == argc) |
537 | { | 459 | { |
538 | /* Set the next-arg-index to point at the non-options | 460 | /* Set the next-arg-index to point at the non-options |
539 | that we previously skipped, so the caller will digest them. */ | 461 | that we previously skipped, so the caller will digest them. */ |
540 | if (first_nonopt != last_nonopt) | 462 | if (d->__first_nonopt != d->__last_nonopt) |
541 | optind = first_nonopt; | 463 | d->optind = d->__first_nonopt; |
542 | return -1; | 464 | return -1; |
543 | } | 465 | } |
544 | 466 | ||
@@ -547,17 +469,17 @@ _getopt_internal (int argc, char *const *argv, | |||
547 | 469 | ||
548 | if (NONOPTION_P) | 470 | if (NONOPTION_P) |
549 | { | 471 | { |
550 | if (ordering == REQUIRE_ORDER) | 472 | if (d->__ordering == REQUIRE_ORDER) |
551 | return -1; | 473 | return -1; |
552 | optarg = argv[optind++]; | 474 | d->optarg = argv[d->optind++]; |
553 | return 1; | 475 | return 1; |
554 | } | 476 | } |
555 | 477 | ||
556 | /* We have found another option-ARGV-element. | 478 | /* We have found another option-ARGV-element. |
557 | Skip the initial punctuation. */ | 479 | Skip the initial punctuation. */ |
558 | 480 | ||
559 | nextchar = (argv[optind] + 1 | 481 | d->__nextchar = (argv[d->optind] + 1 |
560 | + (longopts != NULL && argv[optind][1] == '-')); | 482 | + (longopts != NULL && argv[d->optind][1] == '-')); |
561 | } | 483 | } |
562 | 484 | ||
563 | /* Decode the current option-ARGV-element. */ | 485 | /* Decode the current option-ARGV-element. */ |
@@ -576,9 +498,9 @@ _getopt_internal (int argc, char *const *argv, | |||
576 | This distinction seems to be the most useful approach. */ | 498 | This distinction seems to be the most useful approach. */ |
577 | 499 | ||
578 | if (longopts != NULL | 500 | if (longopts != NULL |
579 | && (argv[optind][1] == '-' | 501 | && (argv[d->optind][1] == '-' |
580 | || (long_only | 502 | || (long_only && (argv[d->optind][2] |
581 | && (argv[optind][2] || !strchr (optstring, argv[optind][1]))))) | 503 | || !strchr (optstring, argv[d->optind][1]))))) |
582 | { | 504 | { |
583 | char *nameend; | 505 | char *nameend; |
584 | const struct option *p; | 506 | const struct option *p; |
@@ -588,15 +510,15 @@ _getopt_internal (int argc, char *const *argv, | |||
588 | int indfound = -1; | 510 | int indfound = -1; |
589 | int option_index; | 511 | int option_index; |
590 | 512 | ||
591 | for (nameend = nextchar; *nameend && *nameend != '='; nameend++) | 513 | for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++) |
592 | /* Do nothing. */ ; | 514 | /* Do nothing. */ ; |
593 | 515 | ||
594 | /* Test all long options for either exact match | 516 | /* Test all long options for either exact match |
595 | or abbreviated matches. */ | 517 | or abbreviated matches. */ |
596 | for (p = longopts, option_index = 0; p->name; p++, option_index++) | 518 | for (p = longopts, option_index = 0; p->name; p++, option_index++) |
597 | if (!strncmp (p->name, nextchar, nameend - nextchar)) | 519 | if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar)) |
598 | { | 520 | { |
599 | if ((unsigned int) (nameend - nextchar) | 521 | if ((unsigned int) (nameend - d->__nextchar) |
600 | == (unsigned int) strlen (p->name)) | 522 | == (unsigned int) strlen (p->name)) |
601 | { | 523 | { |
602 | /* Exact match found. */ | 524 | /* Exact match found. */ |
@@ -627,37 +549,44 @@ _getopt_internal (int argc, char *const *argv, | |||
627 | char *buf; | 549 | char *buf; |
628 | 550 | ||
629 | if (__asprintf (&buf, _("%s: option `%s' is ambiguous\n"), | 551 | if (__asprintf (&buf, _("%s: option `%s' is ambiguous\n"), |
630 | argv[0], argv[optind]) >= 0) | 552 | argv[0], argv[d->optind]) >= 0) |
631 | { | 553 | { |
554 | _IO_flockfile (stderr); | ||
555 | |||
556 | int old_flags2 = ((_IO_FILE *) stderr)->_flags2; | ||
557 | ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; | ||
632 | 558 | ||
633 | if (_IO_fwide (stderr, 0) > 0) | 559 | if (_IO_fwide (stderr, 0) > 0) |
634 | __fwprintf (stderr, L"%s", buf); | 560 | __fwprintf (stderr, L"%s", buf); |
635 | else | 561 | else |
636 | fputs (buf, stderr); | 562 | fputs (buf, stderr); |
637 | 563 | ||
564 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; | ||
565 | _IO_funlockfile (stderr); | ||
566 | |||
638 | free (buf); | 567 | free (buf); |
639 | } | 568 | } |
640 | #else | 569 | #else |
641 | fprintf (stderr, _("%s: option `%s' is ambiguous\n"), | 570 | fprintf (stderr, _("%s: option `%s' is ambiguous\n"), |
642 | argv[0], argv[optind]); | 571 | argv[0], argv[d->optind]); |
643 | #endif | 572 | #endif |
644 | } | 573 | } |
645 | nextchar += strlen (nextchar); | 574 | d->__nextchar += strlen (d->__nextchar); |
646 | optind++; | 575 | d->optind++; |
647 | optopt = 0; | 576 | d->optopt = 0; |
648 | return '?'; | 577 | return '?'; |
649 | } | 578 | } |
650 | 579 | ||
651 | if (pfound != NULL) | 580 | if (pfound != NULL) |
652 | { | 581 | { |
653 | option_index = indfound; | 582 | option_index = indfound; |
654 | optind++; | 583 | d->optind++; |
655 | if (*nameend) | 584 | if (*nameend) |
656 | { | 585 | { |
657 | /* Don't test has_arg with >, because some C compilers don't | 586 | /* Don't test has_arg with >, because some C compilers don't |
658 | allow it to be used on enums. */ | 587 | allow it to be used on enums. */ |
659 | if (pfound->has_arg) | 588 | if (pfound->has_arg) |
660 | optarg = nameend + 1; | 589 | d->optarg = nameend + 1; |
661 | else | 590 | else |
662 | { | 591 | { |
663 | if (print_errors) | 592 | if (print_errors) |
@@ -667,7 +596,7 @@ _getopt_internal (int argc, char *const *argv, | |||
667 | int n; | 596 | int n; |
668 | #endif | 597 | #endif |
669 | 598 | ||
670 | if (argv[optind - 1][1] == '-') | 599 | if (argv[d->optind - 1][1] == '-') |
671 | { | 600 | { |
672 | /* --option */ | 601 | /* --option */ |
673 | #if defined _LIBC && defined USE_IN_LIBIO | 602 | #if defined _LIBC && defined USE_IN_LIBIO |
@@ -686,38 +615,48 @@ _getopt_internal (int argc, char *const *argv, | |||
686 | #if defined _LIBC && defined USE_IN_LIBIO | 615 | #if defined _LIBC && defined USE_IN_LIBIO |
687 | n = __asprintf (&buf, _("\ | 616 | n = __asprintf (&buf, _("\ |
688 | %s: option `%c%s' doesn't allow an argument\n"), | 617 | %s: option `%c%s' doesn't allow an argument\n"), |
689 | argv[0], argv[optind - 1][0], | 618 | argv[0], argv[d->optind - 1][0], |
690 | pfound->name); | 619 | pfound->name); |
691 | #else | 620 | #else |
692 | fprintf (stderr, _("\ | 621 | fprintf (stderr, _("\ |
693 | %s: option `%c%s' doesn't allow an argument\n"), | 622 | %s: option `%c%s' doesn't allow an argument\n"), |
694 | argv[0], argv[optind - 1][0], pfound->name); | 623 | argv[0], argv[d->optind - 1][0], |
624 | pfound->name); | ||
695 | #endif | 625 | #endif |
696 | } | 626 | } |
697 | 627 | ||
698 | #if defined _LIBC && defined USE_IN_LIBIO | 628 | #if defined _LIBC && defined USE_IN_LIBIO |
699 | if (n >= 0) | 629 | if (n >= 0) |
700 | { | 630 | { |
631 | _IO_flockfile (stderr); | ||
632 | |||
633 | int old_flags2 = ((_IO_FILE *) stderr)->_flags2; | ||
634 | ((_IO_FILE *) stderr)->_flags2 | ||
635 | |= _IO_FLAGS2_NOTCANCEL; | ||
636 | |||
701 | if (_IO_fwide (stderr, 0) > 0) | 637 | if (_IO_fwide (stderr, 0) > 0) |
702 | __fwprintf (stderr, L"%s", buf); | 638 | __fwprintf (stderr, L"%s", buf); |
703 | else | 639 | else |
704 | fputs (buf, stderr); | 640 | fputs (buf, stderr); |
705 | 641 | ||
642 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; | ||
643 | _IO_funlockfile (stderr); | ||
644 | |||
706 | free (buf); | 645 | free (buf); |
707 | } | 646 | } |
708 | #endif | 647 | #endif |
709 | } | 648 | } |
710 | 649 | ||
711 | nextchar += strlen (nextchar); | 650 | d->__nextchar += strlen (d->__nextchar); |
712 | 651 | ||
713 | optopt = pfound->val; | 652 | d->optopt = pfound->val; |
714 | return '?'; | 653 | return '?'; |
715 | } | 654 | } |
716 | } | 655 | } |
717 | else if (pfound->has_arg == 1) | 656 | else if (pfound->has_arg == 1) |
718 | { | 657 | { |
719 | if (optind < argc) | 658 | if (d->optind < argc) |
720 | optarg = argv[optind++]; | 659 | d->optarg = argv[d->optind++]; |
721 | else | 660 | else |
722 | { | 661 | { |
723 | if (print_errors) | 662 | if (print_errors) |
@@ -727,27 +666,36 @@ _getopt_internal (int argc, char *const *argv, | |||
727 | 666 | ||
728 | if (__asprintf (&buf, _("\ | 667 | if (__asprintf (&buf, _("\ |
729 | %s: option `%s' requires an argument\n"), | 668 | %s: option `%s' requires an argument\n"), |
730 | argv[0], argv[optind - 1]) >= 0) | 669 | argv[0], argv[d->optind - 1]) >= 0) |
731 | { | 670 | { |
671 | _IO_flockfile (stderr); | ||
672 | |||
673 | int old_flags2 = ((_IO_FILE *) stderr)->_flags2; | ||
674 | ((_IO_FILE *) stderr)->_flags2 | ||
675 | |= _IO_FLAGS2_NOTCANCEL; | ||
676 | |||
732 | if (_IO_fwide (stderr, 0) > 0) | 677 | if (_IO_fwide (stderr, 0) > 0) |
733 | __fwprintf (stderr, L"%s", buf); | 678 | __fwprintf (stderr, L"%s", buf); |
734 | else | 679 | else |
735 | fputs (buf, stderr); | 680 | fputs (buf, stderr); |
736 | 681 | ||
682 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; | ||
683 | _IO_funlockfile (stderr); | ||
684 | |||
737 | free (buf); | 685 | free (buf); |
738 | } | 686 | } |
739 | #else | 687 | #else |
740 | fprintf (stderr, | 688 | fprintf (stderr, |
741 | _("%s: option `%s' requires an argument\n"), | 689 | _("%s: option `%s' requires an argument\n"), |
742 | argv[0], argv[optind - 1]); | 690 | argv[0], argv[d->optind - 1]); |
743 | #endif | 691 | #endif |
744 | } | 692 | } |
745 | nextchar += strlen (nextchar); | 693 | d->__nextchar += strlen (d->__nextchar); |
746 | optopt = pfound->val; | 694 | d->optopt = pfound->val; |
747 | return optstring[0] == ':' ? ':' : '?'; | 695 | return optstring[0] == ':' ? ':' : '?'; |
748 | } | 696 | } |
749 | } | 697 | } |
750 | nextchar += strlen (nextchar); | 698 | d->__nextchar += strlen (d->__nextchar); |
751 | if (longind != NULL) | 699 | if (longind != NULL) |
752 | *longind = option_index; | 700 | *longind = option_index; |
753 | if (pfound->flag) | 701 | if (pfound->flag) |
@@ -762,8 +710,8 @@ _getopt_internal (int argc, char *const *argv, | |||
762 | or the option starts with '--' or is not a valid short | 710 | or the option starts with '--' or is not a valid short |
763 | option, then it's an error. | 711 | option, then it's an error. |
764 | Otherwise interpret it as a short option. */ | 712 | Otherwise interpret it as a short option. */ |
765 | if (!long_only || argv[optind][1] == '-' | 713 | if (!long_only || argv[d->optind][1] == '-' |
766 | || strchr (optstring, *nextchar) == NULL) | 714 | || strchr (optstring, *d->__nextchar) == NULL) |
767 | { | 715 | { |
768 | if (print_errors) | 716 | if (print_errors) |
769 | { | 717 | { |
@@ -772,15 +720,15 @@ _getopt_internal (int argc, char *const *argv, | |||
772 | int n; | 720 | int n; |
773 | #endif | 721 | #endif |
774 | 722 | ||
775 | if (argv[optind][1] == '-') | 723 | if (argv[d->optind][1] == '-') |
776 | { | 724 | { |
777 | /* --option */ | 725 | /* --option */ |
778 | #if defined _LIBC && defined USE_IN_LIBIO | 726 | #if defined _LIBC && defined USE_IN_LIBIO |
779 | n = __asprintf (&buf, _("%s: unrecognized option `--%s'\n"), | 727 | n = __asprintf (&buf, _("%s: unrecognized option `--%s'\n"), |
780 | argv[0], nextchar); | 728 | argv[0], d->__nextchar); |
781 | #else | 729 | #else |
782 | fprintf (stderr, _("%s: unrecognized option `--%s'\n"), | 730 | fprintf (stderr, _("%s: unrecognized option `--%s'\n"), |
783 | argv[0], nextchar); | 731 | argv[0], d->__nextchar); |
784 | #endif | 732 | #endif |
785 | } | 733 | } |
786 | else | 734 | else |
@@ -788,28 +736,36 @@ _getopt_internal (int argc, char *const *argv, | |||
788 | /* +option or -option */ | 736 | /* +option or -option */ |
789 | #if defined _LIBC && defined USE_IN_LIBIO | 737 | #if defined _LIBC && defined USE_IN_LIBIO |
790 | n = __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"), | 738 | n = __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"), |
791 | argv[0], argv[optind][0], nextchar); | 739 | argv[0], argv[d->optind][0], d->__nextchar); |
792 | #else | 740 | #else |
793 | fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), | 741 | fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), |
794 | argv[0], argv[optind][0], nextchar); | 742 | argv[0], argv[d->optind][0], d->__nextchar); |
795 | #endif | 743 | #endif |
796 | } | 744 | } |
797 | 745 | ||
798 | #if defined _LIBC && defined USE_IN_LIBIO | 746 | #if defined _LIBC && defined USE_IN_LIBIO |
799 | if (n >= 0) | 747 | if (n >= 0) |
800 | { | 748 | { |
749 | _IO_flockfile (stderr); | ||
750 | |||
751 | int old_flags2 = ((_IO_FILE *) stderr)->_flags2; | ||
752 | ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; | ||
753 | |||
801 | if (_IO_fwide (stderr, 0) > 0) | 754 | if (_IO_fwide (stderr, 0) > 0) |
802 | __fwprintf (stderr, L"%s", buf); | 755 | __fwprintf (stderr, L"%s", buf); |
803 | else | 756 | else |
804 | fputs (buf, stderr); | 757 | fputs (buf, stderr); |
805 | 758 | ||
759 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; | ||
760 | _IO_funlockfile (stderr); | ||
761 | |||
806 | free (buf); | 762 | free (buf); |
807 | } | 763 | } |
808 | #endif | 764 | #endif |
809 | } | 765 | } |
810 | nextchar = (char *) ""; | 766 | d->__nextchar = (char *) ""; |
811 | optind++; | 767 | d->optind++; |
812 | optopt = 0; | 768 | d->optopt = 0; |
813 | return '?'; | 769 | return '?'; |
814 | } | 770 | } |
815 | } | 771 | } |
@@ -817,12 +773,12 @@ _getopt_internal (int argc, char *const *argv, | |||
817 | /* Look at and handle the next short option-character. */ | 773 | /* Look at and handle the next short option-character. */ |
818 | 774 | ||
819 | { | 775 | { |
820 | char c = *nextchar++; | 776 | char c = *d->__nextchar++; |
821 | char *temp = strchr (optstring, c); | 777 | char *temp = strchr (optstring, c); |
822 | 778 | ||
823 | /* Increment `optind' when we start to process its last character. */ | 779 | /* Increment `optind' when we start to process its last character. */ |
824 | if (*nextchar == '\0') | 780 | if (*d->__nextchar == '\0') |
825 | ++optind; | 781 | ++d->optind; |
826 | 782 | ||
827 | if (temp == NULL || c == ':') | 783 | if (temp == NULL || c == ':') |
828 | { | 784 | { |
@@ -833,7 +789,7 @@ _getopt_internal (int argc, char *const *argv, | |||
833 | int n; | 789 | int n; |
834 | #endif | 790 | #endif |
835 | 791 | ||
836 | if (posixly_correct) | 792 | if (d->__posixly_correct) |
837 | { | 793 | { |
838 | /* 1003.2 specifies the format of this message. */ | 794 | /* 1003.2 specifies the format of this message. */ |
839 | #if defined _LIBC && defined USE_IN_LIBIO | 795 | #if defined _LIBC && defined USE_IN_LIBIO |
@@ -856,16 +812,24 @@ _getopt_internal (int argc, char *const *argv, | |||
856 | #if defined _LIBC && defined USE_IN_LIBIO | 812 | #if defined _LIBC && defined USE_IN_LIBIO |
857 | if (n >= 0) | 813 | if (n >= 0) |
858 | { | 814 | { |
815 | _IO_flockfile (stderr); | ||
816 | |||
817 | int old_flags2 = ((_IO_FILE *) stderr)->_flags2; | ||
818 | ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; | ||
819 | |||
859 | if (_IO_fwide (stderr, 0) > 0) | 820 | if (_IO_fwide (stderr, 0) > 0) |
860 | __fwprintf (stderr, L"%s", buf); | 821 | __fwprintf (stderr, L"%s", buf); |
861 | else | 822 | else |
862 | fputs (buf, stderr); | 823 | fputs (buf, stderr); |
863 | 824 | ||
825 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; | ||
826 | _IO_funlockfile (stderr); | ||
827 | |||
864 | free (buf); | 828 | free (buf); |
865 | } | 829 | } |
866 | #endif | 830 | #endif |
867 | } | 831 | } |
868 | optopt = c; | 832 | d->optopt = c; |
869 | return '?'; | 833 | return '?'; |
870 | } | 834 | } |
871 | /* Convenience. Treat POSIX -W foo same as long option --foo */ | 835 | /* Convenience. Treat POSIX -W foo same as long option --foo */ |
@@ -880,14 +844,14 @@ _getopt_internal (int argc, char *const *argv, | |||
880 | int option_index; | 844 | int option_index; |
881 | 845 | ||
882 | /* This is an option that requires an argument. */ | 846 | /* This is an option that requires an argument. */ |
883 | if (*nextchar != '\0') | 847 | if (*d->__nextchar != '\0') |
884 | { | 848 | { |
885 | optarg = nextchar; | 849 | d->optarg = d->__nextchar; |
886 | /* If we end this ARGV-element by taking the rest as an arg, | 850 | /* If we end this ARGV-element by taking the rest as an arg, |
887 | we must advance to the next element now. */ | 851 | we must advance to the next element now. */ |
888 | optind++; | 852 | d->optind++; |
889 | } | 853 | } |
890 | else if (optind == argc) | 854 | else if (d->optind == argc) |
891 | { | 855 | { |
892 | if (print_errors) | 856 | if (print_errors) |
893 | { | 857 | { |
@@ -899,11 +863,19 @@ _getopt_internal (int argc, char *const *argv, | |||
899 | _("%s: option requires an argument -- %c\n"), | 863 | _("%s: option requires an argument -- %c\n"), |
900 | argv[0], c) >= 0) | 864 | argv[0], c) >= 0) |
901 | { | 865 | { |
866 | _IO_flockfile (stderr); | ||
867 | |||
868 | int old_flags2 = ((_IO_FILE *) stderr)->_flags2; | ||
869 | ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; | ||
870 | |||
902 | if (_IO_fwide (stderr, 0) > 0) | 871 | if (_IO_fwide (stderr, 0) > 0) |
903 | __fwprintf (stderr, L"%s", buf); | 872 | __fwprintf (stderr, L"%s", buf); |
904 | else | 873 | else |
905 | fputs (buf, stderr); | 874 | fputs (buf, stderr); |
906 | 875 | ||
876 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; | ||
877 | _IO_funlockfile (stderr); | ||
878 | |||
907 | free (buf); | 879 | free (buf); |
908 | } | 880 | } |
909 | #else | 881 | #else |
@@ -911,7 +883,7 @@ _getopt_internal (int argc, char *const *argv, | |||
911 | argv[0], c); | 883 | argv[0], c); |
912 | #endif | 884 | #endif |
913 | } | 885 | } |
914 | optopt = c; | 886 | d->optopt = c; |
915 | if (optstring[0] == ':') | 887 | if (optstring[0] == ':') |
916 | c = ':'; | 888 | c = ':'; |
917 | else | 889 | else |
@@ -919,22 +891,23 @@ _getopt_internal (int argc, char *const *argv, | |||
919 | return c; | 891 | return c; |
920 | } | 892 | } |
921 | else | 893 | else |
922 | /* We already incremented `optind' once; | 894 | /* We already incremented `d->optind' once; |
923 | increment it again when taking next ARGV-elt as argument. */ | 895 | increment it again when taking next ARGV-elt as argument. */ |
924 | optarg = argv[optind++]; | 896 | d->optarg = argv[d->optind++]; |
925 | 897 | ||
926 | /* optarg is now the argument, see if it's in the | 898 | /* optarg is now the argument, see if it's in the |
927 | table of longopts. */ | 899 | table of longopts. */ |
928 | 900 | ||
929 | for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) | 901 | for (d->__nextchar = nameend = d->optarg; *nameend && *nameend != '='; |
902 | nameend++) | ||
930 | /* Do nothing. */ ; | 903 | /* Do nothing. */ ; |
931 | 904 | ||
932 | /* Test all long options for either exact match | 905 | /* Test all long options for either exact match |
933 | or abbreviated matches. */ | 906 | or abbreviated matches. */ |
934 | for (p = longopts, option_index = 0; p->name; p++, option_index++) | 907 | for (p = longopts, option_index = 0; p->name; p++, option_index++) |
935 | if (!strncmp (p->name, nextchar, nameend - nextchar)) | 908 | if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar)) |
936 | { | 909 | { |
937 | if ((unsigned int) (nameend - nextchar) == strlen (p->name)) | 910 | if ((unsigned int) (nameend - d->__nextchar) == strlen (p->name)) |
938 | { | 911 | { |
939 | /* Exact match found. */ | 912 | /* Exact match found. */ |
940 | pfound = p; | 913 | pfound = p; |
@@ -960,22 +933,30 @@ _getopt_internal (int argc, char *const *argv, | |||
960 | char *buf; | 933 | char *buf; |
961 | 934 | ||
962 | if (__asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"), | 935 | if (__asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"), |
963 | argv[0], argv[optind]) >= 0) | 936 | argv[0], argv[d->optind]) >= 0) |
964 | { | 937 | { |
938 | _IO_flockfile (stderr); | ||
939 | |||
940 | int old_flags2 = ((_IO_FILE *) stderr)->_flags2; | ||
941 | ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; | ||
942 | |||
965 | if (_IO_fwide (stderr, 0) > 0) | 943 | if (_IO_fwide (stderr, 0) > 0) |
966 | __fwprintf (stderr, L"%s", buf); | 944 | __fwprintf (stderr, L"%s", buf); |
967 | else | 945 | else |
968 | fputs (buf, stderr); | 946 | fputs (buf, stderr); |
969 | 947 | ||
948 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; | ||
949 | _IO_funlockfile (stderr); | ||
950 | |||
970 | free (buf); | 951 | free (buf); |
971 | } | 952 | } |
972 | #else | 953 | #else |
973 | fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), | 954 | fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), |
974 | argv[0], argv[optind]); | 955 | argv[0], argv[d->optind]); |
975 | #endif | 956 | #endif |
976 | } | 957 | } |
977 | nextchar += strlen (nextchar); | 958 | d->__nextchar += strlen (d->__nextchar); |
978 | optind++; | 959 | d->optind++; |
979 | return '?'; | 960 | return '?'; |
980 | } | 961 | } |
981 | if (pfound != NULL) | 962 | if (pfound != NULL) |
@@ -986,7 +967,7 @@ _getopt_internal (int argc, char *const *argv, | |||
986 | /* Don't test has_arg with >, because some C compilers don't | 967 | /* Don't test has_arg with >, because some C compilers don't |
987 | allow it to be used on enums. */ | 968 | allow it to be used on enums. */ |
988 | if (pfound->has_arg) | 969 | if (pfound->has_arg) |
989 | optarg = nameend + 1; | 970 | d->optarg = nameend + 1; |
990 | else | 971 | else |
991 | { | 972 | { |
992 | if (print_errors) | 973 | if (print_errors) |
@@ -998,11 +979,20 @@ _getopt_internal (int argc, char *const *argv, | |||
998 | %s: option `-W %s' doesn't allow an argument\n"), | 979 | %s: option `-W %s' doesn't allow an argument\n"), |
999 | argv[0], pfound->name) >= 0) | 980 | argv[0], pfound->name) >= 0) |
1000 | { | 981 | { |
982 | _IO_flockfile (stderr); | ||
983 | |||
984 | int old_flags2 = ((_IO_FILE *) stderr)->_flags2; | ||
985 | ((_IO_FILE *) stderr)->_flags2 | ||
986 | |= _IO_FLAGS2_NOTCANCEL; | ||
987 | |||
1001 | if (_IO_fwide (stderr, 0) > 0) | 988 | if (_IO_fwide (stderr, 0) > 0) |
1002 | __fwprintf (stderr, L"%s", buf); | 989 | __fwprintf (stderr, L"%s", buf); |
1003 | else | 990 | else |
1004 | fputs (buf, stderr); | 991 | fputs (buf, stderr); |
1005 | 992 | ||
993 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; | ||
994 | _IO_funlockfile (stderr); | ||
995 | |||
1006 | free (buf); | 996 | free (buf); |
1007 | } | 997 | } |
1008 | #else | 998 | #else |
@@ -1012,14 +1002,14 @@ _getopt_internal (int argc, char *const *argv, | |||
1012 | #endif | 1002 | #endif |
1013 | } | 1003 | } |
1014 | 1004 | ||
1015 | nextchar += strlen (nextchar); | 1005 | d->__nextchar += strlen (d->__nextchar); |
1016 | return '?'; | 1006 | return '?'; |
1017 | } | 1007 | } |
1018 | } | 1008 | } |
1019 | else if (pfound->has_arg == 1) | 1009 | else if (pfound->has_arg == 1) |
1020 | { | 1010 | { |
1021 | if (optind < argc) | 1011 | if (d->optind < argc) |
1022 | optarg = argv[optind++]; | 1012 | d->optarg = argv[d->optind++]; |
1023 | else | 1013 | else |
1024 | { | 1014 | { |
1025 | if (print_errors) | 1015 | if (print_errors) |
@@ -1029,26 +1019,35 @@ _getopt_internal (int argc, char *const *argv, | |||
1029 | 1019 | ||
1030 | if (__asprintf (&buf, _("\ | 1020 | if (__asprintf (&buf, _("\ |
1031 | %s: option `%s' requires an argument\n"), | 1021 | %s: option `%s' requires an argument\n"), |
1032 | argv[0], argv[optind - 1]) >= 0) | 1022 | argv[0], argv[d->optind - 1]) >= 0) |
1033 | { | 1023 | { |
1024 | _IO_flockfile (stderr); | ||
1025 | |||
1026 | int old_flags2 = ((_IO_FILE *) stderr)->_flags2; | ||
1027 | ((_IO_FILE *) stderr)->_flags2 | ||
1028 | |= _IO_FLAGS2_NOTCANCEL; | ||
1029 | |||
1034 | if (_IO_fwide (stderr, 0) > 0) | 1030 | if (_IO_fwide (stderr, 0) > 0) |
1035 | __fwprintf (stderr, L"%s", buf); | 1031 | __fwprintf (stderr, L"%s", buf); |
1036 | else | 1032 | else |
1037 | fputs (buf, stderr); | 1033 | fputs (buf, stderr); |
1038 | 1034 | ||
1035 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; | ||
1036 | _IO_funlockfile (stderr); | ||
1037 | |||
1039 | free (buf); | 1038 | free (buf); |
1040 | } | 1039 | } |
1041 | #else | 1040 | #else |
1042 | fprintf (stderr, | 1041 | fprintf (stderr, |
1043 | _("%s: option `%s' requires an argument\n"), | 1042 | _("%s: option `%s' requires an argument\n"), |
1044 | argv[0], argv[optind - 1]); | 1043 | argv[0], argv[d->optind - 1]); |
1045 | #endif | 1044 | #endif |
1046 | } | 1045 | } |
1047 | nextchar += strlen (nextchar); | 1046 | d->__nextchar += strlen (d->__nextchar); |
1048 | return optstring[0] == ':' ? ':' : '?'; | 1047 | return optstring[0] == ':' ? ':' : '?'; |
1049 | } | 1048 | } |
1050 | } | 1049 | } |
1051 | nextchar += strlen (nextchar); | 1050 | d->__nextchar += strlen (d->__nextchar); |
1052 | if (longind != NULL) | 1051 | if (longind != NULL) |
1053 | *longind = option_index; | 1052 | *longind = option_index; |
1054 | if (pfound->flag) | 1053 | if (pfound->flag) |
@@ -1058,7 +1057,7 @@ _getopt_internal (int argc, char *const *argv, | |||
1058 | } | 1057 | } |
1059 | return pfound->val; | 1058 | return pfound->val; |
1060 | } | 1059 | } |
1061 | nextchar = NULL; | 1060 | d->__nextchar = NULL; |
1062 | return 'W'; /* Let the application handle it. */ | 1061 | return 'W'; /* Let the application handle it. */ |
1063 | } | 1062 | } |
1064 | if (temp[1] == ':') | 1063 | if (temp[1] == ':') |
@@ -1066,26 +1065,26 @@ _getopt_internal (int argc, char *const *argv, | |||
1066 | if (temp[2] == ':') | 1065 | if (temp[2] == ':') |
1067 | { | 1066 | { |
1068 | /* This is an option that accepts an argument optionally. */ | 1067 | /* This is an option that accepts an argument optionally. */ |
1069 | if (*nextchar != '\0') | 1068 | if (*d->__nextchar != '\0') |
1070 | { | 1069 | { |
1071 | optarg = nextchar; | 1070 | d->optarg = d->__nextchar; |
1072 | optind++; | 1071 | d->optind++; |
1073 | } | 1072 | } |
1074 | else | 1073 | else |
1075 | optarg = NULL; | 1074 | d->optarg = NULL; |
1076 | nextchar = NULL; | 1075 | d->__nextchar = NULL; |
1077 | } | 1076 | } |
1078 | else | 1077 | else |
1079 | { | 1078 | { |
1080 | /* This is an option that requires an argument. */ | 1079 | /* This is an option that requires an argument. */ |
1081 | if (*nextchar != '\0') | 1080 | if (*d->__nextchar != '\0') |
1082 | { | 1081 | { |
1083 | optarg = nextchar; | 1082 | d->optarg = d->__nextchar; |
1084 | /* If we end this ARGV-element by taking the rest as an arg, | 1083 | /* If we end this ARGV-element by taking the rest as an arg, |
1085 | we must advance to the next element now. */ | 1084 | we must advance to the next element now. */ |
1086 | optind++; | 1085 | d->optind++; |
1087 | } | 1086 | } |
1088 | else if (optind == argc) | 1087 | else if (d->optind == argc) |
1089 | { | 1088 | { |
1090 | if (print_errors) | 1089 | if (print_errors) |
1091 | { | 1090 | { |
@@ -1097,11 +1096,19 @@ _getopt_internal (int argc, char *const *argv, | |||
1097 | %s: option requires an argument -- %c\n"), | 1096 | %s: option requires an argument -- %c\n"), |
1098 | argv[0], c) >= 0) | 1097 | argv[0], c) >= 0) |
1099 | { | 1098 | { |
1099 | _IO_flockfile (stderr); | ||
1100 | |||
1101 | int old_flags2 = ((_IO_FILE *) stderr)->_flags2; | ||
1102 | ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL; | ||
1103 | |||
1100 | if (_IO_fwide (stderr, 0) > 0) | 1104 | if (_IO_fwide (stderr, 0) > 0) |
1101 | __fwprintf (stderr, L"%s", buf); | 1105 | __fwprintf (stderr, L"%s", buf); |
1102 | else | 1106 | else |
1103 | fputs (buf, stderr); | 1107 | fputs (buf, stderr); |
1104 | 1108 | ||
1109 | ((_IO_FILE *) stderr)->_flags2 = old_flags2; | ||
1110 | _IO_funlockfile (stderr); | ||
1111 | |||
1105 | free (buf); | 1112 | free (buf); |
1106 | } | 1113 | } |
1107 | #else | 1114 | #else |
@@ -1110,7 +1117,7 @@ _getopt_internal (int argc, char *const *argv, | |||
1110 | argv[0], c); | 1117 | argv[0], c); |
1111 | #endif | 1118 | #endif |
1112 | } | 1119 | } |
1113 | optopt = c; | 1120 | d->optopt = c; |
1114 | if (optstring[0] == ':') | 1121 | if (optstring[0] == ':') |
1115 | c = ':'; | 1122 | c = ':'; |
1116 | else | 1123 | else |
@@ -1119,8 +1126,8 @@ _getopt_internal (int argc, char *const *argv, | |||
1119 | else | 1126 | else |
1120 | /* We already incremented `optind' once; | 1127 | /* We already incremented `optind' once; |
1121 | increment it again when taking next ARGV-elt as argument. */ | 1128 | increment it again when taking next ARGV-elt as argument. */ |
1122 | optarg = argv[optind++]; | 1129 | d->optarg = argv[d->optind++]; |
1123 | nextchar = NULL; | 1130 | d->__nextchar = NULL; |
1124 | } | 1131 | } |
1125 | } | 1132 | } |
1126 | return c; | 1133 | return c; |
@@ -1128,15 +1135,40 @@ _getopt_internal (int argc, char *const *argv, | |||
1128 | } | 1135 | } |
1129 | 1136 | ||
1130 | int | 1137 | int |
1138 | _getopt_internal (int argc, char **argv, const char *optstring, | ||
1139 | const struct option *longopts, int *longind, | ||
1140 | int long_only, int posixly_correct) | ||
1141 | { | ||
1142 | int result; | ||
1143 | |||
1144 | getopt_data.optind = optind; | ||
1145 | getopt_data.opterr = opterr; | ||
1146 | |||
1147 | result = _getopt_internal_r (argc, argv, optstring, longopts, longind, | ||
1148 | long_only, posixly_correct, &getopt_data); | ||
1149 | |||
1150 | optind = getopt_data.optind; | ||
1151 | optarg = getopt_data.optarg; | ||
1152 | optopt = getopt_data.optopt; | ||
1153 | |||
1154 | return result; | ||
1155 | } | ||
1156 | |||
1157 | /* glibc gets a LSB-compliant getopt. | ||
1158 | Standalone applications get a POSIX-compliant getopt. */ | ||
1159 | #if _LIBC | ||
1160 | enum { POSIXLY_CORRECT = 0 }; | ||
1161 | #else | ||
1162 | enum { POSIXLY_CORRECT = 1 }; | ||
1163 | #endif | ||
1164 | |||
1165 | int | ||
1131 | getopt (int argc, char *const *argv, const char *optstring) | 1166 | getopt (int argc, char *const *argv, const char *optstring) |
1132 | { | 1167 | { |
1133 | return _getopt_internal (argc, argv, optstring, | 1168 | return _getopt_internal (argc, (char **) argv, optstring, NULL, NULL, 0, |
1134 | (const struct option *) 0, | 1169 | POSIXLY_CORRECT); |
1135 | (int *) 0, | ||
1136 | 0); | ||
1137 | } | 1170 | } |
1138 | 1171 | ||
1139 | #endif /* Not ELIDE_CODE. */ | ||
1140 | 1172 | ||
1141 | #ifdef TEST | 1173 | #ifdef TEST |
1142 | 1174 | ||
diff --git a/lib/getopt1.c b/lib/getopt1.c index 3288c726..25d79265 100644 --- a/lib/getopt1.c +++ b/lib/getopt1.c | |||
@@ -1,8 +1,6 @@ | |||
1 | /* getopt_long and getopt_long_only entry points for GNU getopt. | 1 | /* getopt_long and getopt_long_only entry points for GNU getopt. |
2 | 2 | Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98,2004 | |
3 | Copyright (C) 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, | 3 | Free Software Foundation, Inc. |
4 | 1997, 1998, 2003 Free Software Foundation, Inc. | ||
5 | |||
6 | This file is part of the GNU C Library. | 4 | This file is part of the GNU C Library. |
7 | 5 | ||
8 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
@@ -17,10 +15,10 @@ | |||
17 | 15 | ||
18 | You should have received a copy of the GNU General Public License along | 16 | You should have received a copy of the GNU General Public License along |
19 | with this program; if not, write to the Free Software Foundation, | 17 | with this program; if not, write to the Free Software Foundation, |
20 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
21 | 19 | ||
22 | #ifdef HAVE_CONFIG_H | 20 | #ifdef HAVE_CONFIG_H |
23 | #include <config.h> | 21 | # include <config.h> |
24 | #endif | 22 | #endif |
25 | 23 | ||
26 | #ifdef _LIBC | 24 | #ifdef _LIBC |
@@ -28,28 +26,10 @@ | |||
28 | #else | 26 | #else |
29 | # include "getopt.h" | 27 | # include "getopt.h" |
30 | #endif | 28 | #endif |
29 | #include "getopt_int.h" | ||
31 | 30 | ||
32 | #include <stdio.h> | 31 | #include <stdio.h> |
33 | 32 | ||
34 | /* Comment out all this code if we are using the GNU C Library, and are not | ||
35 | actually compiling the library itself. This code is part of the GNU C | ||
36 | Library, but also included in many other GNU distributions. Compiling | ||
37 | and linking in this code is a waste when using the GNU C library | ||
38 | (especially if it is a shared library). Rather than having every GNU | ||
39 | program understand `configure --with-gnu-libc' and omit the object files, | ||
40 | it is simpler to just do this in the source for each such file. */ | ||
41 | |||
42 | #define GETOPT_INTERFACE_VERSION 2 | ||
43 | #if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 | ||
44 | #include <gnu-versions.h> | ||
45 | #if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION | ||
46 | #define ELIDE_CODE | ||
47 | #endif | ||
48 | #endif | ||
49 | |||
50 | #ifndef ELIDE_CODE | ||
51 | |||
52 | |||
53 | /* This needs to come after some library #include | 33 | /* This needs to come after some library #include |
54 | to get __GNU_LIBRARY__ defined. */ | 34 | to get __GNU_LIBRARY__ defined. */ |
55 | #ifdef __GNU_LIBRARY__ | 35 | #ifdef __GNU_LIBRARY__ |
@@ -61,13 +41,20 @@ | |||
61 | #endif | 41 | #endif |
62 | 42 | ||
63 | int | 43 | int |
64 | getopt_long (int argc, | 44 | getopt_long (int argc, char *__getopt_argv_const *argv, const char *options, |
65 | char *const *argv, | 45 | const struct option *long_options, int *opt_index) |
66 | const char *options, | ||
67 | const struct option *long_options, | ||
68 | int *opt_index) | ||
69 | { | 46 | { |
70 | return _getopt_internal (argc, argv, options, long_options, opt_index, 0); | 47 | return _getopt_internal (argc, (char **) argv, options, long_options, |
48 | opt_index, 0, 0); | ||
49 | } | ||
50 | |||
51 | int | ||
52 | _getopt_long_r (int argc, char **argv, const char *options, | ||
53 | const struct option *long_options, int *opt_index, | ||
54 | struct _getopt_data *d) | ||
55 | { | ||
56 | return _getopt_internal_r (argc, argv, options, long_options, opt_index, | ||
57 | 0, 0, d); | ||
71 | } | 58 | } |
72 | 59 | ||
73 | /* Like getopt_long, but '-' as well as '--' can indicate a long option. | 60 | /* Like getopt_long, but '-' as well as '--' can indicate a long option. |
@@ -76,21 +63,23 @@ getopt_long (int argc, | |||
76 | instead. */ | 63 | instead. */ |
77 | 64 | ||
78 | int | 65 | int |
79 | getopt_long_only (int argc, | 66 | getopt_long_only (int argc, char *__getopt_argv_const *argv, |
80 | char *const *argv, | ||
81 | const char *options, | 67 | const char *options, |
82 | const struct option *long_options, | 68 | const struct option *long_options, int *opt_index) |
83 | int *opt_index) | ||
84 | { | 69 | { |
85 | return _getopt_internal (argc, argv, options, long_options, opt_index, 1); | 70 | return _getopt_internal (argc, (char **) argv, options, long_options, |
71 | opt_index, 1, 0); | ||
86 | } | 72 | } |
87 | 73 | ||
88 | # ifdef _LIBC | 74 | int |
89 | libc_hidden_def (getopt_long) | 75 | _getopt_long_only_r (int argc, char **argv, const char *options, |
90 | libc_hidden_def (getopt_long_only) | 76 | const struct option *long_options, int *opt_index, |
91 | # endif | 77 | struct _getopt_data *d) |
78 | { | ||
79 | return _getopt_internal_r (argc, argv, options, long_options, opt_index, | ||
80 | 1, 0, d); | ||
81 | } | ||
92 | 82 | ||
93 | #endif /* Not ELIDE_CODE. */ | ||
94 | 83 | ||
95 | #ifdef TEST | 84 | #ifdef TEST |
96 | 85 | ||
diff --git a/lib/getopt.h b/lib/getopt_.h index 5e15191e..3c406e53 100644 --- a/lib/getopt.h +++ b/lib/getopt_.h | |||
@@ -1,8 +1,6 @@ | |||
1 | /* Declarations for getopt. | 1 | /* Declarations for getopt. |
2 | 2 | Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2005 | |
3 | Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, | 3 | Free Software Foundation, Inc. |
4 | 1999, 2001, 2003 Free Software Foundation, Inc. | ||
5 | |||
6 | This file is part of the GNU C Library. | 4 | This file is part of the GNU C Library. |
7 | 5 | ||
8 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
@@ -17,7 +15,7 @@ | |||
17 | 15 | ||
18 | You should have received a copy of the GNU General Public License along | 16 | You should have received a copy of the GNU General Public License along |
19 | with this program; if not, write to the Free Software Foundation, | 17 | with this program; if not, write to the Free Software Foundation, |
20 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
21 | 19 | ||
22 | #ifndef _GETOPT_H | 20 | #ifndef _GETOPT_H |
23 | 21 | ||
@@ -25,6 +23,62 @@ | |||
25 | # define _GETOPT_H 1 | 23 | # define _GETOPT_H 1 |
26 | #endif | 24 | #endif |
27 | 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 | # include <unistd.h> | ||
38 | # undef __need_getopt | ||
39 | # undef getopt | ||
40 | # undef getopt_long | ||
41 | # undef getopt_long_only | ||
42 | # undef optarg | ||
43 | # undef opterr | ||
44 | # undef optind | ||
45 | # undef optopt | ||
46 | # define __GETOPT_CONCAT(x, y) x ## y | ||
47 | # define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y) | ||
48 | # define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y) | ||
49 | # define getopt __GETOPT_ID (getopt) | ||
50 | # define getopt_long __GETOPT_ID (getopt_long) | ||
51 | # define getopt_long_only __GETOPT_ID (getopt_long_only) | ||
52 | # define optarg __GETOPT_ID (optarg) | ||
53 | # define opterr __GETOPT_ID (opterr) | ||
54 | # define optind __GETOPT_ID (optind) | ||
55 | # define optopt __GETOPT_ID (optopt) | ||
56 | #endif | ||
57 | |||
58 | /* Standalone applications get correct prototypes for getopt_long and | ||
59 | getopt_long_only; they declare "char **argv". libc uses prototypes | ||
60 | with "char *const *argv" that are incorrect because getopt_long and | ||
61 | getopt_long_only can permute argv; this is required for backward | ||
62 | compatibility (e.g., for LSB 2.0.1). | ||
63 | |||
64 | This used to be `#if defined __GETOPT_PREFIX && !defined __need_getopt', | ||
65 | but it caused redefinition warnings if both unistd.h and getopt.h were | ||
66 | included, since unistd.h includes getopt.h having previously defined | ||
67 | __need_getopt. | ||
68 | |||
69 | The only place where __getopt_argv_const is used is in definitions | ||
70 | of getopt_long and getopt_long_only below, but these are visible | ||
71 | only if __need_getopt is not defined, so it is quite safe to rewrite | ||
72 | the conditional as follows: | ||
73 | */ | ||
74 | #if !defined __need_getopt | ||
75 | # if defined __GETOPT_PREFIX | ||
76 | # define __getopt_argv_const /* empty */ | ||
77 | # else | ||
78 | # define __getopt_argv_const const | ||
79 | # endif | ||
80 | #endif | ||
81 | |||
28 | /* If __GNU_LIBRARY__ is not already defined, either we are being used | 82 | /* If __GNU_LIBRARY__ is not already defined, either we are being used |
29 | standalone, or this is the first header included in the source file. | 83 | standalone, or this is the first header included in the source file. |
30 | If we are being used with glibc, we need to include <features.h>, but | 84 | If we are being used with glibc, we need to include <features.h>, but |
@@ -36,6 +90,17 @@ | |||
36 | # include <ctype.h> | 90 | # include <ctype.h> |
37 | #endif | 91 | #endif |
38 | 92 | ||
93 | #ifndef __THROW | ||
94 | # ifndef __GNUC_PREREQ | ||
95 | # define __GNUC_PREREQ(maj, min) (0) | ||
96 | # endif | ||
97 | # if defined __cplusplus && __GNUC_PREREQ (2,8) | ||
98 | # define __THROW throw () | ||
99 | # else | ||
100 | # define __THROW | ||
101 | # endif | ||
102 | #endif | ||
103 | |||
39 | #ifdef __cplusplus | 104 | #ifdef __cplusplus |
40 | extern "C" { | 105 | extern "C" { |
41 | #endif | 106 | #endif |
@@ -135,28 +200,19 @@ struct option | |||
135 | arguments to the option '\0'. This behavior is specific to the GNU | 200 | arguments to the option '\0'. This behavior is specific to the GNU |
136 | `getopt'. */ | 201 | `getopt'. */ |
137 | 202 | ||
138 | #ifdef __GNU_LIBRARY__ | 203 | extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) |
139 | /* Many other libraries have conflicting prototypes for getopt, with | 204 | __THROW; |
140 | differences in the consts, in stdlib.h. To avoid compilation | ||
141 | errors, only prototype getopt for the GNU C library. */ | ||
142 | extern int getopt (int ___argc, char *const *___argv, const char *__shortopts); | ||
143 | #else /* not __GNU_LIBRARY__ */ | ||
144 | extern int getopt (); | ||
145 | #endif /* __GNU_LIBRARY__ */ | ||
146 | 205 | ||
147 | #ifndef __need_getopt | 206 | #ifndef __need_getopt |
148 | extern int getopt_long (int ___argc, char *const *___argv, | 207 | extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv, |
149 | const char *__shortopts, | 208 | const char *__shortopts, |
150 | const struct option *__longopts, int *__longind); | 209 | const struct option *__longopts, int *__longind) |
151 | extern int getopt_long_only (int ___argc, char *const *___argv, | 210 | __THROW; |
211 | extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv, | ||
152 | const char *__shortopts, | 212 | const char *__shortopts, |
153 | const struct option *__longopts, int *__longind); | 213 | const struct option *__longopts, int *__longind) |
214 | __THROW; | ||
154 | 215 | ||
155 | /* Internal only. Users should not call this directly. */ | ||
156 | extern int _getopt_internal (int ___argc, char *const *___argv, | ||
157 | const char *__shortopts, | ||
158 | const struct option *__longopts, int *__longind, | ||
159 | int __long_only); | ||
160 | #endif | 216 | #endif |
161 | 217 | ||
162 | #ifdef __cplusplus | 218 | #ifdef __cplusplus |
diff --git a/lib/getopt_int.h b/lib/getopt_int.h new file mode 100644 index 00000000..401579fd --- /dev/null +++ b/lib/getopt_int.h | |||
@@ -0,0 +1,131 @@ | |||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 */ | ||
diff --git a/lib/gettext.h b/lib/gettext.h index 835732e0..285cb314 100644 --- a/lib/gettext.h +++ b/lib/gettext.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Convenience header for conditional use of GNU <libintl.h>. | 1 | /* Convenience header for conditional use of GNU <libintl.h>. |
2 | Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc. | 2 | Copyright (C) 1995-1998, 2000-2002, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software; you can redistribute it and/or modify | 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 | 5 | it under the terms of the GNU General Public License as published by |
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | You should have received a copy of the GNU General Public License along | 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, | 15 | with this program; if not, write to the Free Software Foundation, |
16 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | 17 | ||
18 | #ifndef _LIBGETTEXT_H | 18 | #ifndef _LIBGETTEXT_H |
19 | #define _LIBGETTEXT_H 1 | 19 | #define _LIBGETTEXT_H 1 |
@@ -36,6 +36,16 @@ | |||
36 | # include <locale.h> | 36 | # include <locale.h> |
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | /* Many header files from the libstdc++ coming with g++ 3.3 or newer include | ||
40 | <libintl.h>, which chokes if dcgettext is defined as a macro. So include | ||
41 | it now, to make later inclusions of <libintl.h> a NOP. */ | ||
42 | #if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) | ||
43 | # include <cstdlib> | ||
44 | # if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H | ||
45 | # include <libintl.h> | ||
46 | # endif | ||
47 | #endif | ||
48 | |||
39 | /* Disabled NLS. | 49 | /* Disabled NLS. |
40 | The casts to 'const char *' serve the purpose of producing warnings | 50 | The casts to 'const char *' serve the purpose of producing warnings |
41 | for invalid uses of the value returned from these functions. | 51 | for invalid uses of the value returned from these functions. |
diff --git a/lib/malloc.c b/lib/malloc.c index a43d1692..58fa6116 100644 --- a/lib/malloc.c +++ b/lib/malloc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* Work around bug on some systems where malloc (0) fails. | 1 | /* malloc() function that is glibc compatible. |
2 | Copyright (C) 1997, 1998 Free Software Foundation, Inc. | 2 | Copyright (C) 1997, 1998 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software; you can redistribute it and/or modify | 4 | This program is free software; you can redistribute it and/or modify |
@@ -13,11 +13,11 @@ | |||
13 | 13 | ||
14 | You should have received a copy of the GNU General Public License | 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, | 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. */ | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | 17 | ||
18 | /* written by Jim Meyering */ | 18 | /* written by Jim Meyering */ |
19 | 19 | ||
20 | #if HAVE_CONFIG_H | 20 | #ifdef HAVE_CONFIG_H |
21 | # include <config.h> | 21 | # include <config.h> |
22 | #endif | 22 | #endif |
23 | #undef malloc | 23 | #undef malloc |
diff --git a/lib/mountlist.c b/lib/mountlist.c index 631be312..70d4edb2 100644 --- a/lib/mountlist.c +++ b/lib/mountlist.c | |||
@@ -1,5 +1,7 @@ | |||
1 | /* mountlist.c -- return a list of mounted filesystems | 1 | /* mountlist.c -- return a list of mounted file systems |
2 | Copyright (C) 1991, 1992, 1997-2004 Free Software Foundation, Inc. | 2 | |
3 | Copyright (C) 1991, 1992, 1997, 1998, 1999, 2000, 2001, 2002, 2003, | ||
4 | 2004, 2005 Free Software Foundation, Inc. | ||
3 | 5 | ||
4 | This program is free software; you can redistribute it and/or modify | 6 | 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 | 7 | it under the terms of the GNU General Public License as published by |
@@ -13,39 +15,29 @@ | |||
13 | 15 | ||
14 | You should have received a copy of the GNU General Public License | 16 | 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, | 17 | along with this program; if not, write to the Free Software Foundation, |
16 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | 19 | ||
18 | #if HAVE_CONFIG_H | 20 | #ifdef HAVE_CONFIG_H |
19 | # include <config.h> | 21 | # include <config.h> |
20 | #endif | 22 | #endif |
21 | 23 | ||
24 | #include "mountlist.h" | ||
25 | |||
22 | #include <stdio.h> | 26 | #include <stdio.h> |
23 | #include <sys/types.h> | ||
24 | #include <stdlib.h> | 27 | #include <stdlib.h> |
25 | #include <string.h> | 28 | #include <string.h> |
26 | 29 | ||
27 | #include "xalloc.h" | 30 | #include "xalloc.h" |
28 | 31 | ||
29 | #ifndef SIZE_MAX | ||
30 | # define SIZE_MAX ((size_t) -1) | ||
31 | #endif | ||
32 | |||
33 | #ifndef strstr | 32 | #ifndef strstr |
34 | char *strstr (); | 33 | char *strstr (); |
35 | #endif | 34 | #endif |
36 | 35 | ||
37 | #include <errno.h> | 36 | #include <errno.h> |
38 | #ifndef errno | ||
39 | extern int errno; | ||
40 | #endif | ||
41 | 37 | ||
42 | #ifdef HAVE_FCNTL_H | 38 | #include <fcntl.h> |
43 | # include <fcntl.h> | ||
44 | #endif | ||
45 | 39 | ||
46 | #ifdef HAVE_UNISTD_H | 40 | #include <unistd.h> |
47 | # include <unistd.h> | ||
48 | #endif | ||
49 | 41 | ||
50 | #if HAVE_SYS_PARAM_H | 42 | #if HAVE_SYS_PARAM_H |
51 | # include <sys/param.h> | 43 | # include <sys/param.h> |
@@ -140,42 +132,39 @@ extern int errno; | |||
140 | # define MNT_IGNORE(M) 0 | 132 | # define MNT_IGNORE(M) 0 |
141 | #endif | 133 | #endif |
142 | 134 | ||
143 | #include "mountlist.h" | 135 | #if USE_UNLOCKED_IO |
144 | #include "unlocked-io.h" | 136 | # include "unlocked-io.h" |
137 | #endif | ||
145 | 138 | ||
146 | #ifdef MOUNTED_GETMNTENT1 /* 4.3BSD, SunOS, HP-UX, Dynix, Irix. */ | 139 | #ifndef SIZE_MAX |
147 | /* Return the value of the hexadecimal number represented by CP. | 140 | # define SIZE_MAX ((size_t) -1) |
148 | No prefix (like '0x') or suffix (like 'h') is expected to be | 141 | #endif |
149 | part of CP. */ | ||
150 | /* FIXME: this can overflow */ | ||
151 | 142 | ||
152 | static int | 143 | #ifndef ME_DUMMY |
153 | xatoi (char *cp) | 144 | # define ME_DUMMY(Fs_name, Fs_type) \ |
154 | { | 145 | (strcmp (Fs_type, "autofs") == 0 \ |
155 | int val; | 146 | || strcmp (Fs_type, "none") == 0 \ |
147 | || strcmp (Fs_type, "proc") == 0 \ | ||
148 | || strcmp (Fs_type, "subfs") == 0 \ | ||
149 | /* for Irix 6.5 */ \ | ||
150 | || strcmp (Fs_type, "ignore") == 0) | ||
151 | #endif | ||
156 | 152 | ||
157 | val = 0; | 153 | #ifndef ME_REMOTE |
158 | while (*cp) | 154 | /* A file system is `remote' if its Fs_name contains a `:' |
159 | { | 155 | or if (it is of type smbfs and its Fs_name starts with `//'). */ |
160 | if (*cp >= 'a' && *cp <= 'f') | 156 | # define ME_REMOTE(Fs_name, Fs_type) \ |
161 | val = val * 16 + *cp - 'a' + 10; | 157 | (strchr (Fs_name, ':') != 0 \ |
162 | else if (*cp >= 'A' && *cp <= 'F') | 158 | || ((Fs_name)[0] == '/' \ |
163 | val = val * 16 + *cp - 'A' + 10; | 159 | && (Fs_name)[1] == '/' \ |
164 | else if (*cp >= '0' && *cp <= '9') | 160 | && strcmp (Fs_type, "smbfs") == 0)) |
165 | val = val * 16 + *cp - '0'; | 161 | #endif |
166 | else | ||
167 | break; | ||
168 | cp++; | ||
169 | } | ||
170 | return val; | ||
171 | } | ||
172 | #endif /* MOUNTED_GETMNTENT1. */ | ||
173 | 162 | ||
174 | #if MOUNTED_GETMNTINFO | 163 | #if MOUNTED_GETMNTINFO |
175 | 164 | ||
176 | # if ! HAVE_F_FSTYPENAME_IN_STATFS | 165 | # if ! HAVE_F_FSTYPENAME_IN_STATFS |
177 | static char * | 166 | static char * |
178 | fstype_to_string (short t) | 167 | fstype_to_string (short int t) |
179 | { | 168 | { |
180 | switch (t) | 169 | switch (t) |
181 | { | 170 | { |
@@ -296,13 +285,13 @@ fstype_to_string (int t) | |||
296 | } | 285 | } |
297 | #endif /* MOUNTED_VMOUNT */ | 286 | #endif /* MOUNTED_VMOUNT */ |
298 | 287 | ||
299 | /* Return a list of the currently mounted filesystems, or NULL on error. | 288 | /* Return a list of the currently mounted file systems, or NULL on error. |
300 | Add each entry to the tail of the list so that they stay in order. | 289 | Add each entry to the tail of the list so that they stay in order. |
301 | If NEED_FS_TYPE is nonzero, ensure that the filesystem type fields in | 290 | If NEED_FS_TYPE is true, ensure that the file system type fields in |
302 | the returned list are valid. Otherwise, they might not be. */ | 291 | the returned list are valid. Otherwise, they might not be. */ |
303 | 292 | ||
304 | struct mount_entry * | 293 | struct mount_entry * |
305 | read_filesystem_list (int need_fs_type) | 294 | read_file_system_list (bool need_fs_type) |
306 | { | 295 | { |
307 | struct mount_entry *mount_list; | 296 | struct mount_entry *mount_list; |
308 | struct mount_entry *me; | 297 | struct mount_entry *me; |
@@ -360,12 +349,7 @@ read_filesystem_list (int need_fs_type) | |||
360 | me->me_remote = ME_REMOTE (me->me_devname, me->me_type); | 349 | me->me_remote = ME_REMOTE (me->me_devname, me->me_type); |
361 | devopt = strstr (mnt->mnt_opts, "dev="); | 350 | devopt = strstr (mnt->mnt_opts, "dev="); |
362 | if (devopt) | 351 | if (devopt) |
363 | { | 352 | me->me_dev = strtoul (devopt + 4, NULL, 16); |
364 | if (devopt[4] == '0' && (devopt[5] == 'x' || devopt[5] == 'X')) | ||
365 | me->me_dev = xatoi (devopt + 6); | ||
366 | else | ||
367 | me->me_dev = xatoi (devopt + 4); | ||
368 | } | ||
369 | else | 353 | else |
370 | me->me_dev = (dev_t) -1; /* Magic; means not known yet. */ | 354 | me->me_dev = (dev_t) -1; /* Magic; means not known yet. */ |
371 | 355 | ||
@@ -438,14 +422,14 @@ read_filesystem_list (int need_fs_type) | |||
438 | #if defined MOUNTED_FS_STAT_DEV /* BeOS */ | 422 | #if defined MOUNTED_FS_STAT_DEV /* BeOS */ |
439 | { | 423 | { |
440 | /* The next_dev() and fs_stat_dev() system calls give the list of | 424 | /* The next_dev() and fs_stat_dev() system calls give the list of |
441 | all filesystems, including the information returned by statvfs() | 425 | all file systems, including the information returned by statvfs() |
442 | (fs type, total blocks, free blocks etc.), but without the mount | 426 | (fs type, total blocks, free blocks etc.), but without the mount |
443 | point. But on BeOS all filesystems except / are mounted in the | 427 | point. But on BeOS all file systems except / are mounted in the |
444 | rootfs, directly under /. | 428 | rootfs, directly under /. |
445 | The directory name of the mount point is often, but not always, | 429 | The directory name of the mount point is often, but not always, |
446 | identical to the volume name of the device. | 430 | identical to the volume name of the device. |
447 | We therefore get the list of subdirectories of /, and the list | 431 | We therefore get the list of subdirectories of /, and the list |
448 | of all filesystems, and match the two lists. */ | 432 | of all file systems, and match the two lists. */ |
449 | 433 | ||
450 | DIR *dirp; | 434 | DIR *dirp; |
451 | struct rootdir_entry | 435 | struct rootdir_entry |
@@ -744,12 +728,12 @@ read_filesystem_list (int need_fs_type) | |||
744 | int n_entries; | 728 | int n_entries; |
745 | int i; | 729 | int i; |
746 | 730 | ||
747 | /* Ask how many bytes to allocate for the mounted filesystem info. */ | 731 | /* Ask how many bytes to allocate for the mounted file system info. */ |
748 | if (mntctl (MCTL_QUERY, sizeof bufsize, (struct vmount *) &bufsize) != 0) | 732 | if (mntctl (MCTL_QUERY, sizeof bufsize, (struct vmount *) &bufsize) != 0) |
749 | return NULL; | 733 | return NULL; |
750 | entries = xmalloc (bufsize); | 734 | entries = xmalloc (bufsize); |
751 | 735 | ||
752 | /* Get the list of mounted filesystems. */ | 736 | /* Get the list of mounted file systems. */ |
753 | n_entries = mntctl (MCTL_QUERY, bufsize, (struct vmount *) entries); | 737 | n_entries = mntctl (MCTL_QUERY, bufsize, (struct vmount *) entries); |
754 | if (n_entries < 0) | 738 | if (n_entries < 0) |
755 | { | 739 | { |
@@ -769,16 +753,16 @@ read_filesystem_list (int need_fs_type) | |||
769 | me = xmalloc (sizeof *me); | 753 | me = xmalloc (sizeof *me); |
770 | if (vmp->vmt_flags & MNT_REMOTE) | 754 | if (vmp->vmt_flags & MNT_REMOTE) |
771 | { | 755 | { |
772 | char *host, *path; | 756 | char *host, *dir; |
773 | 757 | ||
774 | me->me_remote = 1; | 758 | me->me_remote = 1; |
775 | /* Prepend the remote pathname. */ | 759 | /* Prepend the remote dirname. */ |
776 | host = thisent + vmp->vmt_data[VMT_HOSTNAME].vmt_off; | 760 | host = thisent + vmp->vmt_data[VMT_HOSTNAME].vmt_off; |
777 | path = thisent + vmp->vmt_data[VMT_OBJECT].vmt_off; | 761 | dir = thisent + vmp->vmt_data[VMT_OBJECT].vmt_off; |
778 | me->me_devname = xmalloc (strlen (host) + strlen (path) + 2); | 762 | me->me_devname = xmalloc (strlen (host) + strlen (dir) + 2); |
779 | strcpy (me->me_devname, host); | 763 | strcpy (me->me_devname, host); |
780 | strcat (me->me_devname, ":"); | 764 | strcat (me->me_devname, ":"); |
781 | strcat (me->me_devname, path); | 765 | strcat (me->me_devname, dir); |
782 | } | 766 | } |
783 | else | 767 | else |
784 | { | 768 | { |
diff --git a/lib/mountlist.h b/lib/mountlist.h index 9e550a08..7f5a6f77 100644 --- a/lib/mountlist.h +++ b/lib/mountlist.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* mountlist.h -- declarations for list of mounted filesystems | 1 | /* mountlist.h -- declarations for list of mounted file systems |
2 | 2 | ||
3 | Copyright (C) 1991, 1992, 1998, 2000, 2001, 2002, 2003 Free | 3 | Copyright (C) 1991, 1992, 1998, 2000, 2001, 2002, 2003, 2004, 2005 |
4 | Software Foundation, Inc. | 4 | Free Software Foundation, Inc. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 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 | 7 | it under the terms of the GNU General Public License as published by |
@@ -15,39 +15,27 @@ | |||
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 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, | 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. */ | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | |||
20 | #ifndef MOUNTLIST_H_ | ||
21 | # define MOUNTLIST_H_ | ||
22 | |||
23 | # include <stdbool.h> | ||
24 | # include <sys/types.h> | ||
19 | 25 | ||
20 | /* A mount table entry. */ | 26 | /* A mount table entry. */ |
21 | struct mount_entry | 27 | struct mount_entry |
22 | { | 28 | { |
23 | char *me_devname; /* Device node pathname, including "/dev/". */ | 29 | char *me_devname; /* Device node name, including "/dev/". */ |
24 | char *me_mountdir; /* Mount point directory pathname. */ | 30 | char *me_mountdir; /* Mount point directory name. */ |
25 | char *me_type; /* "nfs", "4.2", etc. */ | 31 | char *me_type; /* "nfs", "4.2", etc. */ |
26 | dev_t me_dev; /* Device number of me_mountdir. */ | 32 | dev_t me_dev; /* Device number of me_mountdir. */ |
27 | unsigned int me_dummy : 1; /* Nonzero for dummy filesystems. */ | 33 | unsigned int me_dummy : 1; /* Nonzero for dummy file systems. */ |
28 | unsigned int me_remote : 1; /* Nonzero for remote fileystems. */ | 34 | unsigned int me_remote : 1; /* Nonzero for remote fileystems. */ |
29 | unsigned int me_type_malloced : 1; /* Nonzero if me_type was malloced. */ | 35 | unsigned int me_type_malloced : 1; /* Nonzero if me_type was malloced. */ |
30 | struct mount_entry *me_next; | 36 | struct mount_entry *me_next; |
31 | }; | 37 | }; |
32 | 38 | ||
33 | struct mount_entry *read_filesystem_list (int need_fs_type); | 39 | struct mount_entry *read_file_system_list (bool need_fs_type); |
34 | |||
35 | #ifndef ME_DUMMY | ||
36 | # define ME_DUMMY(Fs_name, Fs_type) \ | ||
37 | (!strcmp (Fs_type, "autofs") \ | ||
38 | /* for Irix 6.5 */ \ | ||
39 | || !strcmp (Fs_type, "ignore")) | ||
40 | #endif | ||
41 | 40 | ||
42 | #undef STREQ | ||
43 | #define STREQ(a, b) (strcmp ((a), (b)) == 0) | ||
44 | |||
45 | #ifndef ME_REMOTE | ||
46 | /* A file system is `remote' if its Fs_name contains a `:' | ||
47 | or if (it is of type smbfs and its Fs_name starts with `//'). */ | ||
48 | # define ME_REMOTE(Fs_name, Fs_type) \ | ||
49 | (strchr ((Fs_name), ':') != 0 \ | ||
50 | || ((Fs_name)[0] == '/' \ | ||
51 | && (Fs_name)[1] == '/' \ | ||
52 | && STREQ (Fs_type, "smbfs"))) | ||
53 | #endif | 41 | #endif |
diff --git a/lib/realloc.c b/lib/realloc.c index ccbf9913..fe948222 100644 --- a/lib/realloc.c +++ b/lib/realloc.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Work around bug on some systems where realloc (NULL, 0) fails. | 1 | /* realloc() function that is glibc compatible. |
2 | Copyright (C) 1997, 2003 Free Software Foundation, Inc. | 2 | Copyright (C) 1997, 2003, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software; you can redistribute it and/or modify | 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 | 5 | it under the terms of the GNU General Public License as published by |
@@ -13,11 +13,11 @@ | |||
13 | 13 | ||
14 | You should have received a copy of the GNU General Public License | 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, | 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. */ | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | 17 | ||
18 | /* written by Jim Meyering */ | 18 | /* written by Jim Meyering */ |
19 | 19 | ||
20 | #if HAVE_CONFIG_H | 20 | #ifdef HAVE_CONFIG_H |
21 | # include <config.h> | 21 | # include <config.h> |
22 | #endif | 22 | #endif |
23 | #undef realloc | 23 | #undef realloc |
@@ -32,8 +32,15 @@ void * | |||
32 | rpl_realloc (void *p, size_t n) | 32 | rpl_realloc (void *p, size_t n) |
33 | { | 33 | { |
34 | if (n == 0) | 34 | if (n == 0) |
35 | n = 1; | 35 | { |
36 | if (p == 0) | 36 | n = 1; |
37 | |||
38 | /* In theory realloc might fail, so don't rely on it to free. */ | ||
39 | free (p); | ||
40 | p = NULL; | ||
41 | } | ||
42 | |||
43 | if (p == NULL) | ||
37 | return malloc (n); | 44 | return malloc (n); |
38 | return realloc (p, n); | 45 | return realloc (p, n); |
39 | } | 46 | } |
diff --git a/lib/safe-read.c b/lib/safe-read.c index c21d1cf1..9caf8466 100644 --- a/lib/safe-read.c +++ b/lib/safe-read.c | |||
@@ -1,5 +1,7 @@ | |||
1 | /* An interface to read and write that retries after interrupts. | 1 | /* An interface to read and write that retries after interrupts. |
2 | Copyright (C) 1993, 1994, 1998, 2002-2003 Free Software Foundation, Inc. | 2 | |
3 | Copyright (C) 1993, 1994, 1998, 2002, 2003, 2004, 2005 Free Software | ||
4 | Foundation, Inc. | ||
3 | 5 | ||
4 | This program is free software; you can redistribute it and/or modify | 6 | 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 | 7 | it under the terms of the GNU General Public License as published by |
@@ -13,9 +15,9 @@ | |||
13 | 15 | ||
14 | You should have received a copy of the GNU General Public License | 16 | 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, | 17 | along with this program; if not, write to the Free Software Foundation, |
16 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | 19 | ||
18 | #if HAVE_CONFIG_H | 20 | #ifdef HAVE_CONFIG_H |
19 | # include <config.h> | 21 | # include <config.h> |
20 | #endif | 22 | #endif |
21 | 23 | ||
@@ -28,14 +30,9 @@ | |||
28 | 30 | ||
29 | /* Get ssize_t. */ | 31 | /* Get ssize_t. */ |
30 | #include <sys/types.h> | 32 | #include <sys/types.h> |
31 | #if HAVE_UNISTD_H | 33 | #include <unistd.h> |
32 | # include <unistd.h> | ||
33 | #endif | ||
34 | 34 | ||
35 | #include <errno.h> | 35 | #include <errno.h> |
36 | #ifndef errno | ||
37 | extern int errno; | ||
38 | #endif | ||
39 | 36 | ||
40 | #ifdef EINTR | 37 | #ifdef EINTR |
41 | # define IS_EINTR(x) ((x) == EINTR) | 38 | # define IS_EINTR(x) ((x) == EINTR) |
@@ -61,22 +58,23 @@ extern int errno; | |||
61 | size_t | 58 | size_t |
62 | safe_rw (int fd, void const *buf, size_t count) | 59 | safe_rw (int fd, void const *buf, size_t count) |
63 | { | 60 | { |
64 | ssize_t result; | 61 | /* Work around a bug in Tru64 5.1. Attempting to read more than |
62 | INT_MAX bytes fails with errno == EINVAL. See | ||
63 | <http://lists.gnu.org/archive/html/bug-gnu-utils/2002-04/msg00010.html>. | ||
64 | When decreasing COUNT, keep it block-aligned. */ | ||
65 | enum { BUGGY_READ_MAXIMUM = INT_MAX & ~8191 }; | ||
65 | 66 | ||
66 | /* POSIX limits COUNT to SSIZE_MAX, but we limit it further, requiring | 67 | for (;;) |
67 | that COUNT <= INT_MAX, to avoid triggering a bug in Tru64 5.1. | ||
68 | When decreasing COUNT, keep the file pointer block-aligned. | ||
69 | Note that in any case, read(write) may succeed, yet read(write) | ||
70 | fewer than COUNT bytes, so the caller must be prepared to handle | ||
71 | partial results. */ | ||
72 | if (count > INT_MAX) | ||
73 | count = INT_MAX & ~8191; | ||
74 | |||
75 | do | ||
76 | { | 68 | { |
77 | result = rw (fd, buf, count); | 69 | ssize_t result = rw (fd, buf, count); |
78 | } | ||
79 | while (result < 0 && IS_EINTR (errno)); | ||
80 | 70 | ||
81 | return (size_t) result; | 71 | if (0 <= result) |
72 | return result; | ||
73 | else if (IS_EINTR (errno)) | ||
74 | continue; | ||
75 | else if (errno == EINVAL && BUGGY_READ_MAXIMUM < count) | ||
76 | count = BUGGY_READ_MAXIMUM; | ||
77 | else | ||
78 | return result; | ||
79 | } | ||
82 | } | 80 | } |
diff --git a/lib/safe-read.h b/lib/safe-read.h index cbe6e0bf..9f8a59bd 100644 --- a/lib/safe-read.h +++ b/lib/safe-read.h | |||
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | You should have received a copy of the GNU General Public License | 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, | 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. */ | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | 17 | ||
18 | #include <stddef.h> | 18 | #include <stddef.h> |
19 | 19 | ||
diff --git a/lib/safe-write.c b/lib/safe-write.c index fbafa7cc..4c375a6c 100644 --- a/lib/safe-write.c +++ b/lib/safe-write.c | |||
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | You should have received a copy of the GNU General Public License | 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, | 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. */ | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | 17 | ||
18 | #define SAFE_WRITE | 18 | #define SAFE_WRITE |
19 | #include "safe-read.c" | 19 | #include "safe-read.c" |
diff --git a/lib/safe-write.h b/lib/safe-write.h index ab1f45b4..c1946362 100644 --- a/lib/safe-write.h +++ b/lib/safe-write.h | |||
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | You should have received a copy of the GNU General Public License | 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, | 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. */ | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | 17 | ||
18 | #include <stddef.h> | 18 | #include <stddef.h> |
19 | 19 | ||
diff --git a/lib/stdbool_.h b/lib/stdbool_.h index e33715a6..7cd2da84 100644 --- a/lib/stdbool_.h +++ b/lib/stdbool_.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. | 1 | /* Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. |
2 | Written by Bruno Haible <haible@clisp.cons.org>, 2001. | 2 | Written by Bruno Haible <haible@clisp.cons.org>, 2001. |
3 | 3 | ||
4 | This program is free software; you can redistribute it and/or modify | 4 | This program is free software; you can redistribute it and/or modify |
@@ -13,7 +13,7 @@ | |||
13 | 13 | ||
14 | You should have received a copy of the GNU General Public License | 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, | 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. */ | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | 17 | ||
18 | #ifndef _STDBOOL_H | 18 | #ifndef _STDBOOL_H |
19 | #define _STDBOOL_H | 19 | #define _STDBOOL_H |
@@ -54,35 +54,47 @@ | |||
54 | /* 7.16. Boolean type and values */ | 54 | /* 7.16. Boolean type and values */ |
55 | 55 | ||
56 | /* BeOS <sys/socket.h> already #defines false 0, true 1. We use the same | 56 | /* BeOS <sys/socket.h> already #defines false 0, true 1. We use the same |
57 | definitions below, but temporarily we have to #undef them. */ | 57 | definitions below, which is OK. */ |
58 | #ifdef __BEOS__ | 58 | #ifdef __BEOS__ |
59 | # include <OS.h> /* defines bool but not _Bool */ | 59 | # include <OS.h> /* defines bool but not _Bool */ |
60 | # undef false | ||
61 | # undef true | ||
62 | #endif | 60 | #endif |
63 | 61 | ||
64 | /* For the sake of symbolic names in gdb, we define true and false as | 62 | /* C++ and BeOS have a reliable bool (and _Bool, if it exists). |
65 | enum constants, not only as macros. | 63 | Otherwise, since this file is being compiled, the system |
66 | It is tempting to write | 64 | <stdbool.h> is not reliable so assume that the system _Bool is not |
67 | typedef enum { false = 0, true = 1 } _Bool; | 65 | reliable either. Under that assumption, it is tempting to write |
68 | so that gdb prints values of type 'bool' symbolically. But if we do | 66 | |
67 | typedef enum { false, true } _Bool; | ||
68 | |||
69 | so that gdb prints values of type 'bool' symbolically. But if we do | ||
69 | this, values of type '_Bool' may promote to 'int' or 'unsigned int' | 70 | this, values of type '_Bool' may promote to 'int' or 'unsigned int' |
70 | (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' | 71 | (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' |
71 | (see ISO C 99 6.3.1.1.(2)). So we add a negative value to the | 72 | (see ISO C 99 6.3.1.1.(2)). We could instead try this: |
72 | enum; this ensures that '_Bool' promotes to 'int'. */ | 73 | |
73 | #if !(defined __cplusplus || defined __BEOS__) | 74 | typedef enum { _Bool_dummy = -1, false, true } _Bool; |
75 | |||
76 | as the negative value ensures that '_Bool' promotes to 'int'. | ||
77 | However, this runs into some other problems. First, Sun's C | ||
78 | compiler when (__SUNPRO_C < 0x550 || __STDC__ == 1) issues a stupid | ||
79 | "warning: _Bool is a keyword in ISO C99". Second, IBM's AIX cc | ||
80 | compiler 6.0.0.0 (and presumably other versions) mishandles | ||
81 | subscripts involving _Bool (effectively, _Bool promotes to unsigned | ||
82 | int in this case), and we need to redefine _Bool in that case. | ||
83 | Third, HP-UX 10.20's C compiler lacks <stdbool.h> but has _Bool and | ||
84 | mishandles comparisons of _Bool to int (it promotes _Bool to | ||
85 | unsigned int). | ||
86 | |||
87 | The simplest way to work around these problems is to ignore any | ||
88 | existing definition of _Bool and use our own. */ | ||
89 | |||
90 | #if defined __cplusplus || defined __BEOS__ | ||
74 | # if !@HAVE__BOOL@ | 91 | # if !@HAVE__BOOL@ |
75 | # if defined __SUNPRO_C && (__SUNPRO_C < 0x550 || __STDC__ == 1) | 92 | typedef bool _Bool; |
76 | /* Avoid stupid "warning: _Bool is a keyword in ISO C99". */ | ||
77 | # define _Bool signed char | ||
78 | enum { false = 0, true = 1 }; | ||
79 | # else | ||
80 | typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool; | ||
81 | # endif | ||
82 | # endif | 93 | # endif |
83 | #else | 94 | #else |
84 | typedef bool _Bool; | 95 | # define _Bool signed char |
85 | #endif | 96 | #endif |
97 | |||
86 | #define bool _Bool | 98 | #define bool _Bool |
87 | 99 | ||
88 | /* The other macros must be usable in preprocessor directives. */ | 100 | /* The other macros must be usable in preprocessor directives. */ |
diff --git a/lib/strtod.c b/lib/strtod.c index 161f97a7..7b48754e 100644 --- a/lib/strtod.c +++ b/lib/strtod.c | |||
@@ -12,9 +12,9 @@ | |||
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License | 13 | You should have received a copy of the GNU General Public License |
14 | along with this program; if not, write to the Free Software Foundation, | 14 | along with this program; if not, write to the Free Software Foundation, |
15 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | 15 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
16 | 16 | ||
17 | #if HAVE_CONFIG_H | 17 | #ifdef HAVE_CONFIG_H |
18 | # include <config.h> | 18 | # include <config.h> |
19 | #endif | 19 | #endif |
20 | 20 | ||
diff --git a/lib/unlocked-io.h b/lib/unlocked-io.h index 36a7a488..d0093036 100644 --- a/lib/unlocked-io.h +++ b/lib/unlocked-io.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Prefer faster, non-thread-safe stdio functions if available. | 1 | /* Prefer faster, non-thread-safe stdio functions if available. |
2 | 2 | ||
3 | Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. | 3 | Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 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 | 6 | it under the terms of the GNU General Public License as published by |
@@ -14,19 +14,13 @@ | |||
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License along | 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, | 16 | with this program; if not, write to the Free Software Foundation, |
17 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | 17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
18 | 18 | ||
19 | /* Written by Jim Meyering. */ | 19 | /* Written by Jim Meyering. */ |
20 | 20 | ||
21 | #ifndef UNLOCKED_IO_H | 21 | #ifndef UNLOCKED_IO_H |
22 | # define UNLOCKED_IO_H 1 | 22 | # define UNLOCKED_IO_H 1 |
23 | 23 | ||
24 | # ifndef USE_UNLOCKED_IO | ||
25 | # define USE_UNLOCKED_IO 1 | ||
26 | # endif | ||
27 | |||
28 | # if USE_UNLOCKED_IO | ||
29 | |||
30 | /* These are wrappers for functions/macros from the GNU C library, and | 24 | /* These are wrappers for functions/macros from the GNU C library, and |
31 | from other C libraries supporting POSIX's optional thread-safe functions. | 25 | from other C libraries supporting POSIX's optional thread-safe functions. |
32 | 26 | ||
@@ -38,95 +32,106 @@ | |||
38 | the *_unlocked functions directly. On hosts that lack those | 32 | the *_unlocked functions directly. On hosts that lack those |
39 | functions, invoke the non-thread-safe versions instead. */ | 33 | functions, invoke the non-thread-safe versions instead. */ |
40 | 34 | ||
41 | # include <stdio.h> | 35 | # include <stdio.h> |
42 | 36 | ||
43 | # if HAVE_DECL_CLEARERR_UNLOCKED | 37 | # if HAVE_DECL_CLEARERR_UNLOCKED |
44 | # undef clearerr | 38 | # undef clearerr |
45 | # define clearerr(x) clearerr_unlocked (x) | 39 | # define clearerr(x) clearerr_unlocked (x) |
46 | # else | 40 | # else |
47 | # define clearerr_unlocked(x) clearerr (x) | 41 | # define clearerr_unlocked(x) clearerr (x) |
48 | # endif | 42 | # endif |
49 | # if HAVE_DECL_FEOF_UNLOCKED | 43 | |
50 | # undef feof | 44 | # if HAVE_DECL_FEOF_UNLOCKED |
51 | # define feof(x) feof_unlocked (x) | 45 | # undef feof |
52 | # else | 46 | # define feof(x) feof_unlocked (x) |
53 | # define feof_unlocked(x) feof (x) | 47 | # else |
54 | # endif | 48 | # define feof_unlocked(x) feof (x) |
55 | # if HAVE_DECL_FERROR_UNLOCKED | 49 | # endif |
56 | # undef ferror | 50 | |
57 | # define ferror(x) ferror_unlocked (x) | 51 | # if HAVE_DECL_FERROR_UNLOCKED |
58 | # else | 52 | # undef ferror |
59 | # define ferror_unlocked(x) ferror (x) | 53 | # define ferror(x) ferror_unlocked (x) |
60 | # endif | 54 | # else |
61 | # if HAVE_DECL_FFLUSH_UNLOCKED | 55 | # define ferror_unlocked(x) ferror (x) |
62 | # undef fflush | 56 | # endif |
63 | # define fflush(x) fflush_unlocked (x) | 57 | |
64 | # else | 58 | # if HAVE_DECL_FFLUSH_UNLOCKED |
65 | # define fflush_unlocked(x) fflush (x) | 59 | # undef fflush |
66 | # endif | 60 | # define fflush(x) fflush_unlocked (x) |
67 | # if HAVE_DECL_FGETS_UNLOCKED | 61 | # else |
68 | # undef fgets | 62 | # define fflush_unlocked(x) fflush (x) |
69 | # define fgets(x,y,z) fgets_unlocked (x,y,z) | 63 | # endif |
70 | # else | 64 | |
71 | # define fgets_unlocked(x,y,z) fgets (x,y,z) | 65 | # if HAVE_DECL_FGETS_UNLOCKED |
72 | # endif | 66 | # undef fgets |
73 | # if HAVE_DECL_FPUTC_UNLOCKED | 67 | # define fgets(x,y,z) fgets_unlocked (x,y,z) |
74 | # undef fputc | 68 | # else |
75 | # define fputc(x,y) fputc_unlocked (x,y) | 69 | # define fgets_unlocked(x,y,z) fgets (x,y,z) |
76 | # else | 70 | # endif |
77 | # define fputc_unlocked(x,y) fputc (x,y) | 71 | |
78 | # endif | 72 | # if HAVE_DECL_FPUTC_UNLOCKED |
79 | # if HAVE_DECL_FPUTS_UNLOCKED | 73 | # undef fputc |
80 | # undef fputs | 74 | # define fputc(x,y) fputc_unlocked (x,y) |
81 | # define fputs(x,y) fputs_unlocked (x,y) | 75 | # else |
82 | # else | 76 | # define fputc_unlocked(x,y) fputc (x,y) |
83 | # define fputs_unlocked(x,y) fputs (x,y) | 77 | # endif |
84 | # endif | 78 | |
85 | # if HAVE_DECL_FREAD_UNLOCKED | 79 | # if HAVE_DECL_FPUTS_UNLOCKED |
86 | # undef fread | 80 | # undef fputs |
87 | # define fread(w,x,y,z) fread_unlocked (w,x,y,z) | 81 | # define fputs(x,y) fputs_unlocked (x,y) |
88 | # else | 82 | # else |
89 | # define fread_unlocked(w,x,y,z) fread (w,x,y,z) | 83 | # define fputs_unlocked(x,y) fputs (x,y) |
90 | # endif | 84 | # endif |
91 | # if HAVE_DECL_FWRITE_UNLOCKED | 85 | |
92 | # undef fwrite | 86 | # if HAVE_DECL_FREAD_UNLOCKED |
93 | # define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z) | 87 | # undef fread |
94 | # else | 88 | # define fread(w,x,y,z) fread_unlocked (w,x,y,z) |
95 | # define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z) | 89 | # else |
96 | # endif | 90 | # define fread_unlocked(w,x,y,z) fread (w,x,y,z) |
97 | # if HAVE_DECL_GETC_UNLOCKED | 91 | # endif |
98 | # undef getc | 92 | |
99 | # define getc(x) getc_unlocked (x) | 93 | # if HAVE_DECL_FWRITE_UNLOCKED |
100 | # else | 94 | # undef fwrite |
101 | # define getc_unlocked(x) getc (x) | 95 | # define fwrite(w,x,y,z) fwrite_unlocked (w,x,y,z) |
102 | # endif | 96 | # else |
103 | # if HAVE_DECL_GETCHAR_UNLOCKED | 97 | # define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z) |
104 | # undef getchar | 98 | # endif |
105 | # define getchar() getchar_unlocked () | 99 | |
106 | # else | 100 | # if HAVE_DECL_GETC_UNLOCKED |
107 | # define getchar_unlocked() getchar () | 101 | # undef getc |
108 | # endif | 102 | # define getc(x) getc_unlocked (x) |
109 | # if HAVE_DECL_PUTC_UNLOCKED | 103 | # else |
110 | # undef putc | 104 | # define getc_unlocked(x) getc (x) |
111 | # define putc(x,y) putc_unlocked (x,y) | 105 | # endif |
112 | # else | 106 | |
113 | # define putc_unlocked(x,y) putc (x,y) | 107 | # if HAVE_DECL_GETCHAR_UNLOCKED |
114 | # endif | 108 | # undef getchar |
115 | # if HAVE_DECL_PUTCHAR_UNLOCKED | 109 | # define getchar() getchar_unlocked () |
116 | # undef putchar | 110 | # else |
117 | # define putchar(x) putchar_unlocked (x) | 111 | # define getchar_unlocked() getchar () |
118 | # else | 112 | # endif |
119 | # define putchar_unlocked(x) putchar (x) | 113 | |
120 | # endif | 114 | # if HAVE_DECL_PUTC_UNLOCKED |
121 | 115 | # undef putc | |
122 | # undef flockfile | 116 | # define putc(x,y) putc_unlocked (x,y) |
123 | # define flockfile(x) ((void) 0) | 117 | # else |
124 | 118 | # define putc_unlocked(x,y) putc (x,y) | |
125 | # undef ftrylockfile | 119 | # endif |
126 | # define ftrylockfile(x) 0 | 120 | |
127 | 121 | # if HAVE_DECL_PUTCHAR_UNLOCKED | |
128 | # undef funlockfile | 122 | # undef putchar |
129 | # define funlockfile(x) ((void) 0) | 123 | # define putchar(x) putchar_unlocked (x) |
130 | 124 | # else | |
131 | # endif /* USE_UNLOCKED_IO */ | 125 | # define putchar_unlocked(x) putchar (x) |
126 | # endif | ||
127 | |||
128 | # undef flockfile | ||
129 | # define flockfile(x) ((void) 0) | ||
130 | |||
131 | # undef ftrylockfile | ||
132 | # define ftrylockfile(x) 0 | ||
133 | |||
134 | # undef funlockfile | ||
135 | # define funlockfile(x) ((void) 0) | ||
136 | |||
132 | #endif /* UNLOCKED_IO_H */ | 137 | #endif /* UNLOCKED_IO_H */ |
diff --git a/lib/xalloc-die.c b/lib/xalloc-die.c new file mode 100644 index 00000000..ff5ac9e6 --- /dev/null +++ b/lib/xalloc-die.c | |||
@@ -0,0 +1,45 @@ | |||
1 | /* Report a memory allocation failure and exit. | ||
2 | |||
3 | Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004 Free | ||
4 | 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | ||
19 | |||
20 | #ifdef HAVE_CONFIG_H | ||
21 | # include <config.h> | ||
22 | #endif | ||
23 | |||
24 | #include "xalloc.h" | ||
25 | |||
26 | #include <stdlib.h> | ||
27 | |||
28 | #include "error.h" | ||
29 | #include "exitfail.h" | ||
30 | |||
31 | #include "gettext.h" | ||
32 | #define _(msgid) gettext (msgid) | ||
33 | #define N_(msgid) msgid | ||
34 | |||
35 | void | ||
36 | xalloc_die (void) | ||
37 | { | ||
38 | error (exit_failure, 0, "%s", _("memory exhausted")); | ||
39 | |||
40 | /* The `noreturn' cannot be given to error, since it may return if | ||
41 | its first argument is 0. To help compilers understand the | ||
42 | xalloc_die does not return, call abort. Also, the abort is a | ||
43 | safety feature if exit_failure is 0 (which shouldn't happen). */ | ||
44 | abort (); | ||
45 | } | ||
diff --git a/lib/xalloc.h b/lib/xalloc.h index 4b658581..f80977e3 100644 --- a/lib/xalloc.h +++ b/lib/xalloc.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* xalloc.h -- malloc with out-of-memory checking | 1 | /* xalloc.h -- malloc with out-of-memory checking |
2 | 2 | ||
3 | Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, | 3 | Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, |
4 | 1999, 2000, 2003 Free Software Foundation, Inc. | 4 | 1999, 2000, 2003, 2004 Free Software Foundation, Inc. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 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 | 7 | it under the terms of the GNU General Public License as published by |
@@ -15,13 +15,19 @@ | |||
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 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, | 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. */ | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | 19 | ||
20 | #ifndef XALLOC_H_ | 20 | #ifndef XALLOC_H_ |
21 | # define XALLOC_H_ | 21 | # define XALLOC_H_ |
22 | 22 | ||
23 | # include <stddef.h> | 23 | # include <stddef.h> |
24 | 24 | ||
25 | |||
26 | # ifdef __cplusplus | ||
27 | extern "C" { | ||
28 | # endif | ||
29 | |||
30 | |||
25 | # ifndef __attribute__ | 31 | # ifndef __attribute__ |
26 | # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ | 32 | # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ |
27 | # define __attribute__(x) | 33 | # define __attribute__(x) |
@@ -32,18 +38,9 @@ | |||
32 | # define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) | 38 | # define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) |
33 | # endif | 39 | # endif |
34 | 40 | ||
35 | /* If this pointer is non-zero, run the specified function upon each | 41 | /* This function is always triggered when memory is exhausted. |
36 | allocation failure. It is initialized to zero. */ | 42 | It must be defined by the application, either explicitly |
37 | extern void (*xalloc_fail_func) (void); | 43 | or by using gnulib's xalloc-die module. This is the |
38 | |||
39 | /* If XALLOC_FAIL_FUNC is undefined or a function that returns, this | ||
40 | message is output. It is translated via gettext. | ||
41 | Its value is "memory exhausted". */ | ||
42 | extern char const xalloc_msg_memory_exhausted[]; | ||
43 | |||
44 | /* This function is always triggered when memory is exhausted. It is | ||
45 | in charge of honoring the two previous items. It exits with status | ||
46 | exit_failure (defined in exitfail.h). This is the | ||
47 | function to call when one wants the program to die because of a | 44 | function to call when one wants the program to die because of a |
48 | memory allocation failure. */ | 45 | memory allocation failure. */ |
49 | extern void xalloc_die (void) ATTRIBUTE_NORETURN; | 46 | extern void xalloc_die (void) ATTRIBUTE_NORETURN; |
@@ -56,8 +53,8 @@ void *xrealloc (void *p, size_t s); | |||
56 | void *xnrealloc (void *p, size_t n, size_t s); | 53 | void *xnrealloc (void *p, size_t n, size_t s); |
57 | void *x2realloc (void *p, size_t *pn); | 54 | void *x2realloc (void *p, size_t *pn); |
58 | void *x2nrealloc (void *p, size_t *pn, size_t s); | 55 | void *x2nrealloc (void *p, size_t *pn, size_t s); |
59 | void *xclone (void const *p, size_t s); | 56 | void *xmemdup (void const *p, size_t s); |
60 | char *xstrdup (const char *str); | 57 | char *xstrdup (char const *str); |
61 | 58 | ||
62 | /* Return 1 if an array of N objects, each of size S, cannot exist due | 59 | /* Return 1 if an array of N objects, each of size S, cannot exist due |
63 | to size arithmetic overflow. S must be positive and N must be | 60 | to size arithmetic overflow. S must be positive and N must be |
@@ -74,14 +71,9 @@ char *xstrdup (const char *str); | |||
74 | # define xalloc_oversized(n, s) \ | 71 | # define xalloc_oversized(n, s) \ |
75 | ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n)) | 72 | ((size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) < (n)) |
76 | 73 | ||
77 | /* These macros are deprecated; they will go away soon, and are retained | 74 | # ifdef __cplusplus |
78 | temporarily only to ease conversion to the functions described above. */ | 75 | } |
79 | # define CCLONE(p, n) xclone (p, (n) * sizeof *(p)) | 76 | # endif |
80 | # define CLONE(p) xclone (p, sizeof *(p)) | 77 | |
81 | # define NEW(type, var) type *var = xmalloc (sizeof (type)) | ||
82 | # define XCALLOC(type, n) xcalloc (n, sizeof (type)) | ||
83 | # define XMALLOC(type, n) xnmalloc (n, sizeof (type)) | ||
84 | # define XREALLOC(p, type, n) xnrealloc (p, n, sizeof (type)) | ||
85 | # define XFREE(p) free (p) | ||
86 | 78 | ||
87 | #endif /* !XALLOC_H_ */ | 79 | #endif /* !XALLOC_H_ */ |
diff --git a/lib/xmalloc.c b/lib/xmalloc.c index 181006b4..687633c2 100644 --- a/lib/xmalloc.c +++ b/lib/xmalloc.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* xmalloc.c -- malloc with out of memory checking | 1 | /* xmalloc.c -- malloc with out of memory checking |
2 | 2 | ||
3 | Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2003, | 3 | Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, |
4 | 1999, 2000, 2002, 2003 Free Software Foundation, Inc. | 4 | 1999, 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 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 | 7 | it under the terms of the GNU General Public License as published by |
@@ -15,9 +15,9 @@ | |||
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 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, | 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. */ | 18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
19 | 19 | ||
20 | #if HAVE_CONFIG_H | 20 | #ifdef HAVE_CONFIG_H |
21 | # include <config.h> | 21 | # include <config.h> |
22 | #endif | 22 | #endif |
23 | 23 | ||
@@ -26,44 +26,19 @@ | |||
26 | #include <stdlib.h> | 26 | #include <stdlib.h> |
27 | #include <string.h> | 27 | #include <string.h> |
28 | 28 | ||
29 | #include "gettext.h" | ||
30 | #define _(msgid) gettext (msgid) | ||
31 | #define N_(msgid) msgid | ||
32 | |||
33 | #include "error.h" | ||
34 | #include "exitfail.h" | ||
35 | |||
36 | #ifndef SIZE_MAX | 29 | #ifndef SIZE_MAX |
37 | # define SIZE_MAX ((size_t) -1) | 30 | # define SIZE_MAX ((size_t) -1) |
38 | #endif | 31 | #endif |
39 | 32 | ||
40 | #ifndef HAVE_MALLOC | 33 | /* 1 if calloc is known to be compatible with GNU calloc. This |
41 | "you must run the autoconf test for a GNU libc compatible malloc" | 34 | matters if we are not also using the calloc module, which defines |
42 | #endif | 35 | HAVE_CALLOC and supports the GNU API even on non-GNU platforms. */ |
43 | 36 | #if defined HAVE_CALLOC || defined __GLIBC__ | |
44 | #ifndef HAVE_REALLOC | 37 | enum { HAVE_GNU_CALLOC = 1 }; |
45 | "you must run the autoconf test for a GNU libc compatible realloc" | 38 | #else |
39 | enum { HAVE_GNU_CALLOC = 0 }; | ||
46 | #endif | 40 | #endif |
47 | 41 | ||
48 | /* If non NULL, call this function when memory is exhausted. */ | ||
49 | void (*xalloc_fail_func) (void) = 0; | ||
50 | |||
51 | /* If XALLOC_FAIL_FUNC is NULL, or does return, display this message | ||
52 | before exiting when memory is exhausted. Goes through gettext. */ | ||
53 | char const xalloc_msg_memory_exhausted[] = N_("memory exhausted"); | ||
54 | |||
55 | void | ||
56 | xalloc_die (void) | ||
57 | { | ||
58 | if (xalloc_fail_func) | ||
59 | (*xalloc_fail_func) (); | ||
60 | error (exit_failure, 0, "%s", _(xalloc_msg_memory_exhausted)); | ||
61 | /* The `noreturn' cannot be given to error, since it may return if | ||
62 | its first argument is 0. To help compilers understand the | ||
63 | xalloc_die does terminate, call abort. */ | ||
64 | abort (); | ||
65 | } | ||
66 | |||
67 | /* Allocate an array of N objects, each with S bytes of memory, | 42 | /* Allocate an array of N objects, each with S bytes of memory, |
68 | dynamically, with error checking. S must be nonzero. */ | 43 | dynamically, with error checking. S must be nonzero. */ |
69 | 44 | ||
@@ -71,7 +46,7 @@ static inline void * | |||
71 | xnmalloc_inline (size_t n, size_t s) | 46 | xnmalloc_inline (size_t n, size_t s) |
72 | { | 47 | { |
73 | void *p; | 48 | void *p; |
74 | if (xalloc_oversized (n, s) || ! (p = malloc (n * s))) | 49 | if (xalloc_oversized (n, s) || (! (p = malloc (n * s)) && n != 0)) |
75 | xalloc_die (); | 50 | xalloc_die (); |
76 | return p; | 51 | return p; |
77 | } | 52 | } |
@@ -96,7 +71,7 @@ xmalloc (size_t n) | |||
96 | static inline void * | 71 | static inline void * |
97 | xnrealloc_inline (void *p, size_t n, size_t s) | 72 | xnrealloc_inline (void *p, size_t n, size_t s) |
98 | { | 73 | { |
99 | if (xalloc_oversized (n, s) || ! (p = realloc (p, n * s))) | 74 | if (xalloc_oversized (n, s) || (! (p = realloc (p, n * s)) && n != 0)) |
100 | xalloc_die (); | 75 | xalloc_die (); |
101 | return p; | 76 | return p; |
102 | } | 77 | } |
@@ -238,18 +213,29 @@ xcalloc (size_t n, size_t s) | |||
238 | { | 213 | { |
239 | void *p; | 214 | void *p; |
240 | /* Test for overflow, since some calloc implementations don't have | 215 | /* Test for overflow, since some calloc implementations don't have |
241 | proper overflow checks. */ | 216 | proper overflow checks. But omit overflow and size-zero tests if |
242 | if (xalloc_oversized (n, s) || ! (p = calloc (n, s))) | 217 | HAVE_GNU_CALLOC, since GNU calloc catches overflow and never |
218 | returns NULL if successful. */ | ||
219 | if ((! HAVE_GNU_CALLOC && xalloc_oversized (n, s)) | ||
220 | || (! (p = calloc (n, s)) && (HAVE_GNU_CALLOC || n != 0))) | ||
243 | xalloc_die (); | 221 | xalloc_die (); |
244 | return p; | 222 | return p; |
245 | } | 223 | } |
246 | 224 | ||
247 | /* Clone an object P of size S, with error checking. There's no need | 225 | /* Clone an object P of size S, with error checking. There's no need |
248 | for xnclone (P, N, S), since xclone (P, N * S) works without any | 226 | for xnmemdup (P, N, S), since xmemdup (P, N * S) works without any |
249 | need for an arithmetic overflow check. */ | 227 | need for an arithmetic overflow check. */ |
250 | 228 | ||
251 | void * | 229 | void * |
252 | xclone (void const *p, size_t s) | 230 | xmemdup (void const *p, size_t s) |
253 | { | 231 | { |
254 | return memcpy (xmalloc (s), p, s); | 232 | return memcpy (xmalloc (s), p, s); |
255 | } | 233 | } |
234 | |||
235 | /* Clone STRING. */ | ||
236 | |||
237 | char * | ||
238 | xstrdup (char const *string) | ||
239 | { | ||
240 | return xmemdup (string, strlen (string) + 1); | ||
241 | } | ||
diff --git a/m4/.cvsignore b/m4/.cvsignore new file mode 100644 index 00000000..282522db --- /dev/null +++ b/m4/.cvsignore | |||
@@ -0,0 +1,2 @@ | |||
1 | Makefile | ||
2 | Makefile.in | ||
diff --git a/m4/Makefile.am b/m4/Makefile.am index ddb9d08a..404c0430 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am | |||
@@ -45,3 +45,6 @@ Makefile.am: Makefile.am.in | |||
45 | sed -n '/^Makefile\.am:/,$$p' $@.in >> $@t | 45 | sed -n '/^Makefile\.am:/,$$p' $@.in >> $@t |
46 | chmod a-w $@t | 46 | chmod a-w $@t |
47 | mv $@t $@ | 47 | mv $@t $@ |
48 | |||
49 | print_coreutil_files: | ||
50 | @echo $(EXTRA_DIST) | ||
@@ -1,13 +1,17 @@ | |||
1 | #serial 5 | 1 | #serial 8 |
2 | 2 | ||
3 | AC_DEFUN([jm_AFS], | 3 | # Copyright (C) 1999, 2000, 2001, 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 | AC_DEFUN([gl_AFS], | ||
4 | [ | 9 | [ |
5 | AC_MSG_CHECKING(for AFS) | 10 | AC_ARG_WITH(afs, |
6 | if test -d /afs; then | 11 | AC_HELP_STRING([--with-afs], |
12 | [support for the Andrew File System [[default=no]]]), | ||
13 | test "$withval" = no || with_afs=yes, with_afs=no) | ||
14 | if test "$with_afs" = yes; then | ||
7 | AC_DEFINE(AFS, 1, [Define if you have the Andrew File System.]) | 15 | AC_DEFINE(AFS, 1, [Define if you have the Andrew File System.]) |
8 | ac_result=yes | ||
9 | else | ||
10 | ac_result=no | ||
11 | fi | 16 | fi |
12 | AC_MSG_RESULT($ac_result) | ||
13 | ]) | 17 | ]) |
diff --git a/m4/codeset.m4 b/m4/codeset.m4 index 59535ebc..a6e67ec4 100644 --- a/m4/codeset.m4 +++ b/m4/codeset.m4 | |||
@@ -1,10 +1,8 @@ | |||
1 | # codeset.m4 serial AM1 (gettext-0.10.40) | 1 | # codeset.m4 serial AM1 (gettext-0.10.40) |
2 | dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | 6 | ||
9 | dnl From Bruno Haible. | 7 | dnl From Bruno Haible. |
10 | 8 | ||
diff --git a/m4/error.m4 b/m4/error.m4 index 0bc2e689..7c7746e2 100644 --- a/m4/error.m4 +++ b/m4/error.m4 | |||
@@ -1,14 +1,21 @@ | |||
1 | #serial 9 | 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. | ||
2 | 9 | ||
3 | AC_DEFUN([gl_ERROR], | 10 | AC_DEFUN([gl_ERROR], |
4 | [ | 11 | [ |
5 | AC_FUNC_ERROR_AT_LINE | 12 | AC_FUNC_ERROR_AT_LINE |
6 | dnl Note: AC_FUNC_ERROR_AT_LINE does AC_LIBSOURCES([error.h, error.c]). | 13 | dnl Note: AC_FUNC_ERROR_AT_LINE does AC_LIBSOURCES([error.h, error.c]). |
7 | jm_PREREQ_ERROR | 14 | gl_PREREQ_ERROR |
8 | ]) | 15 | ]) |
9 | 16 | ||
10 | # Prerequisites of lib/error.c. | 17 | # Prerequisites of lib/error.c. |
11 | AC_DEFUN([jm_PREREQ_ERROR], | 18 | AC_DEFUN([gl_PREREQ_ERROR], |
12 | [ | 19 | [ |
13 | AC_REQUIRE([AC_FUNC_STRERROR_R]) | 20 | AC_REQUIRE([AC_FUNC_STRERROR_R]) |
14 | : | 21 | : |
diff --git a/m4/exitfail.m4 b/m4/exitfail.m4 index fa5b1493..5523676f 100644 --- a/m4/exitfail.m4 +++ b/m4/exitfail.m4 | |||
@@ -1,13 +1,14 @@ | |||
1 | # exitfail.m4 serial 3 | 1 | # exitfail.m4 serial 5 |
2 | dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | 6 | ||
9 | AC_DEFUN([gl_EXITFAIL], | 7 | AC_DEFUN([gl_EXITFAIL], |
10 | [ | 8 | [ |
9 | AC_LIBSOURCES([exitfail.c, exitfail.h]) | ||
10 | AC_LIBOBJ([exitfail]) | ||
11 | |||
11 | dnl No prerequisites of lib/exitfail.c. | 12 | dnl No prerequisites of lib/exitfail.c. |
12 | : | 13 | : |
13 | ]) | 14 | ]) |
diff --git a/m4/extensions.m4 b/m4/extensions.m4 index 58bc0beb..e71845f1 100644 --- a/m4/extensions.m4 +++ b/m4/extensions.m4 | |||
@@ -1,12 +1,9 @@ | |||
1 | # Enable extensions on systems that normally disable them. | 1 | # Enable extensions on systems that normally disable them. |
2 | 2 | ||
3 | # Copyright (C) 2003 Free Software Foundation, Inc. | 3 | # Copyright (C) 2003 Free Software Foundation, Inc. |
4 | 4 | # This file is free software; the Free Software Foundation | |
5 | # This file is free software, distributed under the terms of the GNU | 5 | # gives unlimited permission to copy and/or distribute it, |
6 | # General Public License. As a special exception to the GNU General | 6 | # with or without modifications, as long as this notice is preserved. |
7 | # Public License, this file may be distributed as part of a program | ||
8 | # that contains a configuration script generated by Autoconf, under | ||
9 | # the same distribution terms as the rest of that program. | ||
10 | 7 | ||
11 | # gl_USE_SYSTEM_EXTENSIONS | 8 | # gl_USE_SYSTEM_EXTENSIONS |
12 | # ------------------------ | 9 | # ------------------------ |
@@ -24,6 +21,10 @@ AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], [ | |||
24 | [/* Enable extensions on Solaris. */ | 21 | [/* Enable extensions on Solaris. */ |
25 | #ifndef __EXTENSIONS__ | 22 | #ifndef __EXTENSIONS__ |
26 | # undef __EXTENSIONS__ | 23 | # undef __EXTENSIONS__ |
24 | #endif | ||
25 | #ifndef _POSIX_PTHREAD_SEMANTICS | ||
26 | # undef _POSIX_PTHREAD_SEMANTICS | ||
27 | #endif]) | 27 | #endif]) |
28 | AC_DEFINE([__EXTENSIONS__]) | 28 | AC_DEFINE([__EXTENSIONS__]) |
29 | AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) | ||
29 | ]) | 30 | ]) |
diff --git a/m4/fstypename.m4 b/m4/fstypename.m4 index 75723a14..7ff33e20 100644 --- a/m4/fstypename.m4 +++ b/m4/fstypename.m4 | |||
@@ -1,4 +1,4 @@ | |||
1 | #serial 3 | 1 | #serial 5 |
2 | 2 | ||
3 | dnl From Jim Meyering. | 3 | dnl From Jim Meyering. |
4 | dnl | 4 | dnl |
@@ -6,7 +6,12 @@ dnl See if struct statfs has the f_fstypename member. | |||
6 | dnl If so, define HAVE_F_FSTYPENAME_IN_STATFS. | 6 | dnl If so, define HAVE_F_FSTYPENAME_IN_STATFS. |
7 | dnl | 7 | dnl |
8 | 8 | ||
9 | AC_DEFUN([jm_FSTYPENAME], | 9 | # Copyright (C) 1998, 1999, 2001, 2004 Free Software Foundation, Inc. |
10 | # This file is free software; the Free Software Foundation | ||
11 | # gives unlimited permission to copy and/or distribute it, | ||
12 | # with or without modifications, as long as this notice is preserved. | ||
13 | |||
14 | AC_DEFUN([gl_FSTYPENAME], | ||
10 | [ | 15 | [ |
11 | AC_CACHE_CHECK([for f_fstypename in struct statfs], | 16 | AC_CACHE_CHECK([for f_fstypename in struct statfs], |
12 | fu_cv_sys_f_fstypename_in_statfs, | 17 | fu_cv_sys_f_fstypename_in_statfs, |
diff --git a/m4/fsusage.m4 b/m4/fsusage.m4 index a0ab1e15..dd10f799 100644 --- a/m4/fsusage.m4 +++ b/m4/fsusage.m4 | |||
@@ -1,28 +1,43 @@ | |||
1 | #serial 11 | 1 | #serial 16 |
2 | # Obtaining file system usage information. | ||
2 | 3 | ||
3 | # From fileutils/configure.in | 4 | # Copyright (C) 1997, 1998, 2000, 2001, 2003, 2004, 2005 Free Software |
5 | # Foundation, Inc. | ||
6 | # | ||
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 | # Written by Jim Meyering. | ||
4 | 12 | ||
5 | AC_DEFUN([gl_FSUSAGE], | 13 | AC_DEFUN([gl_FSUSAGE], |
6 | [ | 14 | [ |
15 | AC_LIBSOURCES([fsusage.c, fsusage.h]) | ||
16 | |||
7 | AC_CHECK_HEADERS_ONCE(sys/param.h) | 17 | AC_CHECK_HEADERS_ONCE(sys/param.h) |
8 | AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs_types.h) | 18 | AC_CHECK_HEADERS_ONCE(sys/vfs.h sys/fs_types.h) |
9 | jm_FILE_SYSTEM_USAGE([gl_cv_fs_space=yes], [gl_cv_fs_space=no]) | 19 | AC_CHECK_HEADERS(sys/mount.h, [], [], |
20 | [AC_INCLUDES_DEFAULT | ||
21 | [#if HAVE_SYS_PARAM_H | ||
22 | #include <sys/param.h> | ||
23 | #endif]]) | ||
24 | gl_FILE_SYSTEM_USAGE([gl_cv_fs_space=yes], [gl_cv_fs_space=no]) | ||
10 | if test $gl_cv_fs_space = yes; then | 25 | if test $gl_cv_fs_space = yes; then |
11 | AC_LIBOBJ(fsusage) | 26 | AC_LIBOBJ(fsusage) |
12 | gl_PREREQ_FSUSAGE_EXTRA | 27 | gl_PREREQ_FSUSAGE_EXTRA |
13 | fi | 28 | fi |
14 | ]) | 29 | ]) |
15 | 30 | ||
16 | # Try to determine how a program can obtain filesystem usage information. | 31 | # Try to determine how a program can obtain file system usage information. |
17 | # If successful, define the appropriate symbol (see fsusage.c) and | 32 | # If successful, define the appropriate symbol (see fsusage.c) and |
18 | # execute ACTION-IF-FOUND. Otherwise, execute ACTION-IF-NOT-FOUND. | 33 | # execute ACTION-IF-FOUND. Otherwise, execute ACTION-IF-NOT-FOUND. |
19 | # | 34 | # |
20 | # jm_FILE_SYSTEM_USAGE([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) | 35 | # gl_FILE_SYSTEM_USAGE([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) |
21 | 36 | ||
22 | AC_DEFUN([jm_FILE_SYSTEM_USAGE], | 37 | AC_DEFUN([gl_FILE_SYSTEM_USAGE], |
23 | [ | 38 | [ |
24 | 39 | ||
25 | echo "checking how to get filesystem space usage..." | 40 | echo "checking how to get file system space usage..." |
26 | ac_fsusage_space=no | 41 | ac_fsusage_space=no |
27 | 42 | ||
28 | # Perform only the link test since it seems there are no variants of the | 43 | # Perform only the link test since it seems there are no variants of the |
@@ -199,7 +214,7 @@ if test $ac_fsusage_space = no; then | |||
199 | AC_TRY_CPP([#include <sys/filsys.h> | 214 | AC_TRY_CPP([#include <sys/filsys.h> |
200 | ], | 215 | ], |
201 | AC_DEFINE(STAT_READ_FILSYS, 1, | 216 | AC_DEFINE(STAT_READ_FILSYS, 1, |
202 | [Define if there is no specific function for reading filesystems usage | 217 | [Define if there is no specific function for reading file systems usage |
203 | information and you have the <sys/filsys.h> header file. (SVR2)]) | 218 | information and you have the <sys/filsys.h> header file. (SVR2)]) |
204 | ac_fsusage_space=yes) | 219 | ac_fsusage_space=yes) |
205 | fi | 220 | fi |
@@ -212,7 +227,7 @@ AS_IF([test $ac_fsusage_space = yes], [$1], [$2]) | |||
212 | # Check for SunOS statfs brokenness wrt partitions 2GB and larger. | 227 | # Check for SunOS statfs brokenness wrt partitions 2GB and larger. |
213 | # If <sys/vfs.h> exists and struct statfs has a member named f_spare, | 228 | # If <sys/vfs.h> exists and struct statfs has a member named f_spare, |
214 | # enable the work-around code in fsusage.c. | 229 | # enable the work-around code in fsusage.c. |
215 | AC_DEFUN([jm_STATFS_TRUNCATES], | 230 | AC_DEFUN([gl_STATFS_TRUNCATES], |
216 | [ | 231 | [ |
217 | AC_MSG_CHECKING([for statfs that truncates block counts]) | 232 | AC_MSG_CHECKING([for statfs that truncates block counts]) |
218 | AC_CACHE_VAL(fu_cv_sys_truncating_statfs, | 233 | AC_CACHE_VAL(fu_cv_sys_truncating_statfs, |
@@ -236,11 +251,10 @@ choke -- this is a workaround for a Sun-specific problem | |||
236 | ]) | 251 | ]) |
237 | 252 | ||
238 | 253 | ||
239 | # Prerequisites of lib/fsusage.c not done by jm_FILE_SYSTEM_USAGE. | 254 | # Prerequisites of lib/fsusage.c not done by gl_FILE_SYSTEM_USAGE. |
240 | AC_DEFUN([gl_PREREQ_FSUSAGE_EXTRA], | 255 | AC_DEFUN([gl_PREREQ_FSUSAGE_EXTRA], |
241 | [ | 256 | [ |
242 | AC_REQUIRE([jm_AC_TYPE_UINTMAX_T]) | 257 | AC_REQUIRE([gl_AC_TYPE_UINTMAX_T]) |
243 | AC_CHECK_HEADERS_ONCE(fcntl.h) | ||
244 | AC_CHECK_HEADERS(dustat.h sys/fs/s5param.h sys/filsys.h sys/statfs.h sys/statvfs.h) | 258 | AC_CHECK_HEADERS(dustat.h sys/fs/s5param.h sys/filsys.h sys/statfs.h sys/statvfs.h) |
245 | jm_STATFS_TRUNCATES | 259 | gl_STATFS_TRUNCATES |
246 | ]) | 260 | ]) |
diff --git a/m4/getopt.m4 b/m4/getopt.m4 index df602b98..6b98782c 100644 --- a/m4/getopt.m4 +++ b/m4/getopt.m4 | |||
@@ -1,13 +1,80 @@ | |||
1 | # getopt.m4 serial 2 | 1 | # getopt.m4 serial 11 |
2 | dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | 6 | ||
9 | AC_DEFUN([gl_GETOPT], | 7 | # The getopt module assume you want GNU getopt, with getopt_long etc, |
8 | # rather than vanilla POSIX getopt. This means your your code should | ||
9 | # always include <getopt.h> for the getopt prototypes. | ||
10 | |||
11 | AC_DEFUN([gl_GETOPT_SUBSTITUTE], | ||
12 | [ | ||
13 | AC_LIBOBJ([getopt]) | ||
14 | AC_LIBOBJ([getopt1]) | ||
15 | gl_GETOPT_SUBSTITUTE_HEADER | ||
16 | gl_PREREQ_GETOPT | ||
17 | ]) | ||
18 | |||
19 | AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], | ||
10 | [ | 20 | [ |
11 | dnl Prerequisites of lib/getopt.c. | 21 | GETOPT_H=getopt.h |
12 | : | 22 | AC_DEFINE([__GETOPT_PREFIX], [[rpl_]], |
23 | [Define to rpl_ if the getopt replacement functions and variables | ||
24 | should be used.]) | ||
25 | AC_SUBST([GETOPT_H]) | ||
13 | ]) | 26 | ]) |
27 | |||
28 | AC_DEFUN([gl_GETOPT_CHECK_HEADERS], | ||
29 | [ | ||
30 | if test -z "$GETOPT_H"; then | ||
31 | AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h]) | ||
32 | fi | ||
33 | |||
34 | if test -z "$GETOPT_H"; then | ||
35 | AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h]) | ||
36 | fi | ||
37 | |||
38 | dnl BSD getopt_long uses an incompatible method to reset option processing, | ||
39 | dnl and (as of 2004-10-15) mishandles optional option-arguments. | ||
40 | if test -z "$GETOPT_H"; then | ||
41 | AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include <getopt.h>]) | ||
42 | fi | ||
43 | |||
44 | dnl Solaris 10 getopt doesn't handle `+' as a leading character in an | ||
45 | dnl option string (as of 2005-05-05). | ||
46 | if test -z "$GETOPT_H"; then | ||
47 | AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_gnu_getopt], | ||
48 | [AC_RUN_IFELSE( | ||
49 | [AC_LANG_PROGRAM([#include <getopt.h>], | ||
50 | [[ | ||
51 | char *myargv[3]; | ||
52 | myargv[0] = "conftest"; | ||
53 | myargv[1] = "-+"; | ||
54 | myargv[2] = 0; | ||
55 | return getopt (2, myargv, "+a") != '?'; | ||
56 | ]])], | ||
57 | [gl_cv_func_gnu_getopt=yes], | ||
58 | [gl_cv_func_gnu_getopt=no], | ||
59 | [dnl cross compiling - pessimistically guess based on decls | ||
60 | dnl Solaris 10 getopt doesn't handle `+' as a leading character in an | ||
61 | dnl option string (as of 2005-05-05). | ||
62 | AC_CHECK_DECL([getopt_clip], | ||
63 | [gl_cv_func_gnu_getopt=no], [gl_cv_func_gnu_getopt=yes], | ||
64 | [#include <getopt.h>])])]) | ||
65 | if test "$gl_cv_func_gnu_getopt" = "no"; then | ||
66 | GETOPT_H=getopt.h | ||
67 | fi | ||
68 | fi | ||
69 | ]) | ||
70 | |||
71 | AC_DEFUN([gl_GETOPT_IFELSE], | ||
72 | [ | ||
73 | AC_REQUIRE([gl_GETOPT_CHECK_HEADERS]) | ||
74 | AS_IF([test -n "$GETOPT_H"], [$1], [$2]) | ||
75 | ]) | ||
76 | |||
77 | AC_DEFUN([gl_GETOPT], [gl_GETOPT_IFELSE([gl_GETOPT_SUBSTITUTE])]) | ||
78 | |||
79 | # Prerequisites of lib/getopt*. | ||
80 | AC_DEFUN([gl_PREREQ_GETOPT], [:]) | ||
diff --git a/m4/gettext.m4 b/m4/gettext.m4 index 45cad855..624a8078 100644 --- a/m4/gettext.m4 +++ b/m4/gettext.m4 | |||
@@ -1,10 +1,8 @@ | |||
1 | # gettext.m4 serial 17 (gettext-0.11.5) | 1 | # gettext.m4 serial 37 (gettext-0.14.4) |
2 | dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 1995-2005 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl with or without modifications, as long as this notice is preserved. |
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 | 6 | dnl |
9 | dnl This file can can be used in projects which are not available under | 7 | 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 | 8 | dnl the GNU General Public License or the GNU Library General Public |
@@ -17,7 +15,7 @@ dnl They are *not* in the public domain. | |||
17 | 15 | ||
18 | dnl Authors: | 16 | dnl Authors: |
19 | dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. | 17 | dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. |
20 | dnl Bruno Haible <haible@clisp.cons.org>, 2000-2002. | 18 | dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003. |
21 | 19 | ||
22 | dnl Macro to add for using GNU gettext. | 20 | dnl Macro to add for using GNU gettext. |
23 | 21 | ||
@@ -65,8 +63,8 @@ AC_DEFUN([AM_GNU_GETTEXT], | |||
65 | ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , | 63 | ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , |
66 | [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT | 64 | [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT |
67 | ])])])]) | 65 | ])])])]) |
68 | define(gt_included_intl, ifelse([$1], [external], [no], [yes])) | 66 | define([gt_included_intl], ifelse([$1], [external], [no], [yes])) |
69 | define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], [])) | 67 | define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], [])) |
70 | 68 | ||
71 | AC_REQUIRE([AM_PO_SUBDIRS])dnl | 69 | AC_REQUIRE([AM_PO_SUBDIRS])dnl |
72 | ifelse(gt_included_intl, yes, [ | 70 | ifelse(gt_included_intl, yes, [ |
@@ -92,13 +90,11 @@ AC_DEFUN([AM_GNU_GETTEXT], | |||
92 | AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) | 90 | AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) |
93 | ]) | 91 | ]) |
94 | 92 | ||
95 | AC_MSG_CHECKING([whether NLS is requested]) | 93 | dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation. |
96 | dnl Default is enabled NLS | 94 | gt_INTL_MACOSX |
97 | AC_ARG_ENABLE(nls, | 95 | |
98 | [ --disable-nls do not use Native Language Support], | 96 | dnl Set USE_NLS. |
99 | USE_NLS=$enableval, USE_NLS=yes) | 97 | AM_NLS |
100 | AC_MSG_RESULT($USE_NLS) | ||
101 | AC_SUBST(USE_NLS) | ||
102 | 98 | ||
103 | ifelse(gt_included_intl, yes, [ | 99 | ifelse(gt_included_intl, yes, [ |
104 | BUILD_INCLUDED_LIBINTL=no | 100 | BUILD_INCLUDED_LIBINTL=no |
@@ -143,7 +139,7 @@ changequote([,])dnl | |||
143 | ], [])[extern int _nl_msg_cat_cntr; | 139 | ], [])[extern int _nl_msg_cat_cntr; |
144 | extern int *_nl_domain_bindings;], | 140 | extern int *_nl_domain_bindings;], |
145 | [bindtextdomain ("", ""); | 141 | [bindtextdomain ("", ""); |
146 | return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings], | 142 | return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings], |
147 | gt_cv_func_gnugettext_libc=yes, | 143 | gt_cv_func_gnugettext_libc=yes, |
148 | gt_cv_func_gnugettext_libc=no)]) | 144 | gt_cv_func_gnugettext_libc=no)]) |
149 | 145 | ||
@@ -177,9 +173,9 @@ extern | |||
177 | #ifdef __cplusplus | 173 | #ifdef __cplusplus |
178 | "C" | 174 | "C" |
179 | #endif | 175 | #endif |
180 | const char *_nl_expand_alias ();], | 176 | const char *_nl_expand_alias (const char *);], |
181 | [bindtextdomain ("", ""); | 177 | [bindtextdomain ("", ""); |
182 | return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], | 178 | return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias ("")], |
183 | gt_cv_func_gnugettext_libintl=yes, | 179 | gt_cv_func_gnugettext_libintl=yes, |
184 | gt_cv_func_gnugettext_libintl=no) | 180 | gt_cv_func_gnugettext_libintl=no) |
185 | dnl Now see whether libintl exists and depends on libiconv. | 181 | dnl Now see whether libintl exists and depends on libiconv. |
@@ -198,9 +194,9 @@ extern | |||
198 | #ifdef __cplusplus | 194 | #ifdef __cplusplus |
199 | "C" | 195 | "C" |
200 | #endif | 196 | #endif |
201 | const char *_nl_expand_alias ();], | 197 | const char *_nl_expand_alias (const char *);], |
202 | [bindtextdomain ("", ""); | 198 | [bindtextdomain ("", ""); |
203 | return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], | 199 | return * gettext ("")]ifelse([$2], [need-ngettext], [ + * ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias ("")], |
204 | [LIBINTL="$LIBINTL $LIBICONV" | 200 | [LIBINTL="$LIBINTL $LIBICONV" |
205 | LTLIBINTL="$LTLIBINTL $LTLIBICONV" | 201 | LTLIBINTL="$LTLIBINTL $LTLIBICONV" |
206 | gt_cv_func_gnugettext_libintl=yes | 202 | gt_cv_func_gnugettext_libintl=yes |
@@ -216,7 +212,8 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", | |||
216 | dnl libintl. (Cf. the install rule in intl/Makefile.in.) | 212 | dnl libintl. (Cf. the install rule in intl/Makefile.in.) |
217 | if test "$gt_cv_func_gnugettext_libc" = "yes" \ | 213 | if test "$gt_cv_func_gnugettext_libc" = "yes" \ |
218 | || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ | 214 | || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ |
219 | && test "$PACKAGE" != gettext; }; then | 215 | && test "$PACKAGE" != gettext-runtime \ |
216 | && test "$PACKAGE" != gettext-tools; }; then | ||
220 | gt_use_preinstalled_gnugettext=yes | 217 | gt_use_preinstalled_gnugettext=yes |
221 | else | 218 | else |
222 | dnl Reset the values set by searching for libintl. | 219 | dnl Reset the values set by searching for libintl. |
@@ -235,7 +232,6 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", | |||
235 | 232 | ||
236 | if test "$nls_cv_use_gnu_gettext" = "yes"; then | 233 | if test "$nls_cv_use_gnu_gettext" = "yes"; then |
237 | dnl Mark actions used to generate GNU NLS library. | 234 | dnl Mark actions used to generate GNU NLS library. |
238 | INTLOBJS="\$(GETTOBJS)" | ||
239 | BUILD_INCLUDED_LIBINTL=yes | 235 | BUILD_INCLUDED_LIBINTL=yes |
240 | USE_INCLUDED_LIBINTL=yes | 236 | USE_INCLUDED_LIBINTL=yes |
241 | LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV" | 237 | LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV" |
@@ -243,6 +239,7 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", | |||
243 | LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` | 239 | LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` |
244 | fi | 240 | fi |
245 | 241 | ||
242 | CATOBJEXT= | ||
246 | if test "$gt_use_preinstalled_gnugettext" = "yes" \ | 243 | if test "$gt_use_preinstalled_gnugettext" = "yes" \ |
247 | || test "$nls_cv_use_gnu_gettext" = "yes"; then | 244 | || test "$nls_cv_use_gnu_gettext" = "yes"; then |
248 | dnl Mark actions to use GNU gettext tools. | 245 | dnl Mark actions to use GNU gettext tools. |
@@ -250,6 +247,15 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", | |||
250 | fi | 247 | fi |
251 | ]) | 248 | ]) |
252 | 249 | ||
250 | if test -n "$INTL_MACOSX_LIBS"; then | ||
251 | if test "$gt_use_preinstalled_gnugettext" = "yes" \ | ||
252 | || test "$nls_cv_use_gnu_gettext" = "yes"; then | ||
253 | dnl Some extra flags are needed during linking. | ||
254 | LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" | ||
255 | LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" | ||
256 | fi | ||
257 | fi | ||
258 | |||
253 | if test "$gt_use_preinstalled_gnugettext" = "yes" \ | 259 | if test "$gt_use_preinstalled_gnugettext" = "yes" \ |
254 | || test "$nls_cv_use_gnu_gettext" = "yes"; then | 260 | || test "$nls_cv_use_gnu_gettext" = "yes"; then |
255 | AC_DEFINE(ENABLE_NLS, 1, | 261 | AC_DEFINE(ENABLE_NLS, 1, |
@@ -260,6 +266,22 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", | |||
260 | fi | 266 | fi |
261 | fi | 267 | fi |
262 | 268 | ||
269 | AC_MSG_CHECKING([whether to use NLS]) | ||
270 | AC_MSG_RESULT([$USE_NLS]) | ||
271 | if test "$USE_NLS" = "yes"; then | ||
272 | AC_MSG_CHECKING([where the gettext function comes from]) | ||
273 | if test "$gt_use_preinstalled_gnugettext" = "yes"; then | ||
274 | if test "$gt_cv_func_gnugettext_libintl" = "yes"; then | ||
275 | gt_source="external libintl" | ||
276 | else | ||
277 | gt_source="libc" | ||
278 | fi | ||
279 | else | ||
280 | gt_source="included intl directory" | ||
281 | fi | ||
282 | AC_MSG_RESULT([$gt_source]) | ||
283 | fi | ||
284 | |||
263 | if test "$USE_NLS" = "yes"; then | 285 | if test "$USE_NLS" = "yes"; then |
264 | 286 | ||
265 | if test "$gt_use_preinstalled_gnugettext" = "yes"; then | 287 | if test "$gt_use_preinstalled_gnugettext" = "yes"; then |
@@ -283,7 +305,7 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", | |||
283 | ifelse(gt_included_intl, yes, [ | 305 | ifelse(gt_included_intl, yes, [ |
284 | dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL | 306 | dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL |
285 | dnl to 'yes' because some of the testsuite requires it. | 307 | dnl to 'yes' because some of the testsuite requires it. |
286 | if test "$PACKAGE" = gettext; then | 308 | if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then |
287 | BUILD_INCLUDED_LIBINTL=yes | 309 | BUILD_INCLUDED_LIBINTL=yes |
288 | fi | 310 | fi |
289 | 311 | ||
@@ -291,7 +313,6 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", | |||
291 | AC_SUBST(BUILD_INCLUDED_LIBINTL) | 313 | AC_SUBST(BUILD_INCLUDED_LIBINTL) |
292 | AC_SUBST(USE_INCLUDED_LIBINTL) | 314 | AC_SUBST(USE_INCLUDED_LIBINTL) |
293 | AC_SUBST(CATOBJEXT) | 315 | AC_SUBST(CATOBJEXT) |
294 | AC_SUBST(INTLOBJS) | ||
295 | 316 | ||
296 | dnl For backward compatibility. Some configure.ins may be using this. | 317 | dnl For backward compatibility. Some configure.ins may be using this. |
297 | nls_cv_header_intl= | 318 | nls_cv_header_intl= |
@@ -309,6 +330,13 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", | |||
309 | GENCAT=gencat | 330 | GENCAT=gencat |
310 | AC_SUBST(GENCAT) | 331 | AC_SUBST(GENCAT) |
311 | 332 | ||
333 | dnl For backward compatibility. Some Makefiles may be using this. | ||
334 | INTLOBJS= | ||
335 | if test "$USE_INCLUDED_LIBINTL" = yes; then | ||
336 | INTLOBJS="\$(GETTOBJS)" | ||
337 | fi | ||
338 | AC_SUBST(INTLOBJS) | ||
339 | |||
312 | dnl Enable libtool support if the surrounding package wishes it. | 340 | dnl Enable libtool support if the surrounding package wishes it. |
313 | INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix | 341 | INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix |
314 | AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) | 342 | AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) |
@@ -325,179 +353,6 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", | |||
325 | ]) | 353 | ]) |
326 | 354 | ||
327 | 355 | ||
328 | dnl Checks for all prerequisites of the po subdirectory, | ||
329 | dnl except for USE_NLS. | ||
330 | AC_DEFUN([AM_PO_SUBDIRS], | ||
331 | [ | ||
332 | AC_REQUIRE([AC_PROG_MAKE_SET])dnl | ||
333 | AC_REQUIRE([AC_PROG_INSTALL])dnl | ||
334 | AC_REQUIRE([AM_MKINSTALLDIRS])dnl | ||
335 | |||
336 | dnl Perform the following tests also if --disable-nls has been given, | ||
337 | dnl because they are needed for "make dist" to work. | ||
338 | |||
339 | dnl Search for GNU msgfmt in the PATH. | ||
340 | dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. | ||
341 | dnl The second test excludes FreeBSD msgfmt. | ||
342 | AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, | ||
343 | [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && | ||
344 | (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], | ||
345 | :) | ||
346 | AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) | ||
347 | |||
348 | dnl Search for GNU xgettext 0.11 or newer in the PATH. | ||
349 | dnl The first test excludes Solaris xgettext and early GNU xgettext versions. | ||
350 | dnl The second test excludes FreeBSD xgettext. | ||
351 | AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, | ||
352 | [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && | ||
353 | (if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], | ||
354 | :) | ||
355 | dnl Remove leftover from FreeBSD xgettext call. | ||
356 | rm -f messages.po | ||
357 | |||
358 | dnl Search for GNU msgmerge 0.11 or newer in the PATH. | ||
359 | AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, | ||
360 | [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :) | ||
361 | |||
362 | dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. | ||
363 | dnl Test whether we really found GNU msgfmt. | ||
364 | if test "$GMSGFMT" != ":"; then | ||
365 | dnl If it is no GNU msgfmt we define it as : so that the | ||
366 | dnl Makefiles still can work. | ||
367 | if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && | ||
368 | (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then | ||
369 | : ; | ||
370 | else | ||
371 | GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` | ||
372 | AC_MSG_RESULT( | ||
373 | [found $GMSGFMT program is not GNU msgfmt; ignore it]) | ||
374 | GMSGFMT=":" | ||
375 | fi | ||
376 | fi | ||
377 | |||
378 | dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. | ||
379 | dnl Test whether we really found GNU xgettext. | ||
380 | if test "$XGETTEXT" != ":"; then | ||
381 | dnl If it is no GNU xgettext we define it as : so that the | ||
382 | dnl Makefiles still can work. | ||
383 | if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && | ||
384 | (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then | ||
385 | : ; | ||
386 | else | ||
387 | AC_MSG_RESULT( | ||
388 | [found xgettext program is not GNU xgettext; ignore it]) | ||
389 | XGETTEXT=":" | ||
390 | fi | ||
391 | dnl Remove leftover from FreeBSD xgettext call. | ||
392 | rm -f messages.po | ||
393 | fi | ||
394 | |||
395 | AC_OUTPUT_COMMANDS([ | ||
396 | for ac_file in $CONFIG_FILES; do | ||
397 | # Support "outfile[:infile[:infile...]]" | ||
398 | case "$ac_file" in | ||
399 | *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; | ||
400 | esac | ||
401 | # PO directories have a Makefile.in generated from Makefile.in.in. | ||
402 | case "$ac_file" in */Makefile.in) | ||
403 | # Adjust a relative srcdir. | ||
404 | ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` | ||
405 | ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" | ||
406 | ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` | ||
407 | # In autoconf-2.13 it is called $ac_given_srcdir. | ||
408 | # In autoconf-2.50 it is called $srcdir. | ||
409 | test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" | ||
410 | case "$ac_given_srcdir" in | ||
411 | .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; | ||
412 | /*) top_srcdir="$ac_given_srcdir" ;; | ||
413 | *) top_srcdir="$ac_dots$ac_given_srcdir" ;; | ||
414 | esac | ||
415 | if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then | ||
416 | rm -f "$ac_dir/POTFILES" | ||
417 | test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" | ||
418 | cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" | ||
419 | # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend | ||
420 | # on $ac_dir but don't depend on user-specified configuration | ||
421 | # parameters. | ||
422 | if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then | ||
423 | # The LINGUAS file contains the set of available languages. | ||
424 | if test -n "$ALL_LINGUAS"; then | ||
425 | test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" | ||
426 | fi | ||
427 | ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` | ||
428 | # Hide the ALL_LINGUAS assigment from automake. | ||
429 | eval 'ALL_LINGUAS''=$ALL_LINGUAS_' | ||
430 | fi | ||
431 | case "$ac_given_srcdir" in | ||
432 | .) srcdirpre= ;; | ||
433 | *) srcdirpre='$(srcdir)/' ;; | ||
434 | esac | ||
435 | POFILES= | ||
436 | GMOFILES= | ||
437 | UPDATEPOFILES= | ||
438 | DUMMYPOFILES= | ||
439 | for lang in $ALL_LINGUAS; do | ||
440 | POFILES="$POFILES $srcdirpre$lang.po" | ||
441 | GMOFILES="$GMOFILES $srcdirpre$lang.gmo" | ||
442 | UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" | ||
443 | DUMMYPOFILES="$DUMMYPOFILES $lang.nop" | ||
444 | done | ||
445 | # CATALOGS depends on both $ac_dir and the user's LINGUAS | ||
446 | # environment variable. | ||
447 | INST_LINGUAS= | ||
448 | if test -n "$ALL_LINGUAS"; then | ||
449 | for presentlang in $ALL_LINGUAS; do | ||
450 | useit=no | ||
451 | if test "%UNSET%" != "$LINGUAS"; then | ||
452 | desiredlanguages="$LINGUAS" | ||
453 | else | ||
454 | desiredlanguages="$ALL_LINGUAS" | ||
455 | fi | ||
456 | for desiredlang in $desiredlanguages; do | ||
457 | # Use the presentlang catalog if desiredlang is | ||
458 | # a. equal to presentlang, or | ||
459 | # b. a variant of presentlang (because in this case, | ||
460 | # presentlang can be used as a fallback for messages | ||
461 | # which are not translated in the desiredlang catalog). | ||
462 | case "$desiredlang" in | ||
463 | "$presentlang"*) useit=yes;; | ||
464 | esac | ||
465 | done | ||
466 | if test $useit = yes; then | ||
467 | INST_LINGUAS="$INST_LINGUAS $presentlang" | ||
468 | fi | ||
469 | done | ||
470 | fi | ||
471 | CATALOGS= | ||
472 | if test -n "$INST_LINGUAS"; then | ||
473 | for lang in $INST_LINGUAS; do | ||
474 | CATALOGS="$CATALOGS $lang.gmo" | ||
475 | done | ||
476 | fi | ||
477 | test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" | ||
478 | sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" | ||
479 | for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do | ||
480 | if test -f "$f"; then | ||
481 | case "$f" in | ||
482 | *.orig | *.bak | *~) ;; | ||
483 | *) cat "$f" >> "$ac_dir/Makefile" ;; | ||
484 | esac | ||
485 | fi | ||
486 | done | ||
487 | fi | ||
488 | ;; | ||
489 | esac | ||
490 | done], | ||
491 | [# Capture the value of obsolete ALL_LINGUAS because we need it to compute | ||
492 | # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it | ||
493 | # from automake. | ||
494 | eval 'ALL_LINGUAS''="$ALL_LINGUAS"' | ||
495 | # Capture the value of LINGUAS because we need it to compute CATALOGS. | ||
496 | LINGUAS="${LINGUAS-%UNSET%}" | ||
497 | ]) | ||
498 | ]) | ||
499 | |||
500 | |||
501 | dnl Checks for all prerequisites of the intl subdirectory, | 356 | dnl Checks for all prerequisites of the intl subdirectory, |
502 | dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, | 357 | dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, |
503 | dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. | 358 | dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. |
@@ -507,31 +362,90 @@ AC_DEFUN([AM_INTL_SUBDIR], | |||
507 | AC_REQUIRE([AM_MKINSTALLDIRS])dnl | 362 | AC_REQUIRE([AM_MKINSTALLDIRS])dnl |
508 | AC_REQUIRE([AC_PROG_CC])dnl | 363 | AC_REQUIRE([AC_PROG_CC])dnl |
509 | AC_REQUIRE([AC_CANONICAL_HOST])dnl | 364 | AC_REQUIRE([AC_CANONICAL_HOST])dnl |
365 | AC_REQUIRE([gt_GLIBC2])dnl | ||
510 | AC_REQUIRE([AC_PROG_RANLIB])dnl | 366 | AC_REQUIRE([AC_PROG_RANLIB])dnl |
511 | AC_REQUIRE([AC_ISC_POSIX])dnl | 367 | AC_REQUIRE([AC_ISC_POSIX])dnl |
512 | AC_REQUIRE([AC_HEADER_STDC])dnl | 368 | AC_REQUIRE([AC_HEADER_STDC])dnl |
513 | AC_REQUIRE([AC_C_CONST])dnl | 369 | AC_REQUIRE([AC_C_CONST])dnl |
370 | AC_REQUIRE([bh_C_SIGNED])dnl | ||
514 | AC_REQUIRE([AC_C_INLINE])dnl | 371 | AC_REQUIRE([AC_C_INLINE])dnl |
515 | AC_REQUIRE([AC_TYPE_OFF_T])dnl | 372 | AC_REQUIRE([AC_TYPE_OFF_T])dnl |
516 | AC_REQUIRE([AC_TYPE_SIZE_T])dnl | 373 | AC_REQUIRE([AC_TYPE_SIZE_T])dnl |
374 | AC_REQUIRE([gl_AC_TYPE_LONG_LONG])dnl | ||
375 | AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl | ||
376 | AC_REQUIRE([gt_TYPE_WCHAR_T])dnl | ||
377 | AC_REQUIRE([gt_TYPE_WINT_T])dnl | ||
378 | AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) | ||
379 | AC_REQUIRE([gl_AC_HEADER_STDINT_H]) | ||
380 | AC_REQUIRE([gt_TYPE_INTMAX_T]) | ||
381 | AC_REQUIRE([gt_PRINTF_POSIX]) | ||
517 | AC_REQUIRE([AC_FUNC_ALLOCA])dnl | 382 | AC_REQUIRE([AC_FUNC_ALLOCA])dnl |
518 | AC_REQUIRE([AC_FUNC_MMAP])dnl | 383 | AC_REQUIRE([AC_FUNC_MMAP])dnl |
519 | AC_REQUIRE([jm_GLIBC21])dnl | 384 | AC_REQUIRE([gl_GLIBC21])dnl |
520 | AC_REQUIRE([gt_INTDIV0])dnl | 385 | AC_REQUIRE([gt_INTDIV0])dnl |
521 | AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl | 386 | AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])dnl |
522 | AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl | 387 | AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl |
523 | AC_REQUIRE([gt_INTTYPES_PRI])dnl | 388 | AC_REQUIRE([gt_INTTYPES_PRI])dnl |
389 | AC_REQUIRE([gl_XSIZE])dnl | ||
390 | AC_REQUIRE([gt_INTL_MACOSX])dnl | ||
524 | 391 | ||
392 | AC_CHECK_TYPE([ptrdiff_t], , | ||
393 | [AC_DEFINE([ptrdiff_t], [long], | ||
394 | [Define as the type of the result of subtracting two pointers, if the system doesn't define it.]) | ||
395 | ]) | ||
525 | AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ | 396 | AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ |
526 | stdlib.h string.h unistd.h sys/param.h]) | 397 | stdlib.h string.h unistd.h sys/param.h]) |
527 | AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ | 398 | AC_CHECK_FUNCS([asprintf fwprintf getcwd getegid geteuid getgid getuid \ |
528 | geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ | 399 | mempcpy munmap putenv setenv setlocale snprintf stpcpy strcasecmp strdup \ |
529 | strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) | 400 | strtoul tsearch wcslen __argz_count __argz_stringify __argz_next \ |
401 | __fsetlocking]) | ||
402 | |||
403 | dnl Use the _snprintf function only if it is declared (because on NetBSD it | ||
404 | dnl is defined as a weak alias of snprintf; we prefer to use the latter). | ||
405 | gt_CHECK_DECL(_snprintf, [#include <stdio.h>]) | ||
406 | gt_CHECK_DECL(_snwprintf, [#include <stdio.h>]) | ||
407 | |||
408 | dnl Use the *_unlocked functions only if they are declared. | ||
409 | dnl (because some of them were defined without being declared in Solaris | ||
410 | dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built | ||
411 | dnl on Solaris 2.5.1 to run on Solaris 2.6). | ||
412 | dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13. | ||
413 | gt_CHECK_DECL(feof_unlocked, [#include <stdio.h>]) | ||
414 | gt_CHECK_DECL(fgets_unlocked, [#include <stdio.h>]) | ||
415 | gt_CHECK_DECL(getc_unlocked, [#include <stdio.h>]) | ||
416 | |||
417 | case $gt_cv_func_printf_posix in | ||
418 | *yes) HAVE_POSIX_PRINTF=1 ;; | ||
419 | *) HAVE_POSIX_PRINTF=0 ;; | ||
420 | esac | ||
421 | AC_SUBST([HAVE_POSIX_PRINTF]) | ||
422 | if test "$ac_cv_func_asprintf" = yes; then | ||
423 | HAVE_ASPRINTF=1 | ||
424 | else | ||
425 | HAVE_ASPRINTF=0 | ||
426 | fi | ||
427 | AC_SUBST([HAVE_ASPRINTF]) | ||
428 | if test "$ac_cv_func_snprintf" = yes; then | ||
429 | HAVE_SNPRINTF=1 | ||
430 | else | ||
431 | HAVE_SNPRINTF=0 | ||
432 | fi | ||
433 | AC_SUBST([HAVE_SNPRINTF]) | ||
434 | if test "$ac_cv_func_wprintf" = yes; then | ||
435 | HAVE_WPRINTF=1 | ||
436 | else | ||
437 | HAVE_WPRINTF=0 | ||
438 | fi | ||
439 | AC_SUBST([HAVE_WPRINTF]) | ||
530 | 440 | ||
531 | AM_ICONV | 441 | AM_ICONV |
532 | AM_LANGINFO_CODESET | 442 | AM_LANGINFO_CODESET |
533 | if test $ac_cv_header_locale_h = yes; then | 443 | if test $ac_cv_header_locale_h = yes; then |
534 | AM_LC_MESSAGES | 444 | gt_LC_MESSAGES |
445 | fi | ||
446 | |||
447 | if test -n "$INTL_MACOSX_LIBS"; then | ||
448 | CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" | ||
535 | fi | 449 | fi |
536 | 450 | ||
537 | dnl intl/plural.c is generated from intl/plural.y. It requires bison, | 451 | dnl intl/plural.c is generated from intl/plural.y. It requires bison, |
@@ -567,19 +481,67 @@ changequote([,])dnl | |||
567 | ]) | 481 | ]) |
568 | 482 | ||
569 | 483 | ||
570 | AC_DEFUN([AM_MKINSTALLDIRS], | 484 | dnl Checks for special options needed on MacOS X. |
485 | dnl Defines INTL_MACOSX_LIBS. | ||
486 | AC_DEFUN([gt_INTL_MACOSX], | ||
571 | [ | 487 | [ |
572 | dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly | 488 | dnl Check for API introduced in MacOS X 10.2. |
573 | dnl find the mkinstalldirs script in another subdir but $(top_srcdir). | 489 | AC_CACHE_CHECK([for CFPreferencesCopyAppValue], |
574 | dnl Try to locate is. | 490 | gt_cv_func_CFPreferencesCopyAppValue, |
575 | MKINSTALLDIRS= | 491 | [gt_save_CPPFLAGS="$CPPFLAGS" |
576 | if test -n "$ac_aux_dir"; then | 492 | CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" |
577 | MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" | 493 | gt_save_LIBS="$LIBS" |
494 | LIBS="$LIBS -framework CoreFoundation" | ||
495 | AC_TRY_LINK([#include <CFPreferences.h>], | ||
496 | [CFPreferencesCopyAppValue(NULL, NULL)], | ||
497 | [gt_cv_func_CFPreferencesCopyAppValue=yes], | ||
498 | [gt_cv_func_CFPreferencesCopyAppValue=no]) | ||
499 | CPPFLAGS="$gt_save_CPPFLAGS" | ||
500 | LIBS="$gt_save_LIBS"]) | ||
501 | if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then | ||
502 | AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], 1, | ||
503 | [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) | ||
504 | fi | ||
505 | dnl Check for API introduced in MacOS X 10.3. | ||
506 | AC_CACHE_CHECK([for CFLocaleCopyCurrent], gt_cv_func_CFLocaleCopyCurrent, | ||
507 | [gt_save_CPPFLAGS="$CPPFLAGS" | ||
508 | CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers" | ||
509 | gt_save_LIBS="$LIBS" | ||
510 | LIBS="$LIBS -framework CoreFoundation" | ||
511 | AC_TRY_LINK([#include <CFLocale.h>], [CFLocaleCopyCurrent();], | ||
512 | [gt_cv_func_CFLocaleCopyCurrent=yes], | ||
513 | [gt_cv_func_CFLocaleCopyCurrent=no]) | ||
514 | CPPFLAGS="$gt_save_CPPFLAGS" | ||
515 | LIBS="$gt_save_LIBS"]) | ||
516 | if test $gt_cv_func_CFLocaleCopyCurrent = yes; then | ||
517 | AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], 1, | ||
518 | [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.]) | ||
519 | fi | ||
520 | INTL_MACOSX_LIBS= | ||
521 | if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then | ||
522 | INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" | ||
578 | fi | 523 | fi |
579 | if test -z "$MKINSTALLDIRS"; then | 524 | AC_SUBST([INTL_MACOSX_LIBS]) |
580 | MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" | 525 | ]) |
526 | |||
527 | |||
528 | dnl gt_CHECK_DECL(FUNC, INCLUDES) | ||
529 | dnl Check whether a function is declared. | ||
530 | AC_DEFUN([gt_CHECK_DECL], | ||
531 | [ | ||
532 | AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1, | ||
533 | [AC_TRY_COMPILE([$2], [ | ||
534 | #ifndef $1 | ||
535 | char *p = (char *) $1; | ||
536 | #endif | ||
537 | ], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)]) | ||
538 | if test $ac_cv_have_decl_$1 = yes; then | ||
539 | gt_value=1 | ||
540 | else | ||
541 | gt_value=0 | ||
581 | fi | 542 | fi |
582 | AC_SUBST(MKINSTALLDIRS) | 543 | AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value], |
544 | [Define to 1 if you have the declaration of `$1', and to 0 if you don't.]) | ||
583 | ]) | 545 | ]) |
584 | 546 | ||
585 | 547 | ||
diff --git a/m4/glibc21.m4 b/m4/glibc21.m4 index 9c9f3db3..d95fd986 100644 --- a/m4/glibc21.m4 +++ b/m4/glibc21.m4 | |||
@@ -1,15 +1,13 @@ | |||
1 | # glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40) | 1 | # glibc21.m4 serial 3 |
2 | dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2000-2002, 2004 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | 6 | ||
9 | # Test for the GNU C Library, version 2.1 or newer. | 7 | # Test for the GNU C Library, version 2.1 or newer. |
10 | # From Bruno Haible. | 8 | # From Bruno Haible. |
11 | 9 | ||
12 | AC_DEFUN([jm_GLIBC21], | 10 | AC_DEFUN([gl_GLIBC21], |
13 | [ | 11 | [ |
14 | AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, | 12 | AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, |
15 | ac_cv_gnu_library_2_1, | 13 | ac_cv_gnu_library_2_1, |
diff --git a/m4/iconv.m4 b/m4/iconv.m4 index c5f35798..654c4158 100644 --- a/m4/iconv.m4 +++ b/m4/iconv.m4 | |||
@@ -1,10 +1,8 @@ | |||
1 | # iconv.m4 serial AM4 (gettext-0.11.3) | 1 | # iconv.m4 serial AM4 (gettext-0.11.3) |
2 | dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | 6 | ||
9 | dnl From Bruno Haible. | 7 | dnl From Bruno Haible. |
10 | 8 | ||
diff --git a/m4/intdiv0.m4 b/m4/intdiv0.m4 deleted file mode 100644 index 55dddcf1..00000000 --- a/m4/intdiv0.m4 +++ /dev/null | |||
@@ -1,72 +0,0 @@ | |||
1 | # intdiv0.m4 serial 1 (gettext-0.11.3) | ||
2 | dnl Copyright (C) 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([gt_INTDIV0], | ||
12 | [ | ||
13 | AC_REQUIRE([AC_PROG_CC])dnl | ||
14 | AC_REQUIRE([AC_CANONICAL_HOST])dnl | ||
15 | |||
16 | AC_CACHE_CHECK([whether integer division by zero raises SIGFPE], | ||
17 | gt_cv_int_divbyzero_sigfpe, | ||
18 | [ | ||
19 | AC_TRY_RUN([ | ||
20 | #include <stdlib.h> | ||
21 | #include <signal.h> | ||
22 | |||
23 | static void | ||
24 | #ifdef __cplusplus | ||
25 | sigfpe_handler (int sig) | ||
26 | #else | ||
27 | sigfpe_handler (sig) int sig; | ||
28 | #endif | ||
29 | { | ||
30 | /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ | ||
31 | exit (sig != SIGFPE); | ||
32 | } | ||
33 | |||
34 | int x = 1; | ||
35 | int y = 0; | ||
36 | int z; | ||
37 | int nan; | ||
38 | |||
39 | int main () | ||
40 | { | ||
41 | signal (SIGFPE, sigfpe_handler); | ||
42 | /* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ | ||
43 | #if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) | ||
44 | signal (SIGTRAP, sigfpe_handler); | ||
45 | #endif | ||
46 | /* Linux/SPARC yields signal SIGILL. */ | ||
47 | #if defined (__sparc__) && defined (__linux__) | ||
48 | signal (SIGILL, sigfpe_handler); | ||
49 | #endif | ||
50 | |||
51 | z = x / y; | ||
52 | nan = y / y; | ||
53 | exit (1); | ||
54 | } | ||
55 | ], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no, | ||
56 | [ | ||
57 | # Guess based on the CPU. | ||
58 | case "$host_cpu" in | ||
59 | alpha* | i[34567]86 | m68k | s390*) | ||
60 | gt_cv_int_divbyzero_sigfpe="guessing yes";; | ||
61 | *) | ||
62 | gt_cv_int_divbyzero_sigfpe="guessing no";; | ||
63 | esac | ||
64 | ]) | ||
65 | ]) | ||
66 | case "$gt_cv_int_divbyzero_sigfpe" in | ||
67 | *yes) value=1;; | ||
68 | *) value=0;; | ||
69 | esac | ||
70 | AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value, | ||
71 | [Define if integer division by zero raises signal SIGFPE.]) | ||
72 | ]) | ||
diff --git a/m4/inttypes-pri.m4 b/m4/inttypes-pri.m4 index fd007c31..4d56a9ad 100644 --- a/m4/inttypes-pri.m4 +++ b/m4/inttypes-pri.m4 | |||
@@ -1,10 +1,8 @@ | |||
1 | # inttypes-pri.m4 serial 1 (gettext-0.11.4) | 1 | # inttypes-pri.m4 serial 1 (gettext-0.11.4) |
2 | dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | 6 | ||
9 | dnl From Bruno Haible. | 7 | dnl From Bruno Haible. |
10 | 8 | ||
diff --git a/m4/inttypes.m4 b/m4/inttypes.m4 index ab370ffe..779bcea0 100644 --- a/m4/inttypes.m4 +++ b/m4/inttypes.m4 | |||
@@ -1,10 +1,8 @@ | |||
1 | # inttypes.m4 serial 1 (gettext-0.11.4) | 1 | # inttypes.m4 serial 1 (gettext-0.11.4) |
2 | dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | 6 | ||
9 | dnl From Paul Eggert. | 7 | dnl From Paul Eggert. |
10 | 8 | ||
diff --git a/m4/inttypes_h.m4 b/m4/inttypes_h.m4 index 400a1118..a5d075d9 100644 --- a/m4/inttypes_h.m4 +++ b/m4/inttypes_h.m4 | |||
@@ -1,28 +1,26 @@ | |||
1 | # inttypes_h.m4 serial 4 (gettext-0.11.4) | 1 | # inttypes_h.m4 serial 6 |
2 | dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 1997-2004 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | 6 | ||
9 | dnl From Paul Eggert. | 7 | dnl From Paul Eggert. |
10 | 8 | ||
11 | # Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists, | 9 | # Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists, |
12 | # doesn't clash with <sys/types.h>, and declares uintmax_t. | 10 | # doesn't clash with <sys/types.h>, and declares uintmax_t. |
13 | 11 | ||
14 | AC_DEFUN([jm_AC_HEADER_INTTYPES_H], | 12 | AC_DEFUN([gl_AC_HEADER_INTTYPES_H], |
15 | [ | 13 | [ |
16 | AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h, | 14 | AC_CACHE_CHECK([for inttypes.h], gl_cv_header_inttypes_h, |
17 | [AC_TRY_COMPILE( | 15 | [AC_TRY_COMPILE( |
18 | [#include <sys/types.h> | 16 | [#include <sys/types.h> |
19 | #include <inttypes.h>], | 17 | #include <inttypes.h>], |
20 | [uintmax_t i = (uintmax_t) -1;], | 18 | [uintmax_t i = (uintmax_t) -1;], |
21 | jm_ac_cv_header_inttypes_h=yes, | 19 | gl_cv_header_inttypes_h=yes, |
22 | jm_ac_cv_header_inttypes_h=no)]) | 20 | gl_cv_header_inttypes_h=no)]) |
23 | if test $jm_ac_cv_header_inttypes_h = yes; then | 21 | if test $gl_cv_header_inttypes_h = yes; then |
24 | AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1, | 22 | AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1, |
25 | [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, | 23 | [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, |
26 | and declares uintmax_t. ]) | 24 | and declares uintmax_t. ]) |
27 | fi | 25 | fi |
28 | ]) | 26 | ]) |
diff --git a/m4/isc-posix.m4 b/m4/isc-posix.m4 deleted file mode 100644 index 1319dd1c..00000000 --- a/m4/isc-posix.m4 +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | # isc-posix.m4 serial 2 (gettext-0.11.2) | ||
2 | dnl Copyright (C) 1995-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 | # This file is not needed with autoconf-2.53 and newer. Remove it in 2005. | ||
10 | |||
11 | # This test replaces the one in autoconf. | ||
12 | # Currently this macro should have the same name as the autoconf macro | ||
13 | # because gettext's gettext.m4 (distributed in the automake package) | ||
14 | # still uses it. Otherwise, the use in gettext.m4 makes autoheader | ||
15 | # give these diagnostics: | ||
16 | # configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX | ||
17 | # configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX | ||
18 | |||
19 | undefine([AC_ISC_POSIX]) | ||
20 | |||
21 | AC_DEFUN([AC_ISC_POSIX], | ||
22 | [ | ||
23 | dnl This test replaces the obsolescent AC_ISC_POSIX kludge. | ||
24 | AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) | ||
25 | ] | ||
26 | ) | ||
diff --git a/m4/lcmessage.m4 b/m4/lcmessage.m4 deleted file mode 100644 index ffd4008b..00000000 --- a/m4/lcmessage.m4 +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | # lcmessage.m4 serial 3 (gettext-0.11.3) | ||
2 | dnl Copyright (C) 1995-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 | 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. | ||
20 | |||
21 | # Check whether LC_MESSAGES is available in <locale.h>. | ||
22 | |||
23 | AC_DEFUN([AM_LC_MESSAGES], | ||
24 | [ | ||
25 | AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, | ||
26 | [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], | ||
27 | am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) | ||
28 | if test $am_cv_val_LC_MESSAGES = yes; then | ||
29 | AC_DEFINE(HAVE_LC_MESSAGES, 1, | ||
30 | [Define if your <locale.h> file defines LC_MESSAGES.]) | ||
31 | fi | ||
32 | ]) | ||
diff --git a/m4/lib-ld.m4 b/m4/lib-ld.m4 index ddb57323..96c4e2c3 100644 --- a/m4/lib-ld.m4 +++ b/m4/lib-ld.m4 | |||
@@ -1,10 +1,8 @@ | |||
1 | # lib-ld.m4 serial 1 (gettext-0.11) | 1 | # lib-ld.m4 serial 3 (gettext-0.13) |
2 | dnl Copyright (C) 1996-2002 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 1996-2003 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | 6 | ||
9 | dnl Subroutines of libtool.m4, | 7 | dnl Subroutines of libtool.m4, |
10 | dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision | 8 | dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision |
@@ -14,11 +12,12 @@ dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. | |||
14 | AC_DEFUN([AC_LIB_PROG_LD_GNU], | 12 | AC_DEFUN([AC_LIB_PROG_LD_GNU], |
15 | [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, | 13 | [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, |
16 | [# I'd rather use --version here, but apparently some GNU ld's only accept -v. | 14 | [# I'd rather use --version here, but apparently some GNU ld's only accept -v. |
17 | if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then | 15 | case `$LD -v 2>&1 </dev/null` in |
18 | acl_cv_prog_gnu_ld=yes | 16 | *GNU* | *'with BFD'*) |
19 | else | 17 | acl_cv_prog_gnu_ld=yes ;; |
20 | acl_cv_prog_gnu_ld=no | 18 | *) |
21 | fi]) | 19 | acl_cv_prog_gnu_ld=no ;; |
20 | esac]) | ||
22 | with_gnu_ld=$acl_cv_prog_gnu_ld | 21 | with_gnu_ld=$acl_cv_prog_gnu_ld |
23 | ]) | 22 | ]) |
24 | 23 | ||
@@ -29,6 +28,19 @@ AC_DEFUN([AC_LIB_PROG_LD], | |||
29 | test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) | 28 | test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) |
30 | AC_REQUIRE([AC_PROG_CC])dnl | 29 | AC_REQUIRE([AC_PROG_CC])dnl |
31 | AC_REQUIRE([AC_CANONICAL_HOST])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 | ||
32 | ac_prog=ld | 44 | ac_prog=ld |
33 | if test "$GCC" = yes; then | 45 | if test "$GCC" = yes; then |
34 | # Check if gcc -print-prog-name=ld gives a path. | 46 | # Check if gcc -print-prog-name=ld gives a path. |
@@ -75,11 +87,12 @@ AC_CACHE_VAL(acl_cv_path_LD, | |||
75 | # Check to see if the program is GNU ld. I'd rather use --version, | 87 | # Check to see if the program is GNU ld. I'd rather use --version, |
76 | # but apparently some GNU ld's only accept -v. | 88 | # but apparently some GNU ld's only accept -v. |
77 | # Break only if it was the GNU/non-GNU ld that we prefer. | 89 | # Break only if it was the GNU/non-GNU ld that we prefer. |
78 | if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then | 90 | case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in |
79 | test "$with_gnu_ld" != no && break | 91 | *GNU* | *'with BFD'*) |
80 | else | 92 | test "$with_gnu_ld" != no && break ;; |
81 | test "$with_gnu_ld" != yes && break | 93 | *) |
82 | fi | 94 | test "$with_gnu_ld" != yes && break ;; |
95 | esac | ||
83 | fi | 96 | fi |
84 | done | 97 | done |
85 | IFS="$ac_save_ifs" | 98 | IFS="$ac_save_ifs" |
diff --git a/m4/lib-link.m4 b/m4/lib-link.m4 index 6b942510..244a7791 100644 --- a/m4/lib-link.m4 +++ b/m4/lib-link.m4 | |||
@@ -1,13 +1,13 @@ | |||
1 | # lib-link.m4 serial 3 (gettext-0.11.3) | 1 | # lib-link.m4 serial 7 (gettext-0.15) |
2 | dnl Copyright (C) 2001-2002 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | 6 | ||
9 | dnl From Bruno Haible. | 7 | dnl From Bruno Haible. |
10 | 8 | ||
9 | AC_PREREQ(2.50) | ||
10 | |||
11 | dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and | 11 | dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and |
12 | dnl the libraries corresponding to explicit and implicit dependencies. | 12 | dnl the libraries corresponding to explicit and implicit dependencies. |
13 | dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and | 13 | dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and |
@@ -92,10 +92,11 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], | |||
92 | 92 | ||
93 | dnl Determine the platform dependent parameters needed to use rpath: | 93 | dnl Determine the platform dependent parameters needed to use rpath: |
94 | dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, | 94 | dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, |
95 | dnl hardcode_direct, hardcode_minus_L, | 95 | dnl hardcode_direct, hardcode_minus_L. |
96 | dnl sys_lib_search_path_spec, sys_lib_dlsearch_path_spec. | ||
97 | AC_DEFUN([AC_LIB_RPATH], | 96 | AC_DEFUN([AC_LIB_RPATH], |
98 | [ | 97 | [ |
98 | dnl Tell automake >= 1.10 to complain if config.rpath is missing. | ||
99 | m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) | ||
99 | AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS | 100 | AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS |
100 | AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld | 101 | AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld |
101 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host | 102 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host |
@@ -114,8 +115,6 @@ AC_DEFUN([AC_LIB_RPATH], | |||
114 | hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" | 115 | hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" |
115 | hardcode_direct="$acl_cv_hardcode_direct" | 116 | hardcode_direct="$acl_cv_hardcode_direct" |
116 | hardcode_minus_L="$acl_cv_hardcode_minus_L" | 117 | hardcode_minus_L="$acl_cv_hardcode_minus_L" |
117 | sys_lib_search_path_spec="$acl_cv_sys_lib_search_path_spec" | ||
118 | sys_lib_dlsearch_path_spec="$acl_cv_sys_lib_dlsearch_path_spec" | ||
119 | dnl Determine whether the user wants rpath handling at all. | 118 | dnl Determine whether the user wants rpath handling at all. |
120 | AC_ARG_ENABLE(rpath, | 119 | AC_ARG_ENABLE(rpath, |
121 | [ --disable-rpath do not hardcode runtime library paths], | 120 | [ --disable-rpath do not hardcode runtime library paths], |
@@ -127,6 +126,7 @@ dnl the libraries corresponding to explicit and implicit dependencies. | |||
127 | dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. | 126 | dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. |
128 | AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | 127 | AC_DEFUN([AC_LIB_LINKFLAGS_BODY], |
129 | [ | 128 | [ |
129 | AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) | ||
130 | define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], | 130 | define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], |
131 | [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) | 131 | [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) |
132 | dnl By default, look in $includedir and $libdir. | 132 | dnl By default, look in $includedir and $libdir. |
@@ -135,7 +135,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | |||
135 | eval additional_includedir=\"$includedir\" | 135 | eval additional_includedir=\"$includedir\" |
136 | eval additional_libdir=\"$libdir\" | 136 | eval additional_libdir=\"$libdir\" |
137 | ]) | 137 | ]) |
138 | AC_ARG_WITH([lib$1-prefix], | 138 | AC_LIB_ARG_WITH([lib$1-prefix], |
139 | [ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib | 139 | [ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib |
140 | --without-lib$1-prefix don't search for lib$1 in includedir and libdir], | 140 | --without-lib$1-prefix don't search for lib$1 in includedir and libdir], |
141 | [ | 141 | [ |
@@ -149,7 +149,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | |||
149 | ]) | 149 | ]) |
150 | else | 150 | else |
151 | additional_includedir="$withval/include" | 151 | additional_includedir="$withval/include" |
152 | additional_libdir="$withval/lib" | 152 | additional_libdir="$withval/$acl_libdirstem" |
153 | fi | 153 | fi |
154 | fi | 154 | fi |
155 | ]) | 155 | ]) |
@@ -249,7 +249,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | |||
249 | dnl Linking with a shared library. We attempt to hardcode its | 249 | dnl Linking with a shared library. We attempt to hardcode its |
250 | dnl directory into the executable's runpath, unless it's the | 250 | dnl directory into the executable's runpath, unless it's the |
251 | dnl standard /usr/lib. | 251 | dnl standard /usr/lib. |
252 | if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then | 252 | if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then |
253 | dnl No hardcoding is needed. | 253 | dnl No hardcoding is needed. |
254 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" | 254 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" |
255 | else | 255 | else |
@@ -335,8 +335,8 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | |||
335 | dnl Assume the include files are nearby. | 335 | dnl Assume the include files are nearby. |
336 | additional_includedir= | 336 | additional_includedir= |
337 | case "$found_dir" in | 337 | case "$found_dir" in |
338 | */lib | */lib/) | 338 | */$acl_libdirstem | */$acl_libdirstem/) |
339 | basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` | 339 | basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` |
340 | additional_includedir="$basedir/include" | 340 | additional_includedir="$basedir/include" |
341 | ;; | 341 | ;; |
342 | esac | 342 | esac |
@@ -353,7 +353,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | |||
353 | if test "X$additional_includedir" = "X/usr/local/include"; then | 353 | if test "X$additional_includedir" = "X/usr/local/include"; then |
354 | if test -n "$GCC"; then | 354 | if test -n "$GCC"; then |
355 | case $host_os in | 355 | case $host_os in |
356 | linux*) haveit=yes;; | 356 | linux* | gnu* | k*bsd*-gnu) haveit=yes;; |
357 | esac | 357 | esac |
358 | fi | 358 | fi |
359 | fi | 359 | fi |
@@ -397,12 +397,12 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], | |||
397 | dnl 3. if it's already present in $LDFLAGS or the already | 397 | dnl 3. if it's already present in $LDFLAGS or the already |
398 | dnl constructed $LIBNAME, | 398 | dnl constructed $LIBNAME, |
399 | dnl 4. if it doesn't exist as a directory. | 399 | dnl 4. if it doesn't exist as a directory. |
400 | if test "X$additional_libdir" != "X/usr/lib"; then | 400 | if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then |
401 | haveit= | 401 | haveit= |
402 | if test "X$additional_libdir" = "X/usr/local/lib"; then | 402 | if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then |
403 | if test -n "$GCC"; then | 403 | if test -n "$GCC"; then |
404 | case $host_os in | 404 | case $host_os in |
405 | linux*) haveit=yes;; | 405 | linux* | gnu* | k*bsd*-gnu) haveit=yes;; |
406 | esac | 406 | esac |
407 | fi | 407 | fi |
408 | fi | 408 | fi |
diff --git a/m4/lib-prefix.m4 b/m4/lib-prefix.m4 index b8b79ab9..a8684e17 100644 --- a/m4/lib-prefix.m4 +++ b/m4/lib-prefix.m4 | |||
@@ -1,13 +1,18 @@ | |||
1 | # lib-prefix.m4 serial 1 (gettext-0.11) | 1 | # lib-prefix.m4 serial 5 (gettext-0.15) |
2 | dnl Copyright (C) 2001-2002 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2001-2005 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | 6 | ||
9 | dnl From Bruno Haible. | 7 | dnl From Bruno Haible. |
10 | 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 | |||
11 | dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed | 16 | dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed |
12 | dnl to access previously installed libraries. The basic assumption is that | 17 | dnl to access previously installed libraries. The basic assumption is that |
13 | dnl a user will want packages to use other packages he previously installed | 18 | dnl a user will want packages to use other packages he previously installed |
@@ -19,6 +24,7 @@ AC_DEFUN([AC_LIB_PREFIX], | |||
19 | AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) | 24 | AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) |
20 | AC_REQUIRE([AC_PROG_CC]) | 25 | AC_REQUIRE([AC_PROG_CC]) |
21 | AC_REQUIRE([AC_CANONICAL_HOST]) | 26 | AC_REQUIRE([AC_CANONICAL_HOST]) |
27 | AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) | ||
22 | AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) | 28 | AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) |
23 | dnl By default, look in $includedir and $libdir. | 29 | dnl By default, look in $includedir and $libdir. |
24 | use_additional=yes | 30 | use_additional=yes |
@@ -26,7 +32,7 @@ AC_DEFUN([AC_LIB_PREFIX], | |||
26 | eval additional_includedir=\"$includedir\" | 32 | eval additional_includedir=\"$includedir\" |
27 | eval additional_libdir=\"$libdir\" | 33 | eval additional_libdir=\"$libdir\" |
28 | ]) | 34 | ]) |
29 | AC_ARG_WITH([lib-prefix], | 35 | AC_LIB_ARG_WITH([lib-prefix], |
30 | [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib | 36 | [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib |
31 | --without-lib-prefix don't search for libraries in includedir and libdir], | 37 | --without-lib-prefix don't search for libraries in includedir and libdir], |
32 | [ | 38 | [ |
@@ -40,7 +46,7 @@ AC_DEFUN([AC_LIB_PREFIX], | |||
40 | ]) | 46 | ]) |
41 | else | 47 | else |
42 | additional_includedir="$withval/include" | 48 | additional_includedir="$withval/include" |
43 | additional_libdir="$withval/lib" | 49 | additional_libdir="$withval/$acl_libdirstem" |
44 | fi | 50 | fi |
45 | fi | 51 | fi |
46 | ]) | 52 | ]) |
@@ -64,7 +70,7 @@ AC_DEFUN([AC_LIB_PREFIX], | |||
64 | if test "X$additional_includedir" = "X/usr/local/include"; then | 70 | if test "X$additional_includedir" = "X/usr/local/include"; then |
65 | if test -n "$GCC"; then | 71 | if test -n "$GCC"; then |
66 | case $host_os in | 72 | case $host_os in |
67 | linux*) haveit=yes;; | 73 | linux* | gnu* | k*bsd*-gnu) haveit=yes;; |
68 | esac | 74 | esac |
69 | fi | 75 | fi |
70 | fi | 76 | fi |
@@ -82,7 +88,7 @@ AC_DEFUN([AC_LIB_PREFIX], | |||
82 | dnl 2. if it's already present in $LDFLAGS, | 88 | dnl 2. if it's already present in $LDFLAGS, |
83 | dnl 3. if it's /usr/local/lib and we are using GCC on Linux, | 89 | dnl 3. if it's /usr/local/lib and we are using GCC on Linux, |
84 | dnl 4. if it doesn't exist as a directory. | 90 | dnl 4. if it doesn't exist as a directory. |
85 | if test "X$additional_libdir" != "X/usr/lib"; then | 91 | if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then |
86 | haveit= | 92 | haveit= |
87 | for x in $LDFLAGS; do | 93 | for x in $LDFLAGS; do |
88 | AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) | 94 | AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) |
@@ -92,7 +98,7 @@ AC_DEFUN([AC_LIB_PREFIX], | |||
92 | fi | 98 | fi |
93 | done | 99 | done |
94 | if test -z "$haveit"; then | 100 | if test -z "$haveit"; then |
95 | if test "X$additional_libdir" = "X/usr/local/lib"; then | 101 | if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then |
96 | if test -n "$GCC"; then | 102 | if test -n "$GCC"; then |
97 | case $host_os in | 103 | case $host_os in |
98 | linux*) haveit=yes;; | 104 | linux*) haveit=yes;; |
@@ -146,3 +152,34 @@ AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], | |||
146 | exec_prefix="$acl_save_exec_prefix" | 152 | exec_prefix="$acl_save_exec_prefix" |
147 | prefix="$acl_save_prefix" | 153 | prefix="$acl_save_prefix" |
148 | ]) | 154 | ]) |
155 | |||
156 | dnl AC_LIB_PREPARE_MULTILIB creates a variable acl_libdirstem, containing | ||
157 | dnl the basename of the libdir, either "lib" or "lib64". | ||
158 | AC_DEFUN([AC_LIB_PREPARE_MULTILIB], | ||
159 | [ | ||
160 | dnl There is no formal standard regarding lib and lib64. The current | ||
161 | dnl practice is that on a system supporting 32-bit and 64-bit instruction | ||
162 | dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit | ||
163 | dnl libraries go under $prefix/lib. We determine the compiler's default | ||
164 | dnl mode by looking at the compiler's library search path. If at least | ||
165 | dnl of its elements ends in /lib64 or points to a directory whose absolute | ||
166 | dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the | ||
167 | dnl default, namely "lib". | ||
168 | acl_libdirstem=lib | ||
169 | searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` | ||
170 | if test -n "$searchpath"; then | ||
171 | acl_save_IFS="${IFS= }"; IFS=":" | ||
172 | for searchdir in $searchpath; do | ||
173 | if test -d "$searchdir"; then | ||
174 | case "$searchdir" in | ||
175 | */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; | ||
176 | *) searchdir=`cd "$searchdir" && pwd` | ||
177 | case "$searchdir" in | ||
178 | */lib64 ) acl_libdirstem=lib64 ;; | ||
179 | esac ;; | ||
180 | esac | ||
181 | fi | ||
182 | done | ||
183 | IFS="$acl_save_IFS" | ||
184 | fi | ||
185 | ]) | ||
diff --git a/m4/longdouble.m4 b/m4/longdouble.m4 new file mode 100644 index 00000000..40cd7ce0 --- /dev/null +++ b/m4/longdouble.m4 | |||
@@ -0,0 +1,28 @@ | |||
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; the Free Software Foundation | ||
4 | dnl gives unlimited permission to copy and/or distribute it, | ||
5 | dnl with or without modifications, as long as this notice is preserved. | ||
6 | |||
7 | dnl From Bruno Haible. | ||
8 | dnl Test whether the compiler supports the 'long double' type. | ||
9 | dnl Prerequisite: AC_PROG_CC | ||
10 | |||
11 | AC_DEFUN([gt_TYPE_LONGDOUBLE], | ||
12 | [ | ||
13 | AC_CACHE_CHECK([for long double], gt_cv_c_long_double, | ||
14 | [if test "$GCC" = yes; then | ||
15 | gt_cv_c_long_double=yes | ||
16 | else | ||
17 | AC_TRY_COMPILE([ | ||
18 | /* The Stardent Vistra knows sizeof(long double), but does not support it. */ | ||
19 | long double foo = 0.0; | ||
20 | /* On Ultrix 4.3 cc, long double is 4 and double is 8. */ | ||
21 | int array [2*(sizeof(long double) >= sizeof(double)) - 1]; | ||
22 | ], , | ||
23 | gt_cv_c_long_double=yes, gt_cv_c_long_double=no) | ||
24 | fi]) | ||
25 | if test $gt_cv_c_long_double = yes; then | ||
26 | AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the 'long double' type.]) | ||
27 | fi | ||
28 | ]) | ||
diff --git a/m4/longlong.m4 b/m4/longlong.m4 new file mode 100644 index 00000000..7b399e01 --- /dev/null +++ b/m4/longlong.m4 | |||
@@ -0,0 +1,23 @@ | |||
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 | ]) | ||
diff --git a/m4/ls-mntd-fs.m4 b/m4/ls-mntd-fs.m4 index c28466bb..ed243861 100644 --- a/m4/ls-mntd-fs.m4 +++ b/m4/ls-mntd-fs.m4 | |||
@@ -1,13 +1,30 @@ | |||
1 | #serial 14 | 1 | #serial 20 |
2 | # How to list mounted file systems. | ||
3 | |||
4 | # Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software | ||
5 | # Foundation, Inc. | ||
6 | # | ||
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. | ||
2 | 10 | ||
3 | dnl From Jim Meyering. | 11 | dnl From Jim Meyering. |
4 | dnl | 12 | dnl |
5 | dnl This is not pretty. I've just taken the autoconf code and wrapped | 13 | dnl This is not pretty. I've just taken the autoconf code and wrapped |
6 | dnl it in an AC_DEFUN. | 14 | dnl it in an AC_DEFUN and made some other fixes. |
7 | dnl | 15 | dnl |
8 | 16 | ||
9 | # jm_LIST_MOUNTED_FILESYSTEMS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) | 17 | # Replace Autoconf's AC_FUNC_GETMNTENT to work around a bug in Autoconf |
10 | AC_DEFUN([jm_LIST_MOUNTED_FILESYSTEMS], | 18 | # through Autoconf 2.59. We can remove this once we assume Autoconf 2.60 |
19 | # or later. | ||
20 | AC_DEFUN([AC_FUNC_GETMNTENT], | ||
21 | [# getmntent is in the standard C library on UNICOS, in -lsun on Irix 4, | ||
22 | # -lseq on Dynix/PTX, -lgen on Unixware. | ||
23 | AC_SEARCH_LIBS(getmntent, [sun seq gen], [AC_CHECK_FUNCS(getmntent)]) | ||
24 | ]) | ||
25 | |||
26 | # gl_LIST_MOUNTED_FILE_SYSTEMS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) | ||
27 | AC_DEFUN([gl_LIST_MOUNTED_FILE_SYSTEMS], | ||
11 | [ | 28 | [ |
12 | AC_CHECK_FUNCS(listmntent getmntinfo) | 29 | AC_CHECK_FUNCS(listmntent getmntinfo) |
13 | AC_CHECK_HEADERS_ONCE(sys/param.h) | 30 | AC_CHECK_HEADERS_ONCE(sys/param.h) |
@@ -16,7 +33,13 @@ AC_CHECK_HEADERS_ONCE(sys/param.h) | |||
16 | # NGROUPS (as the array dimension for a struct member) without a definition. | 33 | # NGROUPS (as the array dimension for a struct member) without a definition. |
17 | AC_CHECK_HEADERS(sys/ucred.h, [], [], [#include <grp.h>]) | 34 | AC_CHECK_HEADERS(sys/ucred.h, [], [], [#include <grp.h>]) |
18 | 35 | ||
19 | AC_CHECK_HEADERS(mntent.h sys/mount.h sys/fs_types.h) | 36 | AC_CHECK_HEADERS(sys/mount.h, [], [], |
37 | [AC_INCLUDES_DEFAULT | ||
38 | [#if HAVE_SYS_PARAM_H | ||
39 | #include <sys/param.h> | ||
40 | #endif]]) | ||
41 | |||
42 | AC_CHECK_HEADERS(mntent.h sys/fs_types.h) | ||
20 | getfsstat_includes="\ | 43 | getfsstat_includes="\ |
21 | $ac_includes_default | 44 | $ac_includes_default |
22 | #if HAVE_SYS_PARAM_H | 45 | #if HAVE_SYS_PARAM_H |
@@ -35,11 +58,11 @@ $ac_includes_default | |||
35 | " | 58 | " |
36 | AC_CHECK_MEMBERS([struct fsstat.f_fstypename],,,[$getfsstat_includes]) | 59 | AC_CHECK_MEMBERS([struct fsstat.f_fstypename],,,[$getfsstat_includes]) |
37 | 60 | ||
38 | # Determine how to get the list of mounted filesystems. | 61 | # Determine how to get the list of mounted file systems. |
39 | ac_list_mounted_fs= | 62 | ac_list_mounted_fs= |
40 | 63 | ||
41 | # If the getmntent function is available but not in the standard library, | 64 | # If the getmntent function is available but not in the standard library, |
42 | # make sure LIBS contains -lsun (on Irix4) or -lseq (on PTX). | 65 | # make sure LIBS contains the appropriate -l option. |
43 | AC_FUNC_GETMNTENT | 66 | AC_FUNC_GETMNTENT |
44 | 67 | ||
45 | # This test must precede the ones for getmntent because Unicos-9 is | 68 | # This test must precede the ones for getmntent because Unicos-9 is |
@@ -70,7 +93,7 @@ yes | |||
70 | ac_list_mounted_fs=found | 93 | ac_list_mounted_fs=found |
71 | AC_DEFINE(MOUNTED_LISTMNTENT, 1, | 94 | AC_DEFINE(MOUNTED_LISTMNTENT, 1, |
72 | [Define if there is a function named listmntent that can be used to | 95 | [Define if there is a function named listmntent that can be used to |
73 | list all mounted filesystems. (UNICOS)]) | 96 | list all mounted file systems. (UNICOS)]) |
74 | fi | 97 | fi |
75 | fi | 98 | fi |
76 | 99 | ||
@@ -86,7 +109,7 @@ if test -z "$ac_list_mounted_fs"; then | |||
86 | ac_list_mounted_fs=found | 109 | ac_list_mounted_fs=found |
87 | AC_DEFINE(MOUNTED_VMOUNT, 1, | 110 | AC_DEFINE(MOUNTED_VMOUNT, 1, |
88 | [Define if there is a function named mntctl that can be used to read | 111 | [Define if there is a function named mntctl that can be used to read |
89 | the list of mounted filesystems, and there is a system header file | 112 | the list of mounted file systems, and there is a system header file |
90 | that declares `struct vmount.' (AIX)]) | 113 | that declares `struct vmount.' (AIX)]) |
91 | fi | 114 | fi |
92 | fi | 115 | fi |
@@ -125,7 +148,7 @@ if test $ac_cv_func_getmntent = yes; then | |||
125 | ac_list_mounted_fs=found | 148 | ac_list_mounted_fs=found |
126 | AC_DEFINE(MOUNTED_GETMNTENT1, 1, | 149 | AC_DEFINE(MOUNTED_GETMNTENT1, 1, |
127 | [Define if there is a function named getmntent for reading the list | 150 | [Define if there is a function named getmntent for reading the list |
128 | of mounted filesystems, and that function takes a single argument. | 151 | of mounted file systems, and that function takes a single argument. |
129 | (4.3BSD, SunOS, HP-UX, Dynix, Irix)]) | 152 | (4.3BSD, SunOS, HP-UX, Dynix, Irix)]) |
130 | fi | 153 | fi |
131 | fi | 154 | fi |
@@ -142,7 +165,7 @@ if test $ac_cv_func_getmntent = yes; then | |||
142 | ac_list_mounted_fs=found | 165 | ac_list_mounted_fs=found |
143 | AC_DEFINE(MOUNTED_GETMNTENT2, 1, | 166 | AC_DEFINE(MOUNTED_GETMNTENT2, 1, |
144 | [Define if there is a function named getmntent for reading the list of | 167 | [Define if there is a function named getmntent for reading the list of |
145 | mounted filesystems, and that function takes two arguments. (SVR4)]) | 168 | mounted file systems, and that function takes two arguments. (SVR4)]) |
146 | fi | 169 | fi |
147 | fi | 170 | fi |
148 | 171 | ||
@@ -173,7 +196,7 @@ if test -z "$ac_list_mounted_fs"; then | |||
173 | ac_list_mounted_fs=found | 196 | ac_list_mounted_fs=found |
174 | AC_DEFINE(MOUNTED_GETFSSTAT, 1, | 197 | AC_DEFINE(MOUNTED_GETFSSTAT, 1, |
175 | [Define if there is a function named getfsstat for reading the | 198 | [Define if there is a function named getfsstat for reading the |
176 | list of mounted filesystems. (DEC Alpha running OSF/1)]) | 199 | list of mounted file systems. (DEC Alpha running OSF/1)]) |
177 | fi | 200 | fi |
178 | fi | 201 | fi |
179 | 202 | ||
@@ -192,7 +215,7 @@ if test -z "$ac_list_mounted_fs"; then | |||
192 | ac_list_mounted_fs=found | 215 | ac_list_mounted_fs=found |
193 | AC_DEFINE(MOUNTED_FREAD_FSTYP, 1, | 216 | AC_DEFINE(MOUNTED_FREAD_FSTYP, 1, |
194 | [Define if (like SVR2) there is no specific function for reading the | 217 | [Define if (like SVR2) there is no specific function for reading the |
195 | list of mounted filesystems, and your system has these header files: | 218 | list of mounted file systems, and your system has these header files: |
196 | <sys/fstyp.h> and <sys/statfs.h>. (SVR3)]) | 219 | <sys/fstyp.h> and <sys/statfs.h>. (SVR3)]) |
197 | fi | 220 | fi |
198 | fi | 221 | fi |
@@ -211,7 +234,7 @@ if test -z "$ac_list_mounted_fs"; then | |||
211 | ac_list_mounted_fs=found | 234 | ac_list_mounted_fs=found |
212 | AC_DEFINE(MOUNTED_GETMNTINFO, 1, | 235 | AC_DEFINE(MOUNTED_GETMNTINFO, 1, |
213 | [Define if there is a function named getmntinfo for reading the | 236 | [Define if there is a function named getmntinfo for reading the |
214 | list of mounted filesystems. (4.4BSD, Darwin)]) | 237 | list of mounted file systems. (4.4BSD, Darwin)]) |
215 | fi | 238 | fi |
216 | fi | 239 | fi |
217 | 240 | ||
@@ -229,7 +252,7 @@ if test -z "$ac_list_mounted_fs"; then | |||
229 | ac_list_mounted_fs=found | 252 | ac_list_mounted_fs=found |
230 | AC_DEFINE(MOUNTED_GETMNT, 1, | 253 | AC_DEFINE(MOUNTED_GETMNT, 1, |
231 | [Define if there is a function named getmnt for reading the list of | 254 | [Define if there is a function named getmnt for reading the list of |
232 | mounted filesystems. (Ultrix)]) | 255 | mounted file systems. (Ultrix)]) |
233 | fi | 256 | fi |
234 | fi | 257 | fi |
235 | 258 | ||
@@ -250,7 +273,7 @@ if test -z "$ac_list_mounted_fs"; then | |||
250 | ac_list_mounted_fs=found | 273 | ac_list_mounted_fs=found |
251 | AC_DEFINE(MOUNTED_FS_STAT_DEV, 1, | 274 | AC_DEFINE(MOUNTED_FS_STAT_DEV, 1, |
252 | [Define if there are functions named next_dev and fs_stat_dev for | 275 | [Define if there are functions named next_dev and fs_stat_dev for |
253 | reading the list of mounted filesystems. (BeOS)]) | 276 | reading the list of mounted file systems. (BeOS)]) |
254 | fi | 277 | fi |
255 | fi | 278 | fi |
256 | 279 | ||
@@ -266,13 +289,13 @@ if test -z "$ac_list_mounted_fs"; then | |||
266 | ac_list_mounted_fs=found | 289 | ac_list_mounted_fs=found |
267 | AC_DEFINE(MOUNTED_FREAD, 1, | 290 | AC_DEFINE(MOUNTED_FREAD, 1, |
268 | [Define if there is no specific function for reading the list of | 291 | [Define if there is no specific function for reading the list of |
269 | mounted filesystems. fread will be used to read /etc/mnttab. | 292 | mounted file systems. fread will be used to read /etc/mnttab. |
270 | (SVR2) ]) | 293 | (SVR2) ]) |
271 | fi | 294 | fi |
272 | fi | 295 | fi |
273 | 296 | ||
274 | if test -z "$ac_list_mounted_fs"; then | 297 | if test -z "$ac_list_mounted_fs"; then |
275 | AC_MSG_ERROR([could not determine how to read list of mounted filesystems]) | 298 | AC_MSG_ERROR([could not determine how to read list of mounted file systems]) |
276 | # FIXME -- no need to abort building the whole package | 299 | # FIXME -- no need to abort building the whole package |
277 | # Can't build mountlist.c or anything that needs its functions | 300 | # Can't build mountlist.c or anything that needs its functions |
278 | fi | 301 | fi |
diff --git a/m4/malloc.m4 b/m4/malloc.m4 deleted file mode 100644 index 2452acf0..00000000 --- a/m4/malloc.m4 +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | # malloc.m4 serial 7 | ||
2 | dnl Copyright (C) 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 Jim Meyering. | ||
10 | dnl Determine whether malloc accepts 0 as its argument. | ||
11 | dnl If it doesn't, arrange to use the replacement function. | ||
12 | |||
13 | AC_DEFUN([jm_FUNC_MALLOC], | ||
14 | [ | ||
15 | AC_REQUIRE([AC_FUNC_MALLOC]) | ||
16 | dnl autoconf < 2.57 used the symbol ac_cv_func_malloc_works. | ||
17 | if test X"$ac_cv_func_malloc_0_nonnull" = Xno || test X"$ac_cv_func_malloc_works" = Xno; then | ||
18 | gl_PREREQ_MALLOC | ||
19 | fi | ||
20 | ]) | ||
21 | |||
22 | # Prerequisites of lib/malloc.c. | ||
23 | AC_DEFUN([gl_PREREQ_MALLOC], [ | ||
24 | : | ||
25 | ]) | ||
diff --git a/m4/mountlist.m4 b/m4/mountlist.m4 index 6a6b38c3..b2a2e12f 100644 --- a/m4/mountlist.m4 +++ b/m4/mountlist.m4 | |||
@@ -1,26 +1,25 @@ | |||
1 | # mountlist.m4 serial 2 | 1 | #serial 8 |
2 | dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | 6 | ||
9 | AC_DEFUN([gl_MOUNTLIST], | 7 | AC_DEFUN([gl_MOUNTLIST], |
10 | [ | 8 | [ |
11 | jm_LIST_MOUNTED_FILESYSTEMS([gl_cv_list_mounted_fs=yes], | 9 | AC_LIBSOURCES([mountlist.c, mountlist.h]) |
12 | [gl_cv_list_mounted_fs=no]) | 10 | |
11 | gl_LIST_MOUNTED_FILE_SYSTEMS([gl_cv_list_mounted_fs=yes], | ||
12 | [gl_cv_list_mounted_fs=no]) | ||
13 | if test $gl_cv_list_mounted_fs = yes; then | 13 | if test $gl_cv_list_mounted_fs = yes; then |
14 | AC_LIBOBJ(mountlist) | 14 | AC_LIBOBJ(mountlist) |
15 | gl_PREREQ_MOUNTLIST_EXTRA | 15 | gl_PREREQ_MOUNTLIST_EXTRA |
16 | fi | 16 | fi |
17 | ]) | 17 | ]) |
18 | 18 | ||
19 | # Prerequisites of lib/mountlist.c not done by jm_LIST_MOUNTED_FILESYSTEMS. | 19 | # Prerequisites of lib/mountlist.c not done by gl_LIST_MOUNTED_FILE_SYSTEMS. |
20 | AC_DEFUN([gl_PREREQ_MOUNTLIST_EXTRA], | 20 | AC_DEFUN([gl_PREREQ_MOUNTLIST_EXTRA], |
21 | [ | 21 | [ |
22 | dnl Note jm_LIST_MOUNTED_FILESYSTEMS checks for mntent.h, not sys/mntent.h. | 22 | dnl Note gl_LIST_MOUNTED_FILE_SYSTEMS checks for mntent.h, not sys/mntent.h. |
23 | AC_CHECK_HEADERS_ONCE(fcntl.h unistd.h) | ||
24 | AC_CHECK_HEADERS(sys/mntent.h) | 23 | AC_CHECK_HEADERS(sys/mntent.h) |
25 | jm_FSTYPENAME | 24 | gl_FSTYPENAME |
26 | ]) | 25 | ]) |
diff --git a/m4/nls.m4 b/m4/nls.m4 new file mode 100644 index 00000000..2082c3b2 --- /dev/null +++ b/m4/nls.m4 | |||
@@ -0,0 +1,51 @@ | |||
1 | # nls.m4 serial 2 (gettext-0.14.3) | ||
2 | dnl Copyright (C) 1995-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 | dnl | ||
7 | dnl This file can can be used in projects which are not available under | ||
8 | dnl the GNU General Public License or the GNU Library General Public | ||
9 | dnl License but which still want to provide support for the GNU gettext | ||
10 | dnl functionality. | ||
11 | dnl Please note that the actual code of the GNU gettext library is covered | ||
12 | dnl by the GNU Library General Public License, and the rest of the GNU | ||
13 | dnl gettext package package is covered by the GNU General Public License. | ||
14 | dnl They are *not* in the public domain. | ||
15 | |||
16 | dnl Authors: | ||
17 | dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. | ||
18 | dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003. | ||
19 | |||
20 | AC_PREREQ(2.50) | ||
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 Tell automake >= 1.10 to complain if mkinstalldirs is missing. | ||
36 | m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([mkinstalldirs])]) | ||
37 | dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly | ||
38 | dnl find the mkinstalldirs script in another subdir but $(top_srcdir). | ||
39 | dnl Try to locate it. | ||
40 | MKINSTALLDIRS= | ||
41 | if test -n "$ac_aux_dir"; then | ||
42 | case "$ac_aux_dir" in | ||
43 | /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;; | ||
44 | *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;; | ||
45 | esac | ||
46 | fi | ||
47 | if test -z "$MKINSTALLDIRS"; then | ||
48 | MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" | ||
49 | fi | ||
50 | AC_SUBST(MKINSTALLDIRS) | ||
51 | ]) | ||
diff --git a/m4/np_coreutils.m4 b/m4/np_coreutils.m4 index e7296040..e6627a2b 100644 --- a/m4/np_coreutils.m4 +++ b/m4/np_coreutils.m4 | |||
@@ -10,12 +10,12 @@ dnl These are all m4 things that need to be called | |||
10 | dnl Usually in coreutils' prereq.m4, but this is a subset that we need | 10 | dnl Usually in coreutils' prereq.m4, but this is a subset that we need |
11 | AC_DEFUN([np_COREUTILS], | 11 | AC_DEFUN([np_COREUTILS], |
12 | [ | 12 | [ |
13 | AC_REQUIRE([gl_GETOPT]) | ||
14 | AC_REQUIRE([AM_STDBOOL_H]) | 13 | AC_REQUIRE([AM_STDBOOL_H]) |
15 | AC_REQUIRE([jm_AFS]) | 14 | AC_REQUIRE([gl_GETOPT]) |
15 | AC_REQUIRE([gl_AFS]) | ||
16 | AC_REQUIRE([gl_EXITFAIL]) | 16 | AC_REQUIRE([gl_EXITFAIL]) |
17 | AC_REQUIRE([gl_XALLOC]) | 17 | AC_REQUIRE([gl_XALLOC]) |
18 | AC_REQUIRE([gl_MOUNTLIST]) | 18 | AC_REQUIRE([gl_MOUNTLIST]) |
19 | AC_REQUIRE([gl_FSUSAGE]) | 19 | AC_REQUIRE([gl_FSUSAGE]) |
20 | AC_REQUIRE([jm_FUNC_GLIBC_UNLOCKED_IO]) | 20 | AC_REQUIRE([gl_FUNC_GLIBC_UNLOCKED_IO]) |
21 | ]) | 21 | ]) |
diff --git a/m4/onceonly.m4 b/m4/onceonly_2_57.m4 index 50b33f48..14d3c0b2 100644 --- a/m4/onceonly.m4 +++ b/m4/onceonly_2_57.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # onceonly.m4 serial 3 (gettext-0.12) | 1 | # onceonly_2_57.m4 serial 3 |
2 | dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 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 | 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 | 5 | dnl Public License, this file may be distributed as part of a program |
@@ -21,22 +21,36 @@ 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 | 21 | dnl empty, and the check will be inserted before the body of the AC_DEFUNed |
22 | dnl function. | 22 | dnl function. |
23 | 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 | |||
24 | dnl Autoconf version 2.57 or newer is recommended. | 29 | dnl Autoconf version 2.57 or newer is recommended. |
25 | AC_PREREQ(2.54) | 30 | AC_PREREQ(2.57) |
26 | 31 | ||
27 | # AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of | 32 | # AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of |
28 | # AC_CHECK_HEADERS(HEADER1 HEADER2 ...). | 33 | # AC_CHECK_HEADERS(HEADER1 HEADER2 ...). |
29 | AC_DEFUN([AC_CHECK_HEADERS_ONCE], [ | 34 | AC_DEFUN([AC_CHECK_HEADERS_ONCE], [ |
30 | : | 35 | : |
31 | AC_FOREACH([gl_HEADER_NAME], [$1], [ | 36 | AC_FOREACH([gl_HEADER_NAME], [$1], [ |
32 | AC_DEFUN([gl_CHECK_HEADER_]m4_quote(translit(m4_defn([gl_HEADER_NAME]), | 37 | AC_DEFUN([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME, |
33 | [-./], [___])), [ | 38 | [./-], [___])), [ |
34 | AC_CHECK_HEADERS(gl_HEADER_NAME) | 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.]) | ||
35 | ]) | 44 | ]) |
36 | AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME, | 45 | AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME, |
37 | [-./], [___]))) | 46 | [./-], [___]))) |
38 | ]) | 47 | ]) |
39 | ]) | 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 | ]) | ||
40 | 54 | ||
41 | # AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of | 55 | # AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of |
42 | # AC_CHECK_FUNCS(FUNC1 FUNC2 ...). | 56 | # AC_CHECK_FUNCS(FUNC1 FUNC2 ...). |
@@ -44,11 +58,20 @@ AC_DEFUN([AC_CHECK_FUNCS_ONCE], [ | |||
44 | : | 58 | : |
45 | AC_FOREACH([gl_FUNC_NAME], [$1], [ | 59 | AC_FOREACH([gl_FUNC_NAME], [$1], [ |
46 | AC_DEFUN([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]), [ | 60 | AC_DEFUN([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]), [ |
47 | AC_CHECK_FUNCS(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.]) | ||
48 | ]) | 66 | ]) |
49 | AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME])) | 67 | AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME])) |
50 | ]) | 68 | ]) |
51 | ]) | 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 | ]) | ||
52 | 75 | ||
53 | # AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of | 76 | # AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of |
54 | # AC_CHECK_DECLS(DECL1, DECL2, ...). | 77 | # AC_CHECK_DECLS(DECL1, DECL2, ...). |
diff --git a/m4/po.m4 b/m4/po.m4 new file mode 100644 index 00000000..f2795eea --- /dev/null +++ b/m4/po.m4 | |||
@@ -0,0 +1,429 @@ | |||
1 | # po.m4 serial 7 (gettext-0.14.3) | ||
2 | dnl Copyright (C) 1995-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 | dnl | ||
7 | dnl This file can can be used in projects which are not available under | ||
8 | dnl the GNU General Public License or the GNU Library General Public | ||
9 | dnl License but which still want to provide support for the GNU gettext | ||
10 | dnl functionality. | ||
11 | dnl Please note that the actual code of the GNU gettext library is covered | ||
12 | dnl by the GNU Library General Public License, and the rest of the GNU | ||
13 | dnl gettext package package is covered by the GNU General Public License. | ||
14 | dnl They are *not* in the public domain. | ||
15 | |||
16 | dnl Authors: | ||
17 | dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. | ||
18 | dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003. | ||
19 | |||
20 | AC_PREREQ(2.50) | ||
21 | |||
22 | dnl Checks for all prerequisites of the po subdirectory. | ||
23 | AC_DEFUN([AM_PO_SUBDIRS], | ||
24 | [ | ||
25 | AC_REQUIRE([AC_PROG_MAKE_SET])dnl | ||
26 | AC_REQUIRE([AC_PROG_INSTALL])dnl | ||
27 | AC_REQUIRE([AM_MKINSTALLDIRS])dnl | ||
28 | AC_REQUIRE([AM_NLS])dnl | ||
29 | |||
30 | dnl Perform the following tests also if --disable-nls has been given, | ||
31 | dnl because they are needed for "make dist" to work. | ||
32 | |||
33 | dnl Search for GNU msgfmt in the PATH. | ||
34 | dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. | ||
35 | dnl The second test excludes FreeBSD msgfmt. | ||
36 | AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, | ||
37 | [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && | ||
38 | (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], | ||
39 | :) | ||
40 | AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) | ||
41 | |||
42 | dnl Search for GNU xgettext 0.12 or newer in the PATH. | ||
43 | dnl The first test excludes Solaris xgettext and early GNU xgettext versions. | ||
44 | dnl The second test excludes FreeBSD xgettext. | ||
45 | AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, | ||
46 | [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && | ||
47 | (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], | ||
48 | :) | ||
49 | dnl Remove leftover from FreeBSD xgettext call. | ||
50 | rm -f messages.po | ||
51 | |||
52 | dnl Search for GNU msgmerge 0.11 or newer in the PATH. | ||
53 | AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, | ||
54 | [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :) | ||
55 | |||
56 | dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. | ||
57 | dnl Test whether we really found GNU msgfmt. | ||
58 | if test "$GMSGFMT" != ":"; then | ||
59 | dnl If it is no GNU msgfmt we define it as : so that the | ||
60 | dnl Makefiles still can work. | ||
61 | if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && | ||
62 | (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then | ||
63 | : ; | ||
64 | else | ||
65 | GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` | ||
66 | AC_MSG_RESULT( | ||
67 | [found $GMSGFMT program is not GNU msgfmt; ignore it]) | ||
68 | GMSGFMT=":" | ||
69 | fi | ||
70 | fi | ||
71 | |||
72 | dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. | ||
73 | dnl Test whether we really found GNU xgettext. | ||
74 | if test "$XGETTEXT" != ":"; then | ||
75 | dnl If it is no GNU xgettext we define it as : so that the | ||
76 | dnl Makefiles still can work. | ||
77 | if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 && | ||
78 | (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then | ||
79 | : ; | ||
80 | else | ||
81 | AC_MSG_RESULT( | ||
82 | [found xgettext program is not GNU xgettext; ignore it]) | ||
83 | XGETTEXT=":" | ||
84 | fi | ||
85 | dnl Remove leftover from FreeBSD xgettext call. | ||
86 | rm -f messages.po | ||
87 | fi | ||
88 | |||
89 | AC_OUTPUT_COMMANDS([ | ||
90 | for ac_file in $CONFIG_FILES; do | ||
91 | # Support "outfile[:infile[:infile...]]" | ||
92 | case "$ac_file" in | ||
93 | *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; | ||
94 | esac | ||
95 | # PO directories have a Makefile.in generated from Makefile.in.in. | ||
96 | case "$ac_file" in */Makefile.in) | ||
97 | # Adjust a relative srcdir. | ||
98 | ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` | ||
99 | ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" | ||
100 | ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` | ||
101 | # In autoconf-2.13 it is called $ac_given_srcdir. | ||
102 | # In autoconf-2.50 it is called $srcdir. | ||
103 | test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" | ||
104 | case "$ac_given_srcdir" in | ||
105 | .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; | ||
106 | /*) top_srcdir="$ac_given_srcdir" ;; | ||
107 | *) top_srcdir="$ac_dots$ac_given_srcdir" ;; | ||
108 | esac | ||
109 | # Treat a directory as a PO directory if and only if it has a | ||
110 | # POTFILES.in file. This allows packages to have multiple PO | ||
111 | # directories under different names or in different locations. | ||
112 | if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then | ||
113 | rm -f "$ac_dir/POTFILES" | ||
114 | test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" | ||
115 | cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" | ||
116 | POMAKEFILEDEPS="POTFILES.in" | ||
117 | # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend | ||
118 | # on $ac_dir but don't depend on user-specified configuration | ||
119 | # parameters. | ||
120 | if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then | ||
121 | # The LINGUAS file contains the set of available languages. | ||
122 | if test -n "$OBSOLETE_ALL_LINGUAS"; then | ||
123 | test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" | ||
124 | fi | ||
125 | ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` | ||
126 | # Hide the ALL_LINGUAS assigment from automake. | ||
127 | eval 'ALL_LINGUAS''=$ALL_LINGUAS_' | ||
128 | POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" | ||
129 | else | ||
130 | # The set of available languages was given in configure.in. | ||
131 | eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' | ||
132 | fi | ||
133 | # Compute POFILES | ||
134 | # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) | ||
135 | # Compute UPDATEPOFILES | ||
136 | # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) | ||
137 | # Compute DUMMYPOFILES | ||
138 | # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) | ||
139 | # Compute GMOFILES | ||
140 | # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) | ||
141 | case "$ac_given_srcdir" in | ||
142 | .) srcdirpre= ;; | ||
143 | *) srcdirpre='$(srcdir)/' ;; | ||
144 | esac | ||
145 | POFILES= | ||
146 | UPDATEPOFILES= | ||
147 | DUMMYPOFILES= | ||
148 | GMOFILES= | ||
149 | for lang in $ALL_LINGUAS; do | ||
150 | POFILES="$POFILES $srcdirpre$lang.po" | ||
151 | UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" | ||
152 | DUMMYPOFILES="$DUMMYPOFILES $lang.nop" | ||
153 | GMOFILES="$GMOFILES $srcdirpre$lang.gmo" | ||
154 | done | ||
155 | # CATALOGS depends on both $ac_dir and the user's LINGUAS | ||
156 | # environment variable. | ||
157 | INST_LINGUAS= | ||
158 | if test -n "$ALL_LINGUAS"; then | ||
159 | for presentlang in $ALL_LINGUAS; do | ||
160 | useit=no | ||
161 | if test "%UNSET%" != "$LINGUAS"; then | ||
162 | desiredlanguages="$LINGUAS" | ||
163 | else | ||
164 | desiredlanguages="$ALL_LINGUAS" | ||
165 | fi | ||
166 | for desiredlang in $desiredlanguages; do | ||
167 | # Use the presentlang catalog if desiredlang is | ||
168 | # a. equal to presentlang, or | ||
169 | # b. a variant of presentlang (because in this case, | ||
170 | # presentlang can be used as a fallback for messages | ||
171 | # which are not translated in the desiredlang catalog). | ||
172 | case "$desiredlang" in | ||
173 | "$presentlang"*) useit=yes;; | ||
174 | esac | ||
175 | done | ||
176 | if test $useit = yes; then | ||
177 | INST_LINGUAS="$INST_LINGUAS $presentlang" | ||
178 | fi | ||
179 | done | ||
180 | fi | ||
181 | CATALOGS= | ||
182 | if test -n "$INST_LINGUAS"; then | ||
183 | for lang in $INST_LINGUAS; do | ||
184 | CATALOGS="$CATALOGS $lang.gmo" | ||
185 | done | ||
186 | fi | ||
187 | test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" | ||
188 | sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" | ||
189 | for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do | ||
190 | if test -f "$f"; then | ||
191 | case "$f" in | ||
192 | *.orig | *.bak | *~) ;; | ||
193 | *) cat "$f" >> "$ac_dir/Makefile" ;; | ||
194 | esac | ||
195 | fi | ||
196 | done | ||
197 | fi | ||
198 | ;; | ||
199 | esac | ||
200 | done], | ||
201 | [# Capture the value of obsolete ALL_LINGUAS because we need it to compute | ||
202 | # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it | ||
203 | # from automake. | ||
204 | eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' | ||
205 | # Capture the value of LINGUAS because we need it to compute CATALOGS. | ||
206 | LINGUAS="${LINGUAS-%UNSET%}" | ||
207 | ]) | ||
208 | ]) | ||
209 | |||
210 | dnl Postprocesses a Makefile in a directory containing PO files. | ||
211 | AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE], | ||
212 | [ | ||
213 | # When this code is run, in config.status, two variables have already been | ||
214 | # set: | ||
215 | # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in, | ||
216 | # - LINGUAS is the value of the environment variable LINGUAS at configure | ||
217 | # time. | ||
218 | |||
219 | changequote(,)dnl | ||
220 | # Adjust a relative srcdir. | ||
221 | ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` | ||
222 | ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" | ||
223 | ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` | ||
224 | # In autoconf-2.13 it is called $ac_given_srcdir. | ||
225 | # In autoconf-2.50 it is called $srcdir. | ||
226 | test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" | ||
227 | case "$ac_given_srcdir" in | ||
228 | .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; | ||
229 | /*) top_srcdir="$ac_given_srcdir" ;; | ||
230 | *) top_srcdir="$ac_dots$ac_given_srcdir" ;; | ||
231 | esac | ||
232 | |||
233 | # Find a way to echo strings without interpreting backslash. | ||
234 | if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then | ||
235 | gt_echo='echo' | ||
236 | else | ||
237 | if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then | ||
238 | gt_echo='printf %s\n' | ||
239 | else | ||
240 | echo_func () { | ||
241 | cat <<EOT | ||
242 | $* | ||
243 | EOT | ||
244 | } | ||
245 | gt_echo='echo_func' | ||
246 | fi | ||
247 | fi | ||
248 | |||
249 | # A sed script that extracts the value of VARIABLE from a Makefile. | ||
250 | sed_x_variable=' | ||
251 | # Test if the hold space is empty. | ||
252 | x | ||
253 | s/P/P/ | ||
254 | x | ||
255 | ta | ||
256 | # Yes it was empty. Look if we have the expected variable definition. | ||
257 | /^[ ]*VARIABLE[ ]*=/{ | ||
258 | # Seen the first line of the variable definition. | ||
259 | s/^[ ]*VARIABLE[ ]*=// | ||
260 | ba | ||
261 | } | ||
262 | bd | ||
263 | :a | ||
264 | # Here we are processing a line from the variable definition. | ||
265 | # Remove comment, more precisely replace it with a space. | ||
266 | s/#.*$/ / | ||
267 | # See if the line ends in a backslash. | ||
268 | tb | ||
269 | :b | ||
270 | s/\\$// | ||
271 | # Print the line, without the trailing backslash. | ||
272 | p | ||
273 | tc | ||
274 | # There was no trailing backslash. The end of the variable definition is | ||
275 | # reached. Clear the hold space. | ||
276 | s/^.*$// | ||
277 | x | ||
278 | bd | ||
279 | :c | ||
280 | # A trailing backslash means that the variable definition continues in the | ||
281 | # next line. Put a nonempty string into the hold space to indicate this. | ||
282 | s/^.*$/P/ | ||
283 | x | ||
284 | :d | ||
285 | ' | ||
286 | changequote([,])dnl | ||
287 | |||
288 | # Set POTFILES to the value of the Makefile variable POTFILES. | ||
289 | sed_x_POTFILES="`$gt_echo \"$sed_x_variable\" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'`" | ||
290 | POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"` | ||
291 | # Compute POTFILES_DEPS as | ||
292 | # $(foreach file, $(POTFILES), $(top_srcdir)/$(file)) | ||
293 | POTFILES_DEPS= | ||
294 | for file in $POTFILES; do | ||
295 | POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file" | ||
296 | done | ||
297 | POMAKEFILEDEPS="" | ||
298 | |||
299 | if test -n "$OBSOLETE_ALL_LINGUAS"; then | ||
300 | test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" | ||
301 | fi | ||
302 | if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then | ||
303 | # The LINGUAS file contains the set of available languages. | ||
304 | ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` | ||
305 | POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" | ||
306 | else | ||
307 | # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS. | ||
308 | sed_x_LINGUAS="`$gt_echo \"$sed_x_variable\" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'`" | ||
309 | ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"` | ||
310 | fi | ||
311 | # Hide the ALL_LINGUAS assigment from automake. | ||
312 | eval 'ALL_LINGUAS''=$ALL_LINGUAS_' | ||
313 | # Compute POFILES | ||
314 | # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) | ||
315 | # Compute UPDATEPOFILES | ||
316 | # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) | ||
317 | # Compute DUMMYPOFILES | ||
318 | # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) | ||
319 | # Compute GMOFILES | ||
320 | # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) | ||
321 | # Compute PROPERTIESFILES | ||
322 | # as $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).properties) | ||
323 | # Compute CLASSFILES | ||
324 | # as $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).class) | ||
325 | # Compute QMFILES | ||
326 | # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm) | ||
327 | # Compute MSGFILES | ||
328 | # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg) | ||
329 | # Compute RESOURCESDLLFILES | ||
330 | # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll) | ||
331 | case "$ac_given_srcdir" in | ||
332 | .) srcdirpre= ;; | ||
333 | *) srcdirpre='$(srcdir)/' ;; | ||
334 | esac | ||
335 | POFILES= | ||
336 | UPDATEPOFILES= | ||
337 | DUMMYPOFILES= | ||
338 | GMOFILES= | ||
339 | PROPERTIESFILES= | ||
340 | CLASSFILES= | ||
341 | QMFILES= | ||
342 | MSGFILES= | ||
343 | RESOURCESDLLFILES= | ||
344 | for lang in $ALL_LINGUAS; do | ||
345 | POFILES="$POFILES $srcdirpre$lang.po" | ||
346 | UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" | ||
347 | DUMMYPOFILES="$DUMMYPOFILES $lang.nop" | ||
348 | GMOFILES="$GMOFILES $srcdirpre$lang.gmo" | ||
349 | PROPERTIESFILES="$PROPERTIESFILES \$(top_srcdir)/\$(DOMAIN)_$lang.properties" | ||
350 | CLASSFILES="$CLASSFILES \$(top_srcdir)/\$(DOMAIN)_$lang.class" | ||
351 | QMFILES="$QMFILES $srcdirpre$lang.qm" | ||
352 | frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` | ||
353 | MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg" | ||
354 | frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` | ||
355 | RESOURCESDLLFILES="$RESOURCESDLLFILES $srcdirpre$frobbedlang/\$(DOMAIN).resources.dll" | ||
356 | done | ||
357 | # CATALOGS depends on both $ac_dir and the user's LINGUAS | ||
358 | # environment variable. | ||
359 | INST_LINGUAS= | ||
360 | if test -n "$ALL_LINGUAS"; then | ||
361 | for presentlang in $ALL_LINGUAS; do | ||
362 | useit=no | ||
363 | if test "%UNSET%" != "$LINGUAS"; then | ||
364 | desiredlanguages="$LINGUAS" | ||
365 | else | ||
366 | desiredlanguages="$ALL_LINGUAS" | ||
367 | fi | ||
368 | for desiredlang in $desiredlanguages; do | ||
369 | # Use the presentlang catalog if desiredlang is | ||
370 | # a. equal to presentlang, or | ||
371 | # b. a variant of presentlang (because in this case, | ||
372 | # presentlang can be used as a fallback for messages | ||
373 | # which are not translated in the desiredlang catalog). | ||
374 | case "$desiredlang" in | ||
375 | "$presentlang"*) useit=yes;; | ||
376 | esac | ||
377 | done | ||
378 | if test $useit = yes; then | ||
379 | INST_LINGUAS="$INST_LINGUAS $presentlang" | ||
380 | fi | ||
381 | done | ||
382 | fi | ||
383 | CATALOGS= | ||
384 | JAVACATALOGS= | ||
385 | QTCATALOGS= | ||
386 | TCLCATALOGS= | ||
387 | CSHARPCATALOGS= | ||
388 | if test -n "$INST_LINGUAS"; then | ||
389 | for lang in $INST_LINGUAS; do | ||
390 | CATALOGS="$CATALOGS $lang.gmo" | ||
391 | JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties" | ||
392 | QTCATALOGS="$QTCATALOGS $lang.qm" | ||
393 | frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` | ||
394 | TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg" | ||
395 | frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` | ||
396 | CSHARPCATALOGS="$CSHARPCATALOGS $frobbedlang/\$(DOMAIN).resources.dll" | ||
397 | done | ||
398 | fi | ||
399 | |||
400 | sed -e "s|@POTFILES_DEPS@|$POTFILES_DEPS|g" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@PROPERTIESFILES@|$PROPERTIESFILES|g" -e "s|@CLASSFILES@|$CLASSFILES|g" -e "s|@QMFILES@|$QMFILES|g" -e "s|@MSGFILES@|$MSGFILES|g" -e "s|@RESOURCESDLLFILES@|$RESOURCESDLLFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@JAVACATALOGS@|$JAVACATALOGS|g" -e "s|@QTCATALOGS@|$QTCATALOGS|g" -e "s|@TCLCATALOGS@|$TCLCATALOGS|g" -e "s|@CSHARPCATALOGS@|$CSHARPCATALOGS|g" -e 's,^#distdir:,distdir:,' < "$ac_file" > "$ac_file.tmp" | ||
401 | if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then | ||
402 | # Add dependencies that cannot be formulated as a simple suffix rule. | ||
403 | for lang in $ALL_LINGUAS; do | ||
404 | frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` | ||
405 | cat >> "$ac_file.tmp" <<EOF | ||
406 | $frobbedlang.msg: $lang.po | ||
407 | @echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \ | ||
408 | \$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; } | ||
409 | EOF | ||
410 | done | ||
411 | fi | ||
412 | if grep -l '@CSHARPCATALOGS@' "$ac_file" > /dev/null; then | ||
413 | # Add dependencies that cannot be formulated as a simple suffix rule. | ||
414 | for lang in $ALL_LINGUAS; do | ||
415 | frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` | ||
416 | cat >> "$ac_file.tmp" <<EOF | ||
417 | $frobbedlang/\$(DOMAIN).resources.dll: $lang.po | ||
418 | @echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \ | ||
419 | \$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; } | ||
420 | EOF | ||
421 | done | ||
422 | fi | ||
423 | if test -n "$POMAKEFILEDEPS"; then | ||
424 | cat >> "$ac_file.tmp" <<EOF | ||
425 | Makefile: $POMAKEFILEDEPS | ||
426 | EOF | ||
427 | fi | ||
428 | mv "$ac_file.tmp" "$ac_file" | ||
429 | ]) | ||
diff --git a/m4/progtest.m4 b/m4/progtest.m4 index 443c8e30..a56365cd 100644 --- a/m4/progtest.m4 +++ b/m4/progtest.m4 | |||
@@ -1,10 +1,8 @@ | |||
1 | # progtest.m4 serial 2 (gettext-0.10.40) | 1 | # progtest.m4 serial 4 (gettext-0.14.2) |
2 | dnl Copyright (C) 1996-2002 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 1996-2003, 2005 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl with or without modifications, as long as this notice is preserved. |
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 | 6 | dnl |
9 | dnl This file can can be used in projects which are not available under | 7 | 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 | 8 | dnl the GNU General Public License or the GNU Library General Public |
@@ -18,36 +16,71 @@ dnl They are *not* in the public domain. | |||
18 | dnl Authors: | 16 | dnl Authors: |
19 | dnl Ulrich Drepper <drepper@cygnus.com>, 1996. | 17 | dnl Ulrich Drepper <drepper@cygnus.com>, 1996. |
20 | 18 | ||
19 | AC_PREREQ(2.50) | ||
20 | |||
21 | # Search path for a program which passes the given test. | 21 | # Search path for a program which passes the given test. |
22 | 22 | ||
23 | dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, | 23 | dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, |
24 | dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) | 24 | dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) |
25 | AC_DEFUN([AM_PATH_PROG_WITH_TEST], | 25 | AC_DEFUN([AM_PATH_PROG_WITH_TEST], |
26 | [# Extract the first word of "$2", so it can be a program name with args. | 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. | ||
27 | set dummy $2; ac_word=[$]2 | 56 | set dummy $2; ac_word=[$]2 |
28 | AC_MSG_CHECKING([for $ac_word]) | 57 | AC_MSG_CHECKING([for $ac_word]) |
29 | AC_CACHE_VAL(ac_cv_path_$1, | 58 | AC_CACHE_VAL(ac_cv_path_$1, |
30 | [case "[$]$1" in | 59 | [case "[$]$1" in |
31 | /*) | 60 | [[\\/]]* | ?:[[\\/]]*) |
32 | ac_cv_path_$1="[$]$1" # Let the user override the test with a path. | 61 | ac_cv_path_$1="[$]$1" # Let the user override the test with a path. |
33 | ;; | 62 | ;; |
34 | *) | 63 | *) |
35 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" | 64 | ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR |
36 | for ac_dir in ifelse([$5], , $PATH, [$5]); do | 65 | for ac_dir in ifelse([$5], , $PATH, [$5]); do |
37 | test -z "$ac_dir" && ac_dir=. | 66 | IFS="$ac_save_IFS" |
38 | if test -f $ac_dir/$ac_word; then | 67 | test -z "$ac_dir" && ac_dir=. |
39 | if [$3]; then | 68 | for ac_exec_ext in '' $ac_executable_extensions; do |
40 | ac_cv_path_$1="$ac_dir/$ac_word" | 69 | if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then |
41 | break | 70 | echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD |
42 | fi | 71 | if [$3]; then |
43 | fi | 72 | ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" |
44 | done | 73 | break 2 |
45 | IFS="$ac_save_ifs" | 74 | fi |
75 | fi | ||
76 | done | ||
77 | done | ||
78 | IFS="$ac_save_IFS" | ||
46 | dnl If no 4th arg is given, leave the cache variable unset, | 79 | dnl If no 4th arg is given, leave the cache variable unset, |
47 | dnl so AC_PATH_PROGS will keep looking. | 80 | dnl so AC_PATH_PROGS will keep looking. |
48 | ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" | 81 | ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" |
49 | ])dnl | 82 | ])dnl |
50 | ;; | 83 | ;; |
51 | esac])dnl | 84 | esac])dnl |
52 | $1="$ac_cv_path_$1" | 85 | $1="$ac_cv_path_$1" |
53 | if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then | 86 | if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then |
diff --git a/m4/realloc.m4 b/m4/realloc.m4 deleted file mode 100644 index 9f746f19..00000000 --- a/m4/realloc.m4 +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | # realloc.m4 serial 7 | ||
2 | dnl Copyright (C) 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 Jim Meyering. | ||
10 | dnl Determine whether realloc works when both arguments are 0. | ||
11 | dnl If it doesn't, arrange to use the replacement function. | ||
12 | |||
13 | AC_DEFUN([jm_FUNC_REALLOC], | ||
14 | [ | ||
15 | AC_REQUIRE([AC_FUNC_REALLOC]) | ||
16 | dnl autoconf < 2.57 used the symbol ac_cv_func_realloc_works. | ||
17 | if test X"$ac_cv_func_realloc_0_nonnull" = Xno || test X"$ac_cv_func_realloc_works" = Xno; then | ||
18 | gl_PREREQ_REALLOC | ||
19 | fi | ||
20 | ]) | ||
21 | |||
22 | # Prerequisites of lib/realloc.c. | ||
23 | AC_DEFUN([gl_PREREQ_REALLOC], [ | ||
24 | : | ||
25 | ]) | ||
diff --git a/m4/signed.m4 b/m4/signed.m4 new file mode 100644 index 00000000..048f5936 --- /dev/null +++ b/m4/signed.m4 | |||
@@ -0,0 +1,17 @@ | |||
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; the Free Software Foundation | ||
4 | dnl gives unlimited permission to copy and/or distribute it, | ||
5 | dnl with or without modifications, as long as this notice is preserved. | ||
6 | |||
7 | dnl From Bruno Haible. | ||
8 | |||
9 | AC_DEFUN([bh_C_SIGNED], | ||
10 | [ | ||
11 | AC_CACHE_CHECK([for signed], bh_cv_c_signed, | ||
12 | [AC_TRY_COMPILE(, [signed char x;], bh_cv_c_signed=yes, bh_cv_c_signed=no)]) | ||
13 | if test $bh_cv_c_signed = no; then | ||
14 | AC_DEFINE(signed, , | ||
15 | [Define to empty if the C compiler doesn't support this keyword.]) | ||
16 | fi | ||
17 | ]) | ||
diff --git a/m4/stdbool.m4 b/m4/stdbool.m4 index ed000c81..162f1dfc 100644 --- a/m4/stdbool.m4 +++ b/m4/stdbool.m4 | |||
@@ -1,21 +1,9 @@ | |||
1 | # Check for stdbool.h that conforms to C99. | 1 | # Check for stdbool.h that conforms to C99. |
2 | 2 | ||
3 | # Copyright (C) 2002-2003 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 2002-2005 Free Software Foundation, Inc. |
4 | 4 | dnl This file is free software; the Free Software Foundation | |
5 | # This program is free software; you can redistribute it and/or modify | 5 | dnl gives unlimited permission to copy and/or distribute it, |
6 | # it under the terms of the GNU General Public License as published by | 6 | dnl with or without modifications, as long as this notice is preserved. |
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 | ||
17 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||
18 | # 02111-1307, USA. | ||
19 | 7 | ||
20 | # Prepare for substituting <stdbool.h> if it is not supported. | 8 | # Prepare for substituting <stdbool.h> if it is not supported. |
21 | 9 | ||
@@ -40,7 +28,10 @@ AC_DEFUN([AM_STDBOOL_H], | |||
40 | AC_SUBST([HAVE__BOOL]) | 28 | AC_SUBST([HAVE__BOOL]) |
41 | ]) | 29 | ]) |
42 | 30 | ||
43 | # This macro is only needed in autoconf <= 2.54. Newer versions of autoconf | 31 | # AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future. |
32 | AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H]) | ||
33 | |||
34 | # This macro is only needed in autoconf <= 2.59. Newer versions of autoconf | ||
44 | # have this macro built-in. | 35 | # have this macro built-in. |
45 | 36 | ||
46 | AC_DEFUN([AC_HEADER_STDBOOL], | 37 | AC_DEFUN([AC_HEADER_STDBOOL], |
@@ -59,7 +50,7 @@ AC_DEFUN([AC_HEADER_STDBOOL], | |||
59 | "error: false is not 0" | 50 | "error: false is not 0" |
60 | #endif | 51 | #endif |
61 | #ifndef true | 52 | #ifndef true |
62 | "error: false is not defined" | 53 | "error: true is not defined" |
63 | #endif | 54 | #endif |
64 | #if true != 1 | 55 | #if true != 1 |
65 | "error: true is not 1" | 56 | "error: true is not 1" |
@@ -79,8 +70,36 @@ AC_DEFUN([AC_HEADER_STDBOOL], | |||
79 | char g[true]; | 70 | char g[true]; |
80 | char h[sizeof (_Bool)]; | 71 | char h[sizeof (_Bool)]; |
81 | char i[sizeof s.t]; | 72 | char i[sizeof s.t]; |
73 | enum { j = false, k = true, l = false * true, m = true * 256 }; | ||
74 | _Bool n[m]; | ||
75 | char o[sizeof n == m * sizeof n[0] ? 1 : -1]; | ||
76 | char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; | ||
77 | #if defined __xlc__ || __GNUC__ | ||
78 | /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 | ||
79 | reported by James Lemley on 2005-10-05; see | ||
80 | <http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html>. | ||
81 | This test is not quite right, since xlc is allowed to | ||
82 | reject this program, as the initializer for xlcbug is | ||
83 | not one of the forms that C requires support for. | ||
84 | However, doing the test right would require a run-time | ||
85 | test, and that would make cross-compilation harder. | ||
86 | Let us hope that IBM fixes the xlc bug, and also adds | ||
87 | support for this kind of constant expression. In the | ||
88 | meantime, this test will reject xlc, which is OK, since | ||
89 | our stdbool.h substitute should suffice. */ | ||
90 | char digs[] = "0123456789"; | ||
91 | int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); | ||
92 | #endif | ||
93 | _Bool q = true; | ||
94 | _Bool *pq = &q; | ||
95 | ], | ||
96 | [ | ||
97 | *pq |= q; | ||
98 | *pq |= ! q; | ||
99 | /* Refer to every declared value, to avoid compiler optimizations. */ | ||
100 | return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l | ||
101 | + !m + !n + !o + !p + !q + !pq); | ||
82 | ], | 102 | ], |
83 | [ return !a + !b + !c + !d + !e + !f + !g + !h + !i; ], | ||
84 | [ac_cv_header_stdbool_h=yes], | 103 | [ac_cv_header_stdbool_h=yes], |
85 | [ac_cv_header_stdbool_h=no])]) | 104 | [ac_cv_header_stdbool_h=no])]) |
86 | AC_CHECK_TYPES([_Bool]) | 105 | AC_CHECK_TYPES([_Bool]) |
diff --git a/m4/stdint_h.m4 b/m4/stdint_h.m4 index 4b5a4ac6..3355f35a 100644 --- a/m4/stdint_h.m4 +++ b/m4/stdint_h.m4 | |||
@@ -1,28 +1,26 @@ | |||
1 | # stdint_h.m4 serial 2 (gettext-0.11.4) | 1 | # stdint_h.m4 serial 5 |
2 | dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 1997-2004 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | 6 | ||
9 | dnl From Paul Eggert. | 7 | dnl From Paul Eggert. |
10 | 8 | ||
11 | # Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists, | 9 | # Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists, |
12 | # doesn't clash with <sys/types.h>, and declares uintmax_t. | 10 | # doesn't clash with <sys/types.h>, and declares uintmax_t. |
13 | 11 | ||
14 | AC_DEFUN([jm_AC_HEADER_STDINT_H], | 12 | AC_DEFUN([gl_AC_HEADER_STDINT_H], |
15 | [ | 13 | [ |
16 | AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h, | 14 | AC_CACHE_CHECK([for stdint.h], gl_cv_header_stdint_h, |
17 | [AC_TRY_COMPILE( | 15 | [AC_TRY_COMPILE( |
18 | [#include <sys/types.h> | 16 | [#include <sys/types.h> |
19 | #include <stdint.h>], | 17 | #include <stdint.h>], |
20 | [uintmax_t i = (uintmax_t) -1;], | 18 | [uintmax_t i = (uintmax_t) -1;], |
21 | jm_ac_cv_header_stdint_h=yes, | 19 | gl_cv_header_stdint_h=yes, |
22 | jm_ac_cv_header_stdint_h=no)]) | 20 | gl_cv_header_stdint_h=no)]) |
23 | if test $jm_ac_cv_header_stdint_h = yes; then | 21 | if test $gl_cv_header_stdint_h = yes; then |
24 | AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1, | 22 | AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1, |
25 | [Define if <stdint.h> exists, doesn't clash with <sys/types.h>, | 23 | [Define if <stdint.h> exists, doesn't clash with <sys/types.h>, |
26 | and declares uintmax_t. ]) | 24 | and declares uintmax_t. ]) |
27 | fi | 25 | fi |
28 | ]) | 26 | ]) |
diff --git a/m4/uintmax_t.m4 b/m4/uintmax_t.m4 index ec3a8b92..bf83ed74 100644 --- a/m4/uintmax_t.m4 +++ b/m4/uintmax_t.m4 | |||
@@ -1,29 +1,30 @@ | |||
1 | # uintmax_t.m4 serial 6 (gettext-0.11) | 1 | # uintmax_t.m4 serial 9 |
2 | dnl Copyright (C) 1997-2002 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 1997-2004 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | 6 | ||
9 | dnl From Paul Eggert. | 7 | dnl From Paul Eggert. |
10 | 8 | ||
11 | AC_PREREQ(2.13) | 9 | AC_PREREQ(2.13) |
12 | 10 | ||
13 | # Define uintmax_t to `unsigned long' or `unsigned long long' | 11 | # Define uintmax_t to 'unsigned long' or 'unsigned long long' |
14 | # if <inttypes.h> does not exist. | 12 | # if it is not already defined in <stdint.h> or <inttypes.h>. |
15 | 13 | ||
16 | AC_DEFUN([jm_AC_TYPE_UINTMAX_T], | 14 | AC_DEFUN([gl_AC_TYPE_UINTMAX_T], |
17 | [ | 15 | [ |
18 | AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) | 16 | AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) |
19 | AC_REQUIRE([jm_AC_HEADER_STDINT_H]) | 17 | AC_REQUIRE([gl_AC_HEADER_STDINT_H]) |
20 | if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then | 18 | if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then |
21 | AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG]) | 19 | AC_REQUIRE([gl_AC_TYPE_UNSIGNED_LONG_LONG]) |
22 | test $ac_cv_type_unsigned_long_long = yes \ | 20 | test $ac_cv_type_unsigned_long_long = yes \ |
23 | && ac_type='unsigned long long' \ | 21 | && ac_type='unsigned long long' \ |
24 | || ac_type='unsigned long' | 22 | || ac_type='unsigned long' |
25 | AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, | 23 | AC_DEFINE_UNQUOTED(uintmax_t, $ac_type, |
26 | [Define to unsigned long or unsigned long long | 24 | [Define to unsigned long or unsigned long long |
27 | if <inttypes.h> and <stdint.h> don't define.]) | 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>.]) | ||
28 | fi | 29 | fi |
29 | ]) | 30 | ]) |
diff --git a/m4/ulonglong.m4 b/m4/ulonglong.m4 index c375e474..dee10ccc 100644 --- a/m4/ulonglong.m4 +++ b/m4/ulonglong.m4 | |||
@@ -1,23 +1,23 @@ | |||
1 | # ulonglong.m4 serial 2 (fileutils-4.0.32, gettext-0.10.40) | 1 | # ulonglong.m4 serial 4 |
2 | dnl Copyright (C) 1999-2002 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 1999-2004 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | 6 | ||
9 | dnl From Paul Eggert. | 7 | dnl From Paul Eggert. |
10 | 8 | ||
11 | AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG], | 9 | # Define HAVE_UNSIGNED_LONG_LONG if 'unsigned long long' works. |
10 | |||
11 | AC_DEFUN([gl_AC_TYPE_UNSIGNED_LONG_LONG], | ||
12 | [ | 12 | [ |
13 | AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long, | 13 | AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long, |
14 | [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;], | 14 | [AC_TRY_LINK([unsigned long long ull = 1ULL; int i = 63;], |
15 | [unsigned long long ullmax = (unsigned long long) -1; | 15 | [unsigned long long ullmax = (unsigned long long) -1; |
16 | return ull << i | ull >> i | ullmax / ull | ullmax % ull;], | 16 | return ull << i | ull >> i | ullmax / ull | ullmax % ull;], |
17 | ac_cv_type_unsigned_long_long=yes, | 17 | ac_cv_type_unsigned_long_long=yes, |
18 | ac_cv_type_unsigned_long_long=no)]) | 18 | ac_cv_type_unsigned_long_long=no)]) |
19 | if test $ac_cv_type_unsigned_long_long = yes; then | 19 | if test $ac_cv_type_unsigned_long_long = yes; then |
20 | AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1, | 20 | AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1, |
21 | [Define if you have the unsigned long long type.]) | 21 | [Define if you have the 'unsigned long long' type.]) |
22 | fi | 22 | fi |
23 | ]) | 23 | ]) |
diff --git a/m4/unlocked-io.m4 b/m4/unlocked-io.m4 index f8e98f1d..6cbacb00 100644 --- a/m4/unlocked-io.m4 +++ b/m4/unlocked-io.m4 | |||
@@ -1,4 +1,11 @@ | |||
1 | #serial 8 -*- autoconf -*- | 1 | # unlocked-io.m4 serial 12 |
2 | |||
3 | # Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 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. | ||
2 | 9 | ||
3 | dnl From Jim Meyering. | 10 | dnl From Jim Meyering. |
4 | dnl | 11 | dnl |
@@ -8,8 +15,15 @@ dnl (because some of them were declared in Solaris 2.5.1 but were removed | |||
8 | dnl in Solaris 2.6, whereas we want binaries built on Solaris 2.5.1 to run | 15 | dnl in Solaris 2.6, whereas we want binaries built on Solaris 2.5.1 to run |
9 | dnl on Solaris 2.6). | 16 | dnl on Solaris 2.6). |
10 | 17 | ||
11 | AC_DEFUN([jm_FUNC_GLIBC_UNLOCKED_IO], | 18 | AC_DEFUN([gl_FUNC_GLIBC_UNLOCKED_IO], |
12 | [ | 19 | [ |
20 | AC_LIBSOURCES([unlocked-io.h]) | ||
21 | |||
22 | AC_DEFINE([USE_UNLOCKED_IO], 1, | ||
23 | [Define to 1 if you want getc etc. to use unlocked I/O if available. | ||
24 | Unlocked I/O can improve performance in unithreaded apps, | ||
25 | but it is not safe for multithreaded apps.]) | ||
26 | |||
13 | dnl Persuade glibc and Solaris <stdio.h> to declare | 27 | dnl Persuade glibc and Solaris <stdio.h> to declare |
14 | dnl fgets_unlocked(), fputs_unlocked() etc. | 28 | dnl fgets_unlocked(), fputs_unlocked() etc. |
15 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | 29 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) |
diff --git a/m4/wchar_t.m4 b/m4/wchar_t.m4 new file mode 100644 index 00000000..cde2129a --- /dev/null +++ b/m4/wchar_t.m4 | |||
@@ -0,0 +1,20 @@ | |||
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; 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 <stddef.h> has the 'wchar_t' type. | ||
9 | dnl Prerequisite: AC_PROG_CC | ||
10 | |||
11 | AC_DEFUN([gt_TYPE_WCHAR_T], | ||
12 | [ | ||
13 | AC_CACHE_CHECK([for wchar_t], gt_cv_c_wchar_t, | ||
14 | [AC_TRY_COMPILE([#include <stddef.h> | ||
15 | wchar_t foo = (wchar_t)'\0';], , | ||
16 | gt_cv_c_wchar_t=yes, gt_cv_c_wchar_t=no)]) | ||
17 | if test $gt_cv_c_wchar_t = yes; then | ||
18 | AC_DEFINE(HAVE_WCHAR_T, 1, [Define if you have the 'wchar_t' type.]) | ||
19 | fi | ||
20 | ]) | ||
diff --git a/m4/wint_t.m4 b/m4/wint_t.m4 new file mode 100644 index 00000000..b8fff9c8 --- /dev/null +++ b/m4/wint_t.m4 | |||
@@ -0,0 +1,20 @@ | |||
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; 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 <wchar.h> has the 'wint_t' type. | ||
9 | dnl Prerequisite: AC_PROG_CC | ||
10 | |||
11 | AC_DEFUN([gt_TYPE_WINT_T], | ||
12 | [ | ||
13 | AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t, | ||
14 | [AC_TRY_COMPILE([#include <wchar.h> | ||
15 | wint_t foo = (wchar_t)'\0';], , | ||
16 | gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)]) | ||
17 | if test $gt_cv_c_wint_t = yes; then | ||
18 | AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.]) | ||
19 | fi | ||
20 | ]) | ||
diff --git a/m4/xalloc.m4 b/m4/xalloc.m4 index dec84177..c0847dd3 100644 --- a/m4/xalloc.m4 +++ b/m4/xalloc.m4 | |||
@@ -1,16 +1,16 @@ | |||
1 | # xalloc.m4 serial 8 | 1 | # xalloc.m4 serial 12 |
2 | dnl Copyright (C) 2002-2003 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | 6 | ||
9 | AC_DEFUN([gl_XALLOC], | 7 | AC_DEFUN([gl_XALLOC], |
10 | [ | 8 | [ |
9 | AC_LIBSOURCES([xmalloc.c, xalloc.h]) | ||
10 | AC_LIBOBJ([xmalloc]) | ||
11 | |||
11 | gl_PREREQ_XALLOC | 12 | gl_PREREQ_XALLOC |
12 | gl_PREREQ_XMALLOC | 13 | gl_PREREQ_XMALLOC |
13 | gl_PREREQ_XSTRDUP | ||
14 | ]) | 14 | ]) |
15 | 15 | ||
16 | # Prerequisites of lib/xalloc.h. | 16 | # Prerequisites of lib/xalloc.h. |
@@ -21,12 +21,5 @@ AC_DEFUN([gl_PREREQ_XALLOC], [ | |||
21 | # Prerequisites of lib/xmalloc.c. | 21 | # Prerequisites of lib/xmalloc.c. |
22 | AC_DEFUN([gl_PREREQ_XMALLOC], [ | 22 | AC_DEFUN([gl_PREREQ_XMALLOC], [ |
23 | AC_REQUIRE([AC_C_INLINE]) | 23 | AC_REQUIRE([AC_C_INLINE]) |
24 | AC_REQUIRE([jm_FUNC_MALLOC]) | ||
25 | AC_REQUIRE([jm_FUNC_REALLOC]) | ||
26 | : | ||
27 | ]) | ||
28 | |||
29 | # Prerequisites of lib/xstrdup.c. | ||
30 | AC_DEFUN([gl_PREREQ_XSTRDUP], [ | ||
31 | : | 24 | : |
32 | ]) | 25 | ]) |
diff --git a/plugins-root/.cvsignore b/plugins-root/.cvsignore index e3a62594..70dc1744 100644 --- a/plugins-root/.cvsignore +++ b/plugins-root/.cvsignore | |||
@@ -1,5 +1,7 @@ | |||
1 | .deps | 1 | .deps |
2 | .libs | ||
2 | Makefile.in | 3 | Makefile.in |
3 | Makefile | 4 | Makefile |
4 | check_dhcp | 5 | check_dhcp |
5 | check_icmp | 6 | check_icmp |
7 | pst3 | ||
diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c index a3e0c53c..836bafb3 100644 --- a/plugins-root/check_dhcp.c +++ b/plugins-root/check_dhcp.c | |||
@@ -101,7 +101,6 @@ long mac_addr_dlpi( const char *, int, u_char *); | |||
101 | 101 | ||
102 | #endif | 102 | #endif |
103 | 103 | ||
104 | #define HAVE_GETOPT_H | ||
105 | 104 | ||
106 | 105 | ||
107 | /**** Common definitions ****/ | 106 | /**** Common definitions ****/ |
@@ -976,7 +975,6 @@ int call_getopt(int argc, char **argv){ | |||
976 | int i=0; | 975 | int i=0; |
977 | struct in_addr ipaddress; | 976 | struct in_addr ipaddress; |
978 | 977 | ||
979 | #ifdef HAVE_GETOPT_H | ||
980 | int option_index = 0; | 978 | int option_index = 0; |
981 | static struct option long_options[] = | 979 | static struct option long_options[] = |
982 | { | 980 | { |
@@ -989,14 +987,9 @@ int call_getopt(int argc, char **argv){ | |||
989 | {"help", no_argument, 0,'h'}, | 987 | {"help", no_argument, 0,'h'}, |
990 | {0,0,0,0} | 988 | {0,0,0,0} |
991 | }; | 989 | }; |
992 | #endif | ||
993 | 990 | ||
994 | while(1){ | 991 | while(1){ |
995 | #ifdef HAVE_GETOPT_H | ||
996 | c=getopt_long(argc,argv,"+hVvt:s:r:t:i:",long_options,&option_index); | 992 | c=getopt_long(argc,argv,"+hVvt:s:r:t:i:",long_options,&option_index); |
997 | #else | ||
998 | c=getopt(argc,argv,"+?hVvt:s:r:t:i:"); | ||
999 | #endif | ||
1000 | 993 | ||
1001 | i++; | 994 | i++; |
1002 | 995 | ||
diff --git a/plugins/.cvsignore b/plugins/.cvsignore index 7ac18354..f75aab28 100644 --- a/plugins/.cvsignore +++ b/plugins/.cvsignore | |||
@@ -1,3 +1,4 @@ | |||
1 | check_apt | ||
1 | check_disk | 2 | check_disk |
2 | check_dns | 3 | check_dns |
3 | check_dummy | 4 | check_dummy |
@@ -5,11 +6,13 @@ check_ftp | |||
5 | check_fping | 6 | check_fping |
6 | check_http | 7 | check_http |
7 | check_imap | 8 | check_imap |
9 | check_jabber | ||
8 | check_load | 10 | check_load |
9 | check_mrtg | 11 | check_mrtg |
10 | check_mrtgtraf | 12 | check_mrtgtraf |
11 | check_nagios | 13 | check_nagios |
12 | check_nntp | 14 | check_nntp |
15 | check_ntp | ||
13 | check_nwstat | 16 | check_nwstat |
14 | check_overcr | 17 | check_overcr |
15 | check_ping | 18 | check_ping |
@@ -46,3 +49,4 @@ Makefile | |||
46 | Makefile.in | 49 | Makefile.in |
47 | config.h.in | 50 | config.h.in |
48 | .deps | 51 | .deps |
52 | .libs | ||
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index ef236c08..898e6cb4 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
@@ -171,7 +171,7 @@ main (int argc, char **argv) | |||
171 | bindtextdomain (PACKAGE, LOCALEDIR); | 171 | bindtextdomain (PACKAGE, LOCALEDIR); |
172 | textdomain (PACKAGE); | 172 | textdomain (PACKAGE); |
173 | 173 | ||
174 | mount_list = read_filesystem_list (0); | 174 | mount_list = read_file_system_list (0); |
175 | 175 | ||
176 | if (process_arguments (argc, argv) == ERROR) | 176 | if (process_arguments (argc, argv) == ERROR) |
177 | usage4 (_("Could not parse arguments")); | 177 | usage4 (_("Could not parse arguments")); |
diff --git a/plugins/common.h b/plugins/common.h index 57f4f93a..baed12eb 100644 --- a/plugins/common.h +++ b/plugins/common.h | |||
@@ -83,10 +83,7 @@ | |||
83 | #include <signal.h> | 83 | #include <signal.h> |
84 | #endif | 84 | #endif |
85 | 85 | ||
86 | /* TODO: define can be removed when all ifdef in each plugin has been removed */ | ||
87 | #define HAVE_GETOPT_H | ||
88 | #include <getopt.h> | 86 | #include <getopt.h> |
89 | |||
90 | #include <ctype.h> | 87 | #include <ctype.h> |
91 | 88 | ||
92 | #ifdef HAVE_LWRES_NETDB_H | 89 | #ifdef HAVE_LWRES_NETDB_H |
diff --git a/plugins/tests/.cvsignore b/plugins/tests/.cvsignore index 95112e15..94b5122a 100644 --- a/plugins/tests/.cvsignore +++ b/plugins/tests/.cvsignore | |||
@@ -1,3 +1,4 @@ | |||
1 | Makefile | 1 | Makefile |
2 | Makefile.in | 2 | Makefile.in |
3 | test_utils | 3 | test_utils |
4 | .deps | ||
diff --git a/po/.cvsignore b/po/.cvsignore index 68b874df..e925c3a0 100644 --- a/po/.cvsignore +++ b/po/.cvsignore | |||
@@ -1,3 +1,5 @@ | |||
1 | Makefile | ||
2 | Makefile.in | ||
1 | Makefile.in.in | 3 | Makefile.in.in |
2 | Rules-quot | 4 | Rules-quot |
3 | boldquot.sed | 5 | boldquot.sed |
@@ -8,3 +10,5 @@ fr.gmo | |||
8 | insert-header.sin | 10 | insert-header.sin |
9 | quot.sed | 11 | quot.sed |
10 | remove-potcdate.sin | 12 | remove-potcdate.sin |
13 | POTFILES | ||
14 | stamp-po | ||
diff --git a/tools/setup b/tools/setup index 17eed516..63a165af 100755 --- a/tools/setup +++ b/tools/setup | |||
@@ -24,9 +24,10 @@ if test -d $HOME/share/aclocal ; then | |||
24 | extra="-I $HOME/share/aclocal" | 24 | extra="-I $HOME/share/aclocal" |
25 | fi | 25 | fi |
26 | 26 | ||
27 | autopoint --force | 27 | # I think gettext no longer necessary, as all necessary files imported from coreutils |
28 | #autopoint --force | ||
28 | aclocal -I m4 $extra | 29 | aclocal -I m4 $extra |
29 | libtoolize --force --copy | 30 | #libtoolize --force --copy |
30 | autoheader | 31 | autoheader |
31 | automake --add-missing --force-missing --copy | 32 | automake --add-missing --force-missing --copy |
32 | autoconf | 33 | autoconf |