Merge lp:~mordred/drizzle/bug614147 into lp:~drizzle-trunk/drizzle/development

Proposed by Monty Taylor
Status: Merged
Approved by: Brian Aker
Approved revision: 1706
Merged at revision: 1713
Proposed branch: lp:~mordred/drizzle/bug614147
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: 5110 lines (+62/-4770)
33 files modified
Makefile.am (+0/-2)
client/include.am (+0/-2)
configure.ac (+0/-1)
drizzled/include.am (+0/-2)
drizzled/message/include.am (+1/-2)
drizzled/message/table_writer.cc (+21/-26)
drizzled/temporal.cc (+38/-0)
gnulib/Makefile.am (+0/-207)
gnulib/dummy.c (+0/-42)
gnulib/getopt.c (+0/-1189)
gnulib/getopt.in.h (+0/-225)
gnulib/getopt1.c (+0/-170)
gnulib/getopt_int.h (+0/-130)
gnulib/gettext.h (+0/-279)
gnulib/mktime.c (+0/-519)
gnulib/time.in.h (+0/-124)
gnulib/time_r.c (+0/-47)
gnulib/timegm.c (+0/-41)
gnulib/unistd.in.h (+0/-554)
m4/getopt.m4 (+0/-83)
m4/gnulib-cache.m4 (+0/-37)
m4/gnulib-common.m4 (+0/-101)
m4/gnulib-comp.m4 (+0/-202)
m4/gnulib-tool.m4 (+0/-57)
m4/include_next.m4 (+0/-170)
m4/mktime.m4 (+0/-227)
m4/onceonly.m4 (+0/-90)
m4/pandora_canonical.m4 (+2/-0)
m4/time_h.m4 (+0/-75)
m4/time_r.m4 (+0/-43)
m4/timegm.m4 (+0/-40)
m4/unistd_h.m4 (+0/-81)
po/POTFILES.in (+0/-2)
To merge this branch: bzr merge lp:~mordred/drizzle/bug614147
Reviewer Review Type Date Requested Status
Drizzle Merge Team Pending
Review via email: mp+32531@code.launchpad.net

Description of the change

Should remove need for libintl on OSX. Also removes all use of gnulib. Win.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile.am'
2--- Makefile.am 2010-07-26 01:50:52 +0000
3+++ Makefile.am 2010-08-12 22:43:43 +0000
4@@ -31,7 +31,6 @@
5 VERSION=$(PANDORA_RELEASE_VERSION)
6
7 SUBDIRS = po \
8- gnulib \
9 .
10
11 DIST_SUBDIRS = ${SUBDIRS} tests
12@@ -48,7 +47,6 @@
13 extra/clean_source.sh \
14 extra/cpplint.py \
15 extra/run_cpplint.sh \
16- m4/gnulib-cache.m4 \
17 ${top_srcdir}/m4/pandora*m4
18
19
20
21=== modified file 'client/include.am'
22--- client/include.am 2010-06-21 11:08:00 +0000
23+++ client/include.am 2010-08-12 22:43:43 +0000
24@@ -7,7 +7,6 @@
25 $(LIBDRIZZLE) \
26 $(LIBINTL) \
27 $(LIBZ) \
28- gnulib/libgnu.la \
29 client/libgetpassword.la
30
31 noinst_LTLIBRARIES+= \
32@@ -44,7 +43,6 @@
33 $(LIBDRIZZLE) \
34 $(LIBINTL) \
35 $(LIBZ) \
36- gnulib/libgnu.la \
37 client/libgetpassword.la
38
39 client_drizzledump_SOURCES= client/drizzledump.cc
40
41=== modified file 'configure.ac'
42--- configure.ac 2010-07-06 21:50:49 +0000
43+++ configure.ac 2010-08-12 22:43:43 +0000
44@@ -111,7 +111,6 @@
45 AM_CONDITIONAL([BUILD_GCC_PCH],[test "no" = "yes"])
46
47 AC_CONFIG_FILES(Makefile dnl
48- gnulib/Makefile dnl
49 po/Makefile.in dnl
50 tests/Makefile dnl
51 drizzled/plugin/version.h dnl
52
53=== modified file 'drizzled/include.am'
54--- drizzled/include.am 2010-07-31 21:37:09 +0000
55+++ drizzled/include.am 2010-08-12 22:43:43 +0000
56@@ -453,7 +453,6 @@
57 drizzled/internal/libinternal.la \
58 drizzled/message/libdrizzledmessage.la \
59 drizzled/libtemporal.la \
60- gnulib/libgnu.la \
61 $(LIBZ) \
62 $(LIBINTL) \
63 ${LIBC_P} \
64@@ -819,7 +818,6 @@
65 drizzled/temporal.cc \
66 drizzled/temporal_format.cc \
67 drizzled/temporal_interval.cc
68-drizzled_libtemporal_la_LIBADD= gnulib/libgnu.la
69 drizzled_libtypelib_la_SOURCES = drizzled/typelib.cc
70 drizzled_libserialutil_la_SOURCES = drizzled/db.cc drizzled/table_proto_write.cc
71 drizzled_libserialutil_la_CXXFLAGS= ${AM_CXXFLAGS} ${PROTOSKIP_WARNINGS}
72
73=== modified file 'drizzled/message/include.am'
74--- drizzled/message/include.am 2010-08-10 20:48:00 +0000
75+++ drizzled/message/include.am 2010-08-12 22:43:43 +0000
76@@ -22,7 +22,6 @@
77 ${LIBUUID} \
78 ${LTLIBINTL} \
79 $(GCOV_LIBS) \
80- ${top_builddir}/gnulib/libgnu.la \
81 drizzled/internal/libinternal.la
82
83 MESSAGE_AM_CXXFLAGS = ${AM_CXXFLAGS} ${PROTOSKIP_WARNINGS}
84@@ -79,7 +78,7 @@
85 drizzled_message_table_raw_reader_CXXFLAGS = ${MESSAGE_AM_CXXFLAGS}
86
87 drizzled_message_table_writer_SOURCES = drizzled/message/table_writer.cc
88-drizzled_message_table_writer_LDADD = ${MESSAGE_LDADD}
89+drizzled_message_table_writer_LDADD = ${MESSAGE_LDADD} ${BOOST_LIBS}
90 drizzled_message_table_writer_CXXFLAGS = ${MESSAGE_AM_CXXFLAGS}
91
92 drizzled_message_transaction_writer_SOURCES = drizzled/message/transaction_writer.cc
93
94=== modified file 'drizzled/message/table_writer.cc'
95--- drizzled/message/table_writer.cc 2010-05-13 00:24:20 +0000
96+++ drizzled/message/table_writer.cc 2010-08-12 22:43:43 +0000
97@@ -22,12 +22,15 @@
98 #include <iostream>
99 #include <fstream>
100 #include <string>
101-#include <getopt.h>
102 #include <drizzled/message/table.pb.h>
103
104+#include <boost/program_options.hpp>
105+
106 using namespace std;
107 using namespace drizzled;
108
109+namespace po=boost::program_options;
110+
111 /*
112 Written from Google proto example
113 */
114@@ -213,38 +216,29 @@
115
116 }
117
118-static void usage(char *argv0)
119-{
120- cerr << "Usage: " << argv0 << " [-t N] TABLE_NAME.dfe" << endl;
121- cerr << endl;
122- cerr << "-t N\tTable Number" << endl;
123- cerr << "\t0 - default" << endl;
124- cerr << endl;
125-}
126
127 int main(int argc, char* argv[])
128 {
129- int opt;
130 int table_number= 0;
131
132 GOOGLE_PROTOBUF_VERIFY_VERSION;
133
134- while ((opt= getopt(argc, argv, "t:")) != -1)
135+ po::options_description desc("Allowed options");
136+ desc.add_options()
137+ ("help", "produce help message")
138+ ("table-number,t", po::value<int>(&table_number)->default_value(0), "Table Number");
139+
140+ po::variables_map vm;
141+ po::positional_options_description p;
142+ p.add("table-name", 1);
143+
144+ po::store(po::command_line_parser(argc, argv).options(desc).
145+ positional(p).run(), vm);
146+
147+ if (not vm.count("table-name"))
148 {
149- switch (opt)
150- {
151- case 't':
152- table_number= atoi(optarg);
153- break;
154- default:
155- usage(argv[0]);
156- exit(EXIT_FAILURE);
157- }
158- }
159-
160- if (optind >= argc) {
161 fprintf(stderr, "Expected Table name argument\n\n");
162- usage(argv[0]);
163+ cerr << desc << endl;
164 exit(EXIT_FAILURE);
165 }
166
167@@ -260,11 +254,12 @@
168 break;
169 default:
170 fprintf(stderr, "Invalid table number.\n\n");
171- usage(argv[0]);
172+ cerr << desc << endl;
173 exit(EXIT_FAILURE);
174 }
175
176- fstream output(argv[optind], ios::out | ios::trunc | ios::binary);
177+ fstream output(vm["table-name"].as<string>().c_str(),
178+ ios::out | ios::trunc | ios::binary);
179 if (!table.SerializeToOstream(&output))
180 {
181 cerr << "Failed to write schema." << endl;
182
183=== modified file 'drizzled/temporal.cc'
184--- drizzled/temporal.cc 2010-06-04 15:32:25 +0000
185+++ drizzled/temporal.cc 2010-08-12 22:43:43 +0000
186@@ -81,6 +81,44 @@
187 + _seconds);
188 }
189
190+#if defined(TARGET_OS_SOLARIS)
191+/* @TODO: Replace this with Boost.DateTime */
192+static time_t timegm(struct tm *my_time)
193+{
194+ time_t local_secs, gm_secs;
195+ struct tm gm__rec, *gm_time;
196+
197+ // Interpret 't' as the local time and convert it to seconds since the Epoch
198+ local_secs = mktime(my_time);
199+ if (local_secs == -1)
200+ {
201+ my_time->tm_hour--;
202+ local_secs = mktime (my_time);
203+ if (local_secs == -1)
204+ return -1;
205+ local_secs += 3600;
206+ }
207+
208+ // Get the gmtime based on the local seconds since the Epoch
209+ gm_time = gmtime_r(&local_secs, &gm__rec);
210+ gm_time->tm_isdst = 0;
211+
212+ // Interpret gmtime as the local time and convert it to seconds since the Epoch
213+ gm_secs = mktime (gm_time);
214+ if (gm_secs == -1)
215+ {
216+ gm_time->tm_hour--;
217+ gm_secs = mktime (gm_time);
218+ if (gm_secs == -1)
219+ return -1;
220+ gm_secs += 3600;
221+ }
222+
223+ // Return the local time adjusted by the difference from GM time.
224+ return (local_secs - (gm_secs - local_secs));
225+}
226+#endif
227+
228 void Temporal::set_epoch_seconds()
229 {
230 /*
231
232=== removed directory 'gnulib'
233=== removed file 'gnulib/Makefile.am'
234--- gnulib/Makefile.am 2010-01-02 04:53:48 +0000
235+++ gnulib/Makefile.am 1970-01-01 00:00:00 +0000
236@@ -1,207 +0,0 @@
237-## DO NOT EDIT! GENERATED AUTOMATICALLY!
238-## Process this file with automake to produce Makefile.in.
239-# Copyright (C) 2002-2008 Free Software Foundation, Inc.
240-#
241-# This file is free software, distributed under the terms of the GNU
242-# General Public License. As a special exception to the GNU General
243-# Public License, this file may be distributed as part of a program
244-# that contains a configuration script generated by Autoconf, under
245-# the same distribution terms as the rest of that program.
246-#
247-# Generated by gnulib-tool.
248-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=config --lgpl --libtool --macro-prefix=gl getopt timegm
249-
250-AUTOMAKE_OPTIONS = 1.5 gnits
251-
252-SUBDIRS =
253-noinst_HEADERS =
254-noinst_LIBRARIES =
255-noinst_LTLIBRARIES =
256-EXTRA_DIST =
257-BUILT_SOURCES =
258-SUFFIXES =
259-MOSTLYCLEANFILES = core *.stackdump
260-MOSTLYCLEANDIRS =
261-CLEANFILES =
262-DISTCLEANFILES =
263-MAINTAINERCLEANFILES =
264-
265-noinst_LTLIBRARIES += libgnu.la
266-
267-libgnu_la_SOURCES =
268-libgnu_la_LIBADD = $(gl_LTLIBOBJS)
269-libgnu_la_DEPENDENCIES = $(gl_LTLIBOBJS)
270-EXTRA_libgnu_la_SOURCES =
271-libgnu_la_LDFLAGS = $(AM_LDFLAGS)
272-libgnu_la_CFLAGS = $(AM_CFLAGS) $(NO_WERROR)
273-
274-## begin gnulib module getopt
275-
276-BUILT_SOURCES += $(GETOPT_H)
277-
278-# We need the following in order to create <getopt.h> when the system
279-# doesn't have one that works with the given compiler.
280-getopt.h: getopt.in.h
281- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
282- cat $(srcdir)/getopt.in.h; \
283- } > $@-t
284- mv -f $@-t $@
285-MOSTLYCLEANFILES += getopt.h getopt.h-t
286-
287-EXTRA_DIST += getopt.c getopt.in.h getopt1.c getopt_int.h
288-
289-EXTRA_libgnu_la_SOURCES += getopt.c getopt1.c
290-
291-## end gnulib module getopt
292-
293-## begin gnulib module gettext-h
294-
295-libgnu_la_SOURCES += gettext.h
296-
297-## end gnulib module gettext-h
298-
299-## begin gnulib module link-warning
300-
301-LINK_WARNING_H=$(top_srcdir)/config/link-warning.h
302-
303-EXTRA_DIST += $(top_srcdir)/config/link-warning.h
304-
305-## end gnulib module link-warning
306-
307-## begin gnulib module mktime
308-
309-
310-EXTRA_DIST += mktime.c
311-
312-EXTRA_libgnu_la_SOURCES += mktime.c
313-
314-## end gnulib module mktime
315-
316-## begin gnulib module time
317-
318-BUILT_SOURCES += time.h
319-
320-# We need the following in order to create <time.h> when the system
321-# doesn't have one that works with the given compiler.
322-time.h: time.in.h
323- rm -f $@-t $@
324- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
325- sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
326- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
327- -e 's|@NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \
328- -e 's|@REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \
329- -e 's|@REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \
330- -e 's|@REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \
331- -e 's|@REPLACE_STRPTIME''@|$(REPLACE_STRPTIME)|g' \
332- -e 's|@REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \
333- -e 's|@SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
334- -e 's|@TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
335- < $(srcdir)/time.in.h; \
336- } > $@-t
337- mv $@-t $@
338-MOSTLYCLEANFILES += time.h time.h-t
339-
340-EXTRA_DIST += time.in.h
341-
342-## end gnulib module time
343-
344-## begin gnulib module time_r
345-
346-
347-EXTRA_DIST += time_r.c
348-
349-EXTRA_libgnu_la_SOURCES += time_r.c
350-
351-## end gnulib module time_r
352-
353-## begin gnulib module timegm
354-
355-
356-EXTRA_DIST += timegm.c
357-
358-EXTRA_libgnu_la_SOURCES += timegm.c
359-
360-## end gnulib module timegm
361-
362-## begin gnulib module unistd
363-
364-BUILT_SOURCES += unistd.h
365-
366-# We need the following in order to create an empty placeholder for
367-# <unistd.h> when the system doesn't have one.
368-unistd.h: unistd.in.h
369- rm -f $@-t $@
370- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
371- sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
372- -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
373- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
374- -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
375- -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \
376- -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \
377- -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \
378- -e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \
379- -e 's|@''GNULIB_EUIDACCESS''@|$(GNULIB_EUIDACCESS)|g' \
380- -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \
381- -e 's|@''GNULIB_FSYNC''@|$(GNULIB_FSYNC)|g' \
382- -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \
383- -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \
384- -e 's|@''GNULIB_GETDOMAINNAME''@|$(GNULIB_GETDOMAINNAME)|g' \
385- -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|g' \
386- -e 's|@''GNULIB_GETHOSTNAME''@|$(GNULIB_GETHOSTNAME)|g' \
387- -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \
388- -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \
389- -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \
390- -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \
391- -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \
392- -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \
393- -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \
394- -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \
395- -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \
396- -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
397- -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \
398- -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \
399- -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
400- -e 's|@''HAVE_GETDOMAINNAME''@|$(HAVE_GETDOMAINNAME)|g' \
401- -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \
402- -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \
403- -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \
404- -e 's|@''HAVE_GETUSERSHELL''@|$(HAVE_GETUSERSHELL)|g' \
405- -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
406- -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
407- -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \
408- -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
409- -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
410- -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
411- -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
412- -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \
413- -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
414- -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
415- -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
416- -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
417- -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
418- -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \
419- -e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \
420- -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
421- < $(srcdir)/unistd.in.h; \
422- } > $@-t
423- mv $@-t $@
424-MOSTLYCLEANFILES += unistd.h unistd.h-t
425-
426-EXTRA_DIST += unistd.in.h
427-
428-## end gnulib module unistd
429-
430-## begin gnulib module dummy
431-
432-libgnu_la_SOURCES += dummy.c
433-
434-## end gnulib module dummy
435-
436-
437-mostlyclean-local: mostlyclean-generic
438- @for dir in '' $(MOSTLYCLEANDIRS); do \
439- if test -n "$$dir" && test -d $$dir; then \
440- echo "rmdir $$dir"; rmdir $$dir; \
441- fi; \
442- done; \
443- :
444
445=== removed file 'gnulib/dummy.c'
446--- gnulib/dummy.c 2009-01-29 19:04:39 +0000
447+++ gnulib/dummy.c 1970-01-01 00:00:00 +0000
448@@ -1,42 +0,0 @@
449-/* A dummy file, to prevent empty libraries from breaking builds.
450- Copyright (C) 2004, 2007 Free Software Foundation, Inc.
451-
452- This program is free software: you can redistribute it and/or modify
453- it under the terms of the GNU Lesser General Public License as published by
454- the Free Software Foundation; either version 3 of the License, or
455- (at your option) any later version.
456-
457- This program is distributed in the hope that it will be useful,
458- but WITHOUT ANY WARRANTY; without even the implied warranty of
459- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
460- GNU Lesser General Public License for more details.
461-
462- You should have received a copy of the GNU Lesser General Public License
463- along with this program. If not, see <http://www.gnu.org/licenses/>. */
464-
465-/* Some systems, reportedly OpenBSD and Mac OS X, refuse to create
466- libraries without any object files. You might get an error like:
467-
468- > ar cru .libs/libgl.a
469- > ar: no archive members specified
470-
471- Compiling this file, and adding its object file to the library, will
472- prevent the library from being empty. */
473-
474-/* Some systems, such as Solaris with cc 5.0, refuse to work with libraries
475- that don't export any symbol. You might get an error like:
476-
477- > cc ... libgnu.a
478- > ild: (bad file) garbled symbol table in archive ../gllib/libgnu.a
479-
480- Compiling this file, and adding its object file to the library, will
481- prevent the library from exporting no symbols. */
482-
483-#ifdef __sun
484-/* This declaration ensures that the library will export at least 1 symbol. */
485-int gl_dummy_symbol;
486-#else
487-/* This declaration is solely to ensure that after preprocessing
488- this file is never empty. */
489-typedef int dummy;
490-#endif
491
492=== removed file 'gnulib/getopt.c'
493--- gnulib/getopt.c 2009-07-26 21:24:10 +0000
494+++ gnulib/getopt.c 1970-01-01 00:00:00 +0000
495@@ -1,1189 +0,0 @@
496-/* Getopt for GNU.
497- NOTE: getopt is now part of the C library, so if you don't know what
498- "Keep this file name-space clean" means, talk to drepper@gnu.org
499- before changing it!
500- Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004,2006,2008
501- Free Software Foundation, Inc.
502- This file is part of the GNU C Library.
503-
504- This program is free software: you can redistribute it and/or modify
505- it under the terms of the GNU Lesser General Public License as published by
506- the Free Software Foundation; either version 3 of the License, or
507- (at your option) any later version.
508-
509- This program is distributed in the hope that it will be useful,
510- but WITHOUT ANY WARRANTY; without even the implied warranty of
511- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
512- GNU Lesser General Public License for more details.
513-
514- You should have received a copy of the GNU Lesser General Public License
515- along with this program. If not, see <http://www.gnu.org/licenses/>. */
516-
517
518-#ifndef _LIBC
519-# include <config.h>
520-#endif
521-
522-#include "getopt.h"
523-
524-#include <stdio.h>
525-#include <stdlib.h>
526-#include <string.h>
527-#include <unistd.h>
528-
529-#ifdef _LIBC
530-# include <libintl.h>
531-#else
532-# include "gettext.h"
533-# define _(msgid) gettext (msgid)
534-#endif
535-
536-#if defined _LIBC && defined USE_IN_LIBIO
537-# include <wchar.h>
538-#endif
539-
540-#ifndef attribute_hidden
541-# define attribute_hidden
542-#endif
543-
544-/* Unlike standard Unix `getopt', functions like `getopt_long'
545- let the user intersperse the options with the other arguments.
546-
547- As `getopt_long' works, it permutes the elements of ARGV so that,
548- when it is done, all the options precede everything else. Thus
549- all application programs are extended to handle flexible argument order.
550-
551- Using `getopt' or setting the environment variable POSIXLY_CORRECT
552- disables permutation.
553- Then the application's behavior is completely standard.
554-
555- GNU application programs can use a third alternative mode in which
556- they can distinguish the relative order of options and other arguments. */
557-
558-#include "getopt_int.h"
559-
560-/* For communication from `getopt' to the caller.
561- When `getopt' finds an option that takes an argument,
562- the argument value is returned here.
563- Also, when `ordering' is RETURN_IN_ORDER,
564- each non-option ARGV-element is returned here. */
565-
566-char *optarg;
567-
568-/* Index in ARGV of the next element to be scanned.
569- This is used for communication to and from the caller
570- and for communication between successive calls to `getopt'.
571-
572- On entry to `getopt', zero means this is the first call; initialize.
573-
574- When `getopt' returns -1, this is the index of the first of the
575- non-option elements that the caller should itself scan.
576-
577- Otherwise, `optind' communicates from one call to the next
578- how much of ARGV has been scanned so far. */
579-
580-/* 1003.2 says this must be 1 before any call. */
581-int optind = 1;
582-
583-/* Callers store zero here to inhibit the error message
584- for unrecognized options. */
585-
586-int opterr = 1;
587-
588-/* Set to an option character which was unrecognized.
589- This must be initialized on some systems to avoid linking in the
590- system's own getopt implementation. */
591-
592-int optopt = '?';
593-
594-/* Keep a global copy of all internal members of getopt_data. */
595-
596-static struct _getopt_data getopt_data;
597-
598-
599
600-#if defined HAVE_DECL_GETENV && !HAVE_DECL_GETENV
601-extern char *getenv ();
602-#endif
603-
604
605-#ifdef _LIBC
606-/* Stored original parameters.
607- XXX This is no good solution. We should rather copy the args so
608- that we can compare them later. But we must not use malloc(3). */
609-extern int __libc_argc;
610-extern char **__libc_argv;
611-
612-/* Bash 2.0 gives us an environment variable containing flags
613- indicating ARGV elements that should not be considered arguments. */
614-
615-# ifdef USE_NONOPTION_FLAGS
616-/* Defined in getopt_init.c */
617-extern char *__getopt_nonoption_flags;
618-# endif
619-
620-# ifdef USE_NONOPTION_FLAGS
621-# define SWAP_FLAGS(ch1, ch2) \
622- if (d->__nonoption_flags_len > 0) \
623- { \
624- char __tmp = __getopt_nonoption_flags[ch1]; \
625- __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \
626- __getopt_nonoption_flags[ch2] = __tmp; \
627- }
628-# else
629-# define SWAP_FLAGS(ch1, ch2)
630-# endif
631-#else /* !_LIBC */
632-# define SWAP_FLAGS(ch1, ch2)
633-#endif /* _LIBC */
634-
635-/* Exchange two adjacent subsequences of ARGV.
636- One subsequence is elements [first_nonopt,last_nonopt)
637- which contains all the non-options that have been skipped so far.
638- The other is elements [last_nonopt,optind), which contains all
639- the options processed since those non-options were skipped.
640-
641- `first_nonopt' and `last_nonopt' are relocated so that they describe
642- the new indices of the non-options in ARGV after they are moved. */
643-
644-static void
645-exchange (char **argv, struct _getopt_data *d)
646-{
647- int bottom = d->__first_nonopt;
648- int middle = d->__last_nonopt;
649- int top = d->optind;
650- char *tem;
651-
652- /* Exchange the shorter segment with the far end of the longer segment.
653- That puts the shorter segment into the right place.
654- It leaves the longer segment in the right place overall,
655- but it consists of two parts that need to be swapped next. */
656-
657-#if defined _LIBC && defined USE_NONOPTION_FLAGS
658- /* First make sure the handling of the `__getopt_nonoption_flags'
659- string can work normally. Our top argument must be in the range
660- of the string. */
661- if (d->__nonoption_flags_len > 0 && top >= d->__nonoption_flags_max_len)
662- {
663- /* We must extend the array. The user plays games with us and
664- presents new arguments. */
665- char *new_str = malloc (top + 1);
666- if (new_str == NULL)
667- d->__nonoption_flags_len = d->__nonoption_flags_max_len = 0;
668- else
669- {
670- memset (__mempcpy (new_str, __getopt_nonoption_flags,
671- d->__nonoption_flags_max_len),
672- '\0', top + 1 - d->__nonoption_flags_max_len);
673- d->__nonoption_flags_max_len = top + 1;
674- __getopt_nonoption_flags = new_str;
675- }
676- }
677-#endif
678-
679- while (top > middle && middle > bottom)
680- {
681- if (top - middle > middle - bottom)
682- {
683- /* Bottom segment is the short one. */
684- int len = middle - bottom;
685- register int i;
686-
687- /* Swap it with the top part of the top segment. */
688- for (i = 0; i < len; i++)
689- {
690- tem = argv[bottom + i];
691- argv[bottom + i] = argv[top - (middle - bottom) + i];
692- argv[top - (middle - bottom) + i] = tem;
693- SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
694- }
695- /* Exclude the moved bottom segment from further swapping. */
696- top -= len;
697- }
698- else
699- {
700- /* Top segment is the short one. */
701- int len = top - middle;
702- register int i;
703-
704- /* Swap it with the bottom part of the bottom segment. */
705- for (i = 0; i < len; i++)
706- {
707- tem = argv[bottom + i];
708- argv[bottom + i] = argv[middle + i];
709- argv[middle + i] = tem;
710- SWAP_FLAGS (bottom + i, middle + i);
711- }
712- /* Exclude the moved top segment from further swapping. */
713- bottom += len;
714- }
715- }
716-
717- /* Update records for the slots the non-options now occupy. */
718-
719- d->__first_nonopt += (d->optind - d->__last_nonopt);
720- d->__last_nonopt = d->optind;
721-}
722-
723-/* Initialize the internal data when the first call is made. */
724-
725-static const char *
726-_getopt_initialize (int argc, char **argv, const char *optstring,
727- int posixly_correct, struct _getopt_data *d)
728-{
729- /* Start processing options with ARGV-element 1 (since ARGV-element 0
730- is the program name); the sequence of previously skipped
731- non-option ARGV-elements is empty. */
732-
733- d->__first_nonopt = d->__last_nonopt = d->optind;
734-
735- d->__nextchar = NULL;
736-
737- d->__posixly_correct = posixly_correct || !!getenv ("POSIXLY_CORRECT");
738-
739- /* Determine how to handle the ordering of options and nonoptions. */
740-
741- if (optstring[0] == '-')
742- {
743- d->__ordering = RETURN_IN_ORDER;
744- ++optstring;
745- }
746- else if (optstring[0] == '+')
747- {
748- d->__ordering = REQUIRE_ORDER;
749- ++optstring;
750- }
751- else if (d->__posixly_correct)
752- d->__ordering = REQUIRE_ORDER;
753- else
754- d->__ordering = PERMUTE;
755-
756-#if defined _LIBC && defined USE_NONOPTION_FLAGS
757- if (!d->__posixly_correct
758- && argc == __libc_argc && argv == __libc_argv)
759- {
760- if (d->__nonoption_flags_max_len == 0)
761- {
762- if (__getopt_nonoption_flags == NULL
763- || __getopt_nonoption_flags[0] == '\0')
764- d->__nonoption_flags_max_len = -1;
765- else
766- {
767- const char *orig_str = __getopt_nonoption_flags;
768- int len = d->__nonoption_flags_max_len = strlen (orig_str);
769- if (d->__nonoption_flags_max_len < argc)
770- d->__nonoption_flags_max_len = argc;
771- __getopt_nonoption_flags =
772- (char *) malloc (d->__nonoption_flags_max_len);
773- if (__getopt_nonoption_flags == NULL)
774- d->__nonoption_flags_max_len = -1;
775- else
776- memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
777- '\0', d->__nonoption_flags_max_len - len);
778- }
779- }
780- d->__nonoption_flags_len = d->__nonoption_flags_max_len;
781- }
782- else
783- d->__nonoption_flags_len = 0;
784-#else
785- (void)argc;
786- (void)argv;
787-#endif
788-
789- return optstring;
790-}
791-
792
793-/* Scan elements of ARGV (whose length is ARGC) for option characters
794- given in OPTSTRING.
795-
796- If an element of ARGV starts with '-', and is not exactly "-" or "--",
797- then it is an option element. The characters of this element
798- (aside from the initial '-') are option characters. If `getopt'
799- is called repeatedly, it returns successively each of the option characters
800- from each of the option elements.
801-
802- If `getopt' finds another option character, it returns that character,
803- updating `optind' and `nextchar' so that the next call to `getopt' can
804- resume the scan with the following option character or ARGV-element.
805-
806- If there are no more option characters, `getopt' returns -1.
807- Then `optind' is the index in ARGV of the first ARGV-element
808- that is not an option. (The ARGV-elements have been permuted
809- so that those that are not options now come last.)
810-
811- OPTSTRING is a string containing the legitimate option characters.
812- If an option character is seen that is not listed in OPTSTRING,
813- return '?' after printing an error message. If you set `opterr' to
814- zero, the error message is suppressed but we still return '?'.
815-
816- If a char in OPTSTRING is followed by a colon, that means it wants an arg,
817- so the following text in the same ARGV-element, or the text of the following
818- ARGV-element, is returned in `optarg'. Two colons mean an option that
819- wants an optional arg; if there is text in the current ARGV-element,
820- it is returned in `optarg', otherwise `optarg' is set to zero.
821-
822- If OPTSTRING starts with `-' or `+', it requests different methods of
823- handling the non-option ARGV-elements.
824- See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
825-
826- Long-named options begin with `--' instead of `-'.
827- Their names may be abbreviated as long as the abbreviation is unique
828- or is an exact match for some defined option. If they have an
829- argument, it follows the option name in the same ARGV-element, separated
830- from the option name by a `=', or else the in next ARGV-element.
831- When `getopt' finds a long-named option, it returns 0 if that option's
832- `flag' field is nonzero, the value of the option's `val' field
833- if the `flag' field is zero.
834-
835- LONGOPTS is a vector of `struct option' terminated by an
836- element containing a name which is zero.
837-
838- LONGIND returns the index in LONGOPT of the long-named option found.
839- It is only valid when a long-named option has been found by the most
840- recent call.
841-
842- If LONG_ONLY is nonzero, '-' as well as '--' can introduce
843- long-named options.
844-
845- If POSIXLY_CORRECT is nonzero, behave as if the POSIXLY_CORRECT
846- environment variable were set. */
847-
848-int
849-_getopt_internal_r (int argc, char **argv, const char *optstring,
850- const struct option *longopts, int *longind,
851- int long_only, int posixly_correct, struct _getopt_data *d)
852-{
853- int print_errors = d->opterr;
854- if (optstring[0] == ':')
855- print_errors = 0;
856-
857- if (argc < 1)
858- return -1;
859-
860- d->optarg = NULL;
861-
862- if (d->optind == 0 || !d->__initialized)
863- {
864- if (d->optind == 0)
865- d->optind = 1; /* Don't scan ARGV[0], the program name. */
866- optstring = _getopt_initialize (argc, argv, optstring,
867- posixly_correct, d);
868- d->__initialized = 1;
869- }
870-
871- /* Test whether ARGV[optind] points to a non-option argument.
872- Either it does not have option syntax, or there is an environment flag
873- from the shell indicating it is not an option. The later information
874- is only used when the used in the GNU libc. */
875-#if defined _LIBC && defined USE_NONOPTION_FLAGS
876-# define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0' \
877- || (d->optind < d->__nonoption_flags_len \
878- && __getopt_nonoption_flags[d->optind] == '1'))
879-#else
880-# define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0')
881-#endif
882-
883- if (d->__nextchar == NULL || *d->__nextchar == '\0')
884- {
885- /* Advance to the next ARGV-element. */
886-
887- /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
888- moved back by the user (who may also have changed the arguments). */
889- if (d->__last_nonopt > d->optind)
890- d->__last_nonopt = d->optind;
891- if (d->__first_nonopt > d->optind)
892- d->__first_nonopt = d->optind;
893-
894- if (d->__ordering == PERMUTE)
895- {
896- /* If we have just processed some options following some non-options,
897- exchange them so that the options come first. */
898-
899- if (d->__first_nonopt != d->__last_nonopt
900- && d->__last_nonopt != d->optind)
901- exchange ((char **) argv, d);
902- else if (d->__last_nonopt != d->optind)
903- d->__first_nonopt = d->optind;
904-
905- /* Skip any additional non-options
906- and extend the range of non-options previously skipped. */
907-
908- while (d->optind < argc && NONOPTION_P)
909- d->optind++;
910- d->__last_nonopt = d->optind;
911- }
912-
913- /* The special ARGV-element `--' means premature end of options.
914- Skip it like a null option,
915- then exchange with previous non-options as if it were an option,
916- then skip everything else like a non-option. */
917-
918- if (d->optind != argc && !strcmp (argv[d->optind], "--"))
919- {
920- d->optind++;
921-
922- if (d->__first_nonopt != d->__last_nonopt
923- && d->__last_nonopt != d->optind)
924- exchange ((char **) argv, d);
925- else if (d->__first_nonopt == d->__last_nonopt)
926- d->__first_nonopt = d->optind;
927- d->__last_nonopt = argc;
928-
929- d->optind = argc;
930- }
931-
932- /* If we have done all the ARGV-elements, stop the scan
933- and back over any non-options that we skipped and permuted. */
934-
935- if (d->optind == argc)
936- {
937- /* Set the next-arg-index to point at the non-options
938- that we previously skipped, so the caller will digest them. */
939- if (d->__first_nonopt != d->__last_nonopt)
940- d->optind = d->__first_nonopt;
941- return -1;
942- }
943-
944- /* If we have come to a non-option and did not permute it,
945- either stop the scan or describe it to the caller and pass it by. */
946-
947- if (NONOPTION_P)
948- {
949- if (d->__ordering == REQUIRE_ORDER)
950- return -1;
951- d->optarg = argv[d->optind++];
952- return 1;
953- }
954-
955- /* We have found another option-ARGV-element.
956- Skip the initial punctuation. */
957-
958- d->__nextchar = (argv[d->optind] + 1
959- + (longopts != NULL && argv[d->optind][1] == '-'));
960- }
961-
962- /* Decode the current option-ARGV-element. */
963-
964- /* Check whether the ARGV-element is a long option.
965-
966- If long_only and the ARGV-element has the form "-f", where f is
967- a valid short option, don't consider it an abbreviated form of
968- a long option that starts with f. Otherwise there would be no
969- way to give the -f short option.
970-
971- On the other hand, if there's a long option "fubar" and
972- the ARGV-element is "-fu", do consider that an abbreviation of
973- the long option, just like "--fu", and not "-f" with arg "u".
974-
975- This distinction seems to be the most useful approach. */
976-
977- if (longopts != NULL
978- && (argv[d->optind][1] == '-'
979- || (long_only && (argv[d->optind][2]
980- || !strchr (optstring, argv[d->optind][1])))))
981- {
982- char *nameend;
983- const struct option *p;
984- const struct option *pfound = NULL;
985- int exact = 0;
986- int ambig = 0;
987- int indfound = -1;
988- int option_index;
989-
990- for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++)
991- /* Do nothing. */ ;
992-
993- /* Test all long options for either exact match
994- or abbreviated matches. */
995- for (p = longopts, option_index = 0; p->name; p++, option_index++)
996- if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar))
997- {
998- if ((unsigned int) (nameend - d->__nextchar)
999- == (unsigned int) strlen (p->name))
1000- {
1001- /* Exact match found. */
1002- pfound = p;
1003- indfound = option_index;
1004- exact = 1;
1005- break;
1006- }
1007- else if (pfound == NULL)
1008- {
1009- /* First nonexact match found. */
1010- pfound = p;
1011- indfound = option_index;
1012- }
1013- else if (long_only
1014- || pfound->has_arg != p->has_arg
1015- || pfound->flag != p->flag
1016- || pfound->val != p->val)
1017- /* Second or later nonexact match found. */
1018- ambig = 1;
1019- }
1020-
1021- if (ambig && !exact)
1022- {
1023- if (print_errors)
1024- {
1025-#if defined _LIBC && defined USE_IN_LIBIO
1026- char *buf;
1027-
1028- if (__asprintf (&buf, _("%s: option `%s' is ambiguous\n"),
1029- argv[0], argv[d->optind]) >= 0)
1030- {
1031- _IO_flockfile (stderr);
1032-
1033- int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
1034- ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
1035-
1036- __fxprintf (NULL, "%s", buf);
1037-
1038- ((_IO_FILE *) stderr)->_flags2 = old_flags2;
1039- _IO_funlockfile (stderr);
1040-
1041- free (buf);
1042- }
1043-#else
1044- fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
1045- argv[0], argv[d->optind]);
1046-#endif
1047- }
1048- d->__nextchar += strlen (d->__nextchar);
1049- d->optind++;
1050- d->optopt = 0;
1051- return '?';
1052- }
1053-
1054- if (pfound != NULL)
1055- {
1056- option_index = indfound;
1057- d->optind++;
1058- if (*nameend)
1059- {
1060- /* Don't test has_arg with >, because some C compilers don't
1061- allow it to be used on enums. */
1062- if (pfound->has_arg)
1063- d->optarg = nameend + 1;
1064- else
1065- {
1066- if (print_errors)
1067- {
1068-#if defined _LIBC && defined USE_IN_LIBIO
1069- char *buf;
1070- int n;
1071-#endif
1072-
1073- if (argv[d->optind - 1][1] == '-')
1074- {
1075- /* --option */
1076-#if defined _LIBC && defined USE_IN_LIBIO
1077- n = __asprintf (&buf, _("\
1078-%s: option `--%s' doesn't allow an argument\n"),
1079- argv[0], pfound->name);
1080-#else
1081- fprintf (stderr, _("\
1082-%s: option `--%s' doesn't allow an argument\n"),
1083- argv[0], pfound->name);
1084-#endif
1085- }
1086- else
1087- {
1088- /* +option or -option */
1089-#if defined _LIBC && defined USE_IN_LIBIO
1090- n = __asprintf (&buf, _("\
1091-%s: option `%c%s' doesn't allow an argument\n"),
1092- argv[0], argv[d->optind - 1][0],
1093- pfound->name);
1094-#else
1095- fprintf (stderr, _("\
1096-%s: option `%c%s' doesn't allow an argument\n"),
1097- argv[0], argv[d->optind - 1][0],
1098- pfound->name);
1099-#endif
1100- }
1101-
1102-#if defined _LIBC && defined USE_IN_LIBIO
1103- if (n >= 0)
1104- {
1105- _IO_flockfile (stderr);
1106-
1107- int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
1108- ((_IO_FILE *) stderr)->_flags2
1109- |= _IO_FLAGS2_NOTCANCEL;
1110-
1111- __fxprintf (NULL, "%s", buf);
1112-
1113- ((_IO_FILE *) stderr)->_flags2 = old_flags2;
1114- _IO_funlockfile (stderr);
1115-
1116- free (buf);
1117- }
1118-#endif
1119- }
1120-
1121- d->__nextchar += strlen (d->__nextchar);
1122-
1123- d->optopt = pfound->val;
1124- return '?';
1125- }
1126- }
1127- else if (pfound->has_arg == 1)
1128- {
1129- if (d->optind < argc)
1130- d->optarg = argv[d->optind++];
1131- else
1132- {
1133- if (print_errors)
1134- {
1135-#if defined _LIBC && defined USE_IN_LIBIO
1136- char *buf;
1137-
1138- if (__asprintf (&buf, _("\
1139-%s: option `%s' requires an argument\n"),
1140- argv[0], argv[d->optind - 1]) >= 0)
1141- {
1142- _IO_flockfile (stderr);
1143-
1144- int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
1145- ((_IO_FILE *) stderr)->_flags2
1146- |= _IO_FLAGS2_NOTCANCEL;
1147-
1148- __fxprintf (NULL, "%s", buf);
1149-
1150- ((_IO_FILE *) stderr)->_flags2 = old_flags2;
1151- _IO_funlockfile (stderr);
1152-
1153- free (buf);
1154- }
1155-#else
1156- fprintf (stderr,
1157- _("%s: option `%s' requires an argument\n"),
1158- argv[0], argv[d->optind - 1]);
1159-#endif
1160- }
1161- d->__nextchar += strlen (d->__nextchar);
1162- d->optopt = pfound->val;
1163- return optstring[0] == ':' ? ':' : '?';
1164- }
1165- }
1166- d->__nextchar += strlen (d->__nextchar);
1167- if (longind != NULL)
1168- *longind = option_index;
1169- if (pfound->flag)
1170- {
1171- *(pfound->flag) = pfound->val;
1172- return 0;
1173- }
1174- return pfound->val;
1175- }
1176-
1177- /* Can't find it as a long option. If this is not getopt_long_only,
1178- or the option starts with '--' or is not a valid short
1179- option, then it's an error.
1180- Otherwise interpret it as a short option. */
1181- if (!long_only || argv[d->optind][1] == '-'
1182- || strchr (optstring, *d->__nextchar) == NULL)
1183- {
1184- if (print_errors)
1185- {
1186-#if defined _LIBC && defined USE_IN_LIBIO
1187- char *buf;
1188- int n;
1189-#endif
1190-
1191- if (argv[d->optind][1] == '-')
1192- {
1193- /* --option */
1194-#if defined _LIBC && defined USE_IN_LIBIO
1195- n = __asprintf (&buf, _("%s: unrecognized option `--%s'\n"),
1196- argv[0], d->__nextchar);
1197-#else
1198- fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
1199- argv[0], d->__nextchar);
1200-#endif
1201- }
1202- else
1203- {
1204- /* +option or -option */
1205-#if defined _LIBC && defined USE_IN_LIBIO
1206- n = __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"),
1207- argv[0], argv[d->optind][0], d->__nextchar);
1208-#else
1209- fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
1210- argv[0], argv[d->optind][0], d->__nextchar);
1211-#endif
1212- }
1213-
1214-#if defined _LIBC && defined USE_IN_LIBIO
1215- if (n >= 0)
1216- {
1217- _IO_flockfile (stderr);
1218-
1219- int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
1220- ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
1221-
1222- __fxprintf (NULL, "%s", buf);
1223-
1224- ((_IO_FILE *) stderr)->_flags2 = old_flags2;
1225- _IO_funlockfile (stderr);
1226-
1227- free (buf);
1228- }
1229-#endif
1230- }
1231- d->__nextchar = (char *) "";
1232- d->optind++;
1233- d->optopt = 0;
1234- return '?';
1235- }
1236- }
1237-
1238- /* Look at and handle the next short option-character. */
1239-
1240- {
1241- char c = *d->__nextchar++;
1242- char *temp = strchr (optstring, c);
1243-
1244- /* Increment `optind' when we start to process its last character. */
1245- if (*d->__nextchar == '\0')
1246- ++d->optind;
1247-
1248- if (temp == NULL || c == ':')
1249- {
1250- if (print_errors)
1251- {
1252-#if defined _LIBC && defined USE_IN_LIBIO
1253- char *buf;
1254- int n;
1255-#endif
1256-
1257- if (d->__posixly_correct)
1258- {
1259- /* 1003.2 specifies the format of this message. */
1260-#if defined _LIBC && defined USE_IN_LIBIO
1261- n = __asprintf (&buf, _("%s: illegal option -- %c\n"),
1262- argv[0], c);
1263-#else
1264- fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c);
1265-#endif
1266- }
1267- else
1268- {
1269-#if defined _LIBC && defined USE_IN_LIBIO
1270- n = __asprintf (&buf, _("%s: invalid option -- %c\n"),
1271- argv[0], c);
1272-#else
1273- fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c);
1274-#endif
1275- }
1276-
1277-#if defined _LIBC && defined USE_IN_LIBIO
1278- if (n >= 0)
1279- {
1280- _IO_flockfile (stderr);
1281-
1282- int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
1283- ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
1284-
1285- __fxprintf (NULL, "%s", buf);
1286-
1287- ((_IO_FILE *) stderr)->_flags2 = old_flags2;
1288- _IO_funlockfile (stderr);
1289-
1290- free (buf);
1291- }
1292-#endif
1293- }
1294- d->optopt = c;
1295- return '?';
1296- }
1297- /* Convenience. Treat POSIX -W foo same as long option --foo */
1298- if (temp[0] == 'W' && temp[1] == ';')
1299- {
1300- char *nameend;
1301- const struct option *p;
1302- const struct option *pfound = NULL;
1303- int exact = 0;
1304- int ambig = 0;
1305- int indfound = 0;
1306- int option_index;
1307-
1308- /* This is an option that requires an argument. */
1309- if (*d->__nextchar != '\0')
1310- {
1311- d->optarg = d->__nextchar;
1312- /* If we end this ARGV-element by taking the rest as an arg,
1313- we must advance to the next element now. */
1314- d->optind++;
1315- }
1316- else if (d->optind == argc)
1317- {
1318- if (print_errors)
1319- {
1320- /* 1003.2 specifies the format of this message. */
1321-#if defined _LIBC && defined USE_IN_LIBIO
1322- char *buf;
1323-
1324- if (__asprintf (&buf,
1325- _("%s: option requires an argument -- %c\n"),
1326- argv[0], c) >= 0)
1327- {
1328- _IO_flockfile (stderr);
1329-
1330- int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
1331- ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
1332-
1333- __fxprintf (NULL, "%s", buf);
1334-
1335- ((_IO_FILE *) stderr)->_flags2 = old_flags2;
1336- _IO_funlockfile (stderr);
1337-
1338- free (buf);
1339- }
1340-#else
1341- fprintf (stderr, _("%s: option requires an argument -- %c\n"),
1342- argv[0], c);
1343-#endif
1344- }
1345- d->optopt = c;
1346- if (optstring[0] == ':')
1347- c = ':';
1348- else
1349- c = '?';
1350- return c;
1351- }
1352- else
1353- /* We already incremented `d->optind' once;
1354- increment it again when taking next ARGV-elt as argument. */
1355- d->optarg = argv[d->optind++];
1356-
1357- /* optarg is now the argument, see if it's in the
1358- table of longopts. */
1359-
1360- for (d->__nextchar = nameend = d->optarg; *nameend && *nameend != '=';
1361- nameend++)
1362- /* Do nothing. */ ;
1363-
1364- /* Test all long options for either exact match
1365- or abbreviated matches. */
1366- for (p = longopts, option_index = 0; p->name; p++, option_index++)
1367- if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar))
1368- {
1369- if ((unsigned int) (nameend - d->__nextchar) == strlen (p->name))
1370- {
1371- /* Exact match found. */
1372- pfound = p;
1373- indfound = option_index;
1374- exact = 1;
1375- break;
1376- }
1377- else if (pfound == NULL)
1378- {
1379- /* First nonexact match found. */
1380- pfound = p;
1381- indfound = option_index;
1382- }
1383- else
1384- /* Second or later nonexact match found. */
1385- ambig = 1;
1386- }
1387- if (ambig && !exact)
1388- {
1389- if (print_errors)
1390- {
1391-#if defined _LIBC && defined USE_IN_LIBIO
1392- char *buf;
1393-
1394- if (__asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"),
1395- argv[0], argv[d->optind]) >= 0)
1396- {
1397- _IO_flockfile (stderr);
1398-
1399- int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
1400- ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
1401-
1402- __fxprintf (NULL, "%s", buf);
1403-
1404- ((_IO_FILE *) stderr)->_flags2 = old_flags2;
1405- _IO_funlockfile (stderr);
1406-
1407- free (buf);
1408- }
1409-#else
1410- fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
1411- argv[0], argv[d->optind]);
1412-#endif
1413- }
1414- d->__nextchar += strlen (d->__nextchar);
1415- d->optind++;
1416- return '?';
1417- }
1418- if (pfound != NULL)
1419- {
1420- option_index = indfound;
1421- if (*nameend)
1422- {
1423- /* Don't test has_arg with >, because some C compilers don't
1424- allow it to be used on enums. */
1425- if (pfound->has_arg)
1426- d->optarg = nameend + 1;
1427- else
1428- {
1429- if (print_errors)
1430- {
1431-#if defined _LIBC && defined USE_IN_LIBIO
1432- char *buf;
1433-
1434- if (__asprintf (&buf, _("\
1435-%s: option `-W %s' doesn't allow an argument\n"),
1436- argv[0], pfound->name) >= 0)
1437- {
1438- _IO_flockfile (stderr);
1439-
1440- int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
1441- ((_IO_FILE *) stderr)->_flags2
1442- |= _IO_FLAGS2_NOTCANCEL;
1443-
1444- __fxprintf (NULL, "%s", buf);
1445-
1446- ((_IO_FILE *) stderr)->_flags2 = old_flags2;
1447- _IO_funlockfile (stderr);
1448-
1449- free (buf);
1450- }
1451-#else
1452- fprintf (stderr, _("\
1453-%s: option `-W %s' doesn't allow an argument\n"),
1454- argv[0], pfound->name);
1455-#endif
1456- }
1457-
1458- d->__nextchar += strlen (d->__nextchar);
1459- return '?';
1460- }
1461- }
1462- else if (pfound->has_arg == 1)
1463- {
1464- if (d->optind < argc)
1465- d->optarg = argv[d->optind++];
1466- else
1467- {
1468- if (print_errors)
1469- {
1470-#if defined _LIBC && defined USE_IN_LIBIO
1471- char *buf;
1472-
1473- if (__asprintf (&buf, _("\
1474-%s: option `%s' requires an argument\n"),
1475- argv[0], argv[d->optind - 1]) >= 0)
1476- {
1477- _IO_flockfile (stderr);
1478-
1479- int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
1480- ((_IO_FILE *) stderr)->_flags2
1481- |= _IO_FLAGS2_NOTCANCEL;
1482-
1483- __fxprintf (NULL, "%s", buf);
1484-
1485- ((_IO_FILE *) stderr)->_flags2 = old_flags2;
1486- _IO_funlockfile (stderr);
1487-
1488- free (buf);
1489- }
1490-#else
1491- fprintf (stderr,
1492- _("%s: option `%s' requires an argument\n"),
1493- argv[0], argv[d->optind - 1]);
1494-#endif
1495- }
1496- d->__nextchar += strlen (d->__nextchar);
1497- return optstring[0] == ':' ? ':' : '?';
1498- }
1499- }
1500- d->__nextchar += strlen (d->__nextchar);
1501- if (longind != NULL)
1502- *longind = option_index;
1503- if (pfound->flag)
1504- {
1505- *(pfound->flag) = pfound->val;
1506- return 0;
1507- }
1508- return pfound->val;
1509- }
1510- d->__nextchar = NULL;
1511- return 'W'; /* Let the application handle it. */
1512- }
1513- if (temp[1] == ':')
1514- {
1515- if (temp[2] == ':')
1516- {
1517- /* This is an option that accepts an argument optionally. */
1518- if (*d->__nextchar != '\0')
1519- {
1520- d->optarg = d->__nextchar;
1521- d->optind++;
1522- }
1523- else
1524- d->optarg = NULL;
1525- d->__nextchar = NULL;
1526- }
1527- else
1528- {
1529- /* This is an option that requires an argument. */
1530- if (*d->__nextchar != '\0')
1531- {
1532- d->optarg = d->__nextchar;
1533- /* If we end this ARGV-element by taking the rest as an arg,
1534- we must advance to the next element now. */
1535- d->optind++;
1536- }
1537- else if (d->optind == argc)
1538- {
1539- if (print_errors)
1540- {
1541- /* 1003.2 specifies the format of this message. */
1542-#if defined _LIBC && defined USE_IN_LIBIO
1543- char *buf;
1544-
1545- if (__asprintf (&buf, _("\
1546-%s: option requires an argument -- %c\n"),
1547- argv[0], c) >= 0)
1548- {
1549- _IO_flockfile (stderr);
1550-
1551- int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
1552- ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
1553-
1554- __fxprintf (NULL, "%s", buf);
1555-
1556- ((_IO_FILE *) stderr)->_flags2 = old_flags2;
1557- _IO_funlockfile (stderr);
1558-
1559- free (buf);
1560- }
1561-#else
1562- fprintf (stderr,
1563- _("%s: option requires an argument -- %c\n"),
1564- argv[0], c);
1565-#endif
1566- }
1567- d->optopt = c;
1568- if (optstring[0] == ':')
1569- c = ':';
1570- else
1571- c = '?';
1572- }
1573- else
1574- /* We already incremented `optind' once;
1575- increment it again when taking next ARGV-elt as argument. */
1576- d->optarg = argv[d->optind++];
1577- d->__nextchar = NULL;
1578- }
1579- }
1580- return c;
1581- }
1582-}
1583-
1584-int
1585-_getopt_internal (int argc, char **argv, const char *optstring,
1586- const struct option *longopts, int *longind,
1587- int long_only, int posixly_correct)
1588-{
1589- int result;
1590-
1591- getopt_data.optind = optind;
1592- getopt_data.opterr = opterr;
1593-
1594- result = _getopt_internal_r (argc, argv, optstring, longopts, longind,
1595- long_only, posixly_correct, &getopt_data);
1596-
1597- optind = getopt_data.optind;
1598- optarg = getopt_data.optarg;
1599- optopt = getopt_data.optopt;
1600-
1601- return result;
1602-}
1603-
1604-/* glibc gets a LSB-compliant getopt.
1605- Standalone applications get a POSIX-compliant getopt. */
1606-#if defined(_LIBC)
1607-enum { POSIXLY_CORRECT = 0 };
1608-#else
1609-enum { POSIXLY_CORRECT = 1 };
1610-#endif
1611-
1612-int
1613-getopt (int argc, char *const *argv, const char *optstring)
1614-{
1615- return _getopt_internal (argc, (char **) argv, optstring, NULL, NULL, 0,
1616- POSIXLY_CORRECT);
1617-}
1618-
1619-
1620
1621-#ifdef TEST
1622-
1623-/* Compile with -DTEST to make an executable for use in testing
1624- the above definition of `getopt'. */
1625-
1626-int
1627-main (int argc, char **argv)
1628-{
1629- int c;
1630- int digit_optind = 0;
1631-
1632- while (1)
1633- {
1634- int this_option_optind = optind ? optind : 1;
1635-
1636- c = getopt (argc, argv, "abc:d:0123456789");
1637- if (c == -1)
1638- break;
1639-
1640- switch (c)
1641- {
1642- case '0':
1643- case '1':
1644- case '2':
1645- case '3':
1646- case '4':
1647- case '5':
1648- case '6':
1649- case '7':
1650- case '8':
1651- case '9':
1652- if (digit_optind != 0 && digit_optind != this_option_optind)
1653- printf ("digits occur in two different argv-elements.\n");
1654- digit_optind = this_option_optind;
1655- printf ("option %c\n", c);
1656- break;
1657-
1658- case 'a':
1659- printf ("option a\n");
1660- break;
1661-
1662- case 'b':
1663- printf ("option b\n");
1664- break;
1665-
1666- case 'c':
1667- printf ("option c with value `%s'\n", optarg);
1668- break;
1669-
1670- case '?':
1671- break;
1672-
1673- default:
1674- printf ("?? getopt returned character code 0%o ??\n", c);
1675- }
1676- }
1677-
1678- if (optind < argc)
1679- {
1680- printf ("non-option ARGV-elements: ");
1681- while (optind < argc)
1682- printf ("%s ", argv[optind++]);
1683- printf ("\n");
1684- }
1685-
1686- exit (0);
1687-}
1688-
1689-#endif /* TEST */
1690
1691=== removed file 'gnulib/getopt.in.h'
1692--- gnulib/getopt.in.h 2009-01-29 19:22:08 +0000
1693+++ gnulib/getopt.in.h 1970-01-01 00:00:00 +0000
1694@@ -1,225 +0,0 @@
1695-/* Declarations for getopt.
1696- Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2005,2006,2007
1697- Free Software Foundation, Inc.
1698- This file is part of the GNU C Library.
1699-
1700- This program is free software: you can redistribute it and/or modify
1701- it under the terms of the GNU Lesser General Public License as published by
1702- the Free Software Foundation; either version 3 of the License, or
1703- (at your option) any later version.
1704-
1705- This program is distributed in the hope that it will be useful,
1706- but WITHOUT ANY WARRANTY; without even the implied warranty of
1707- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1708- GNU Lesser General Public License for more details.
1709-
1710- You should have received a copy of the GNU Lesser General Public License
1711- along with this program. If not, see <http://www.gnu.org/licenses/>. */
1712-
1713-#ifndef _GETOPT_H
1714-
1715-#ifndef __need_getopt
1716-# define _GETOPT_H 1
1717-#endif
1718-
1719-/* Standalone applications should #define __GETOPT_PREFIX to an
1720- identifier that prefixes the external functions and variables
1721- defined in this header. When this happens, include the
1722- headers that might declare getopt so that they will not cause
1723- confusion if included after this file. Then systematically rename
1724- identifiers so that they do not collide with the system functions
1725- and variables. Renaming avoids problems with some compilers and
1726- linkers. */
1727-#if defined __GETOPT_PREFIX && !defined __need_getopt
1728-# include <stdlib.h>
1729-# include <stdio.h>
1730-# include <unistd.h>
1731-# undef __need_getopt
1732-# undef getopt
1733-# undef getopt_long
1734-# undef getopt_long_only
1735-# undef optarg
1736-# undef opterr
1737-# undef optind
1738-# undef optopt
1739-# define __GETOPT_CONCAT(x, y) x ## y
1740-# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
1741-# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
1742-# define getopt __GETOPT_ID (getopt)
1743-# define getopt_long __GETOPT_ID (getopt_long)
1744-# define getopt_long_only __GETOPT_ID (getopt_long_only)
1745-# define optarg __GETOPT_ID (optarg)
1746-# define opterr __GETOPT_ID (opterr)
1747-# define optind __GETOPT_ID (optind)
1748-# define optopt __GETOPT_ID (optopt)
1749-#endif
1750-
1751-/* Standalone applications get correct prototypes for getopt_long and
1752- getopt_long_only; they declare "char **argv". libc uses prototypes
1753- with "char *const *argv" that are incorrect because getopt_long and
1754- getopt_long_only can permute argv; this is required for backward
1755- compatibility (e.g., for LSB 2.0.1).
1756-
1757- This used to be `#if defined __GETOPT_PREFIX && !defined __need_getopt',
1758- but it caused redefinition warnings if both unistd.h and getopt.h were
1759- included, since unistd.h includes getopt.h having previously defined
1760- __need_getopt.
1761-
1762- The only place where __getopt_argv_const is used is in definitions
1763- of getopt_long and getopt_long_only below, but these are visible
1764- only if __need_getopt is not defined, so it is quite safe to rewrite
1765- the conditional as follows:
1766-*/
1767-#if !defined __need_getopt
1768-# if defined __GETOPT_PREFIX
1769-# define __getopt_argv_const /* empty */
1770-# else
1771-# define __getopt_argv_const const
1772-# endif
1773-#endif
1774-
1775-/* If __GNU_LIBRARY__ is not already defined, either we are being used
1776- standalone, or this is the first header included in the source file.
1777- If we are being used with glibc, we need to include <features.h>, but
1778- that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
1779- not defined, include <ctype.h>, which will pull in <features.h> for us
1780- if it's from glibc. (Why ctype.h? It's guaranteed to exist and it
1781- doesn't flood the namespace with stuff the way some other headers do.) */
1782-#if !defined __GNU_LIBRARY__
1783-# include <ctype.h>
1784-#endif
1785-
1786-#ifndef __THROW
1787-# ifndef __GNUC_PREREQ
1788-# define __GNUC_PREREQ(maj, min) (0)
1789-# endif
1790-# if defined __cplusplus && __GNUC_PREREQ (2,8)
1791-# define __THROW throw ()
1792-# else
1793-# define __THROW
1794-# endif
1795-#endif
1796-
1797-#ifdef __cplusplus
1798-extern "C" {
1799-#endif
1800-
1801-/* For communication from `getopt' to the caller.
1802- When `getopt' finds an option that takes an argument,
1803- the argument value is returned here.
1804- Also, when `ordering' is RETURN_IN_ORDER,
1805- each non-option ARGV-element is returned here. */
1806-
1807-extern char *optarg;
1808-
1809-/* Index in ARGV of the next element to be scanned.
1810- This is used for communication to and from the caller
1811- and for communication between successive calls to `getopt'.
1812-
1813- On entry to `getopt', zero means this is the first call; initialize.
1814-
1815- When `getopt' returns -1, this is the index of the first of the
1816- non-option elements that the caller should itself scan.
1817-
1818- Otherwise, `optind' communicates from one call to the next
1819- how much of ARGV has been scanned so far. */
1820-
1821-extern int optind;
1822-
1823-/* Callers store zero here to inhibit the error message `getopt' prints
1824- for unrecognized options. */
1825-
1826-extern int opterr;
1827-
1828-/* Set to an option character which was unrecognized. */
1829-
1830-extern int optopt;
1831-
1832-#ifndef __need_getopt
1833-/* Describe the long-named options requested by the application.
1834- The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
1835- of `struct option' terminated by an element containing a name which is
1836- zero.
1837-
1838- The field `has_arg' is:
1839- no_argument (or 0) if the option does not take an argument,
1840- required_argument (or 1) if the option requires an argument,
1841- optional_argument (or 2) if the option takes an optional argument.
1842-
1843- If the field `flag' is not NULL, it points to a variable that is set
1844- to the value given in the field `val' when the option is found, but
1845- left unchanged if the option is not found.
1846-
1847- To have a long-named option do something other than set an `int' to
1848- a compiled-in constant, such as set a value from `optarg', set the
1849- option's `flag' field to zero and its `val' field to a nonzero
1850- value (the equivalent single-letter option character, if there is
1851- one). For long options that have a zero `flag' field, `getopt'
1852- returns the contents of the `val' field. */
1853-
1854-struct option
1855-{
1856- const char *name;
1857- /* has_arg can't be an enum because some compilers complain about
1858- type mismatches in all the code that assumes it is an int. */
1859- int has_arg;
1860- int *flag;
1861- int val;
1862-};
1863-
1864-/* Names for the values of the `has_arg' field of `struct option'. */
1865-
1866-# define no_argument 0
1867-# define required_argument 1
1868-# define optional_argument 2
1869-#endif /* need getopt */
1870-
1871-
1872-/* Get definitions and prototypes for functions to process the
1873- arguments in ARGV (ARGC of them, minus the program name) for
1874- options given in OPTS.
1875-
1876- Return the option character from OPTS just read. Return -1 when
1877- there are no more options. For unrecognized options, or options
1878- missing arguments, `optopt' is set to the option letter, and '?' is
1879- returned.
1880-
1881- The OPTS string is a list of characters which are recognized option
1882- letters, optionally followed by colons, specifying that that letter
1883- takes an argument, to be placed in `optarg'.
1884-
1885- If a letter in OPTS is followed by two colons, its argument is
1886- optional. This behavior is specific to the GNU `getopt'.
1887-
1888- The argument `--' causes premature termination of argument
1889- scanning, explicitly telling `getopt' that there are no more
1890- options.
1891-
1892- If OPTS begins with `-', then non-option arguments are treated as
1893- arguments to the option '\1'. This behavior is specific to the GNU
1894- `getopt'. If OPTS begins with `+', or POSIXLY_CORRECT is set in
1895- the environment, then do not permute arguments. */
1896-
1897-extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
1898- __THROW;
1899-
1900-#ifndef __need_getopt
1901-extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
1902- const char *__shortopts,
1903- const struct option *__longopts, int *__longind)
1904- __THROW;
1905-extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,
1906- const char *__shortopts,
1907- const struct option *__longopts, int *__longind)
1908- __THROW;
1909-
1910-#endif
1911-
1912-#ifdef __cplusplus
1913-}
1914-#endif
1915-
1916-/* Make sure we later can get all the definitions and declarations. */
1917-#undef __need_getopt
1918-
1919-#endif /* getopt.h */
1920
1921=== removed file 'gnulib/getopt1.c'
1922--- gnulib/getopt1.c 2009-01-29 19:22:08 +0000
1923+++ gnulib/getopt1.c 1970-01-01 00:00:00 +0000
1924@@ -1,170 +0,0 @@
1925-/* getopt_long and getopt_long_only entry points for GNU getopt.
1926- Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98,2004,2006
1927- Free Software Foundation, Inc.
1928- This file is part of the GNU C Library.
1929-
1930- This program is free software: you can redistribute it and/or modify
1931- it under the terms of the GNU Lesser General Public License as published by
1932- the Free Software Foundation; either version 3 of the License, or
1933- (at your option) any later version.
1934-
1935- This program is distributed in the hope that it will be useful,
1936- but WITHOUT ANY WARRANTY; without even the implied warranty of
1937- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1938- GNU Lesser General Public License for more details.
1939-
1940- You should have received a copy of the GNU Lesser General Public License
1941- along with this program. If not, see <http://www.gnu.org/licenses/>. */
1942-
1943
1944-#ifdef _LIBC
1945-# include <getopt.h>
1946-#else
1947-# include <config.h>
1948-# include "getopt.h"
1949-#endif
1950-#include "getopt_int.h"
1951-
1952-#include <stdio.h>
1953-
1954-/* This needs to come after some library #include
1955- to get __GNU_LIBRARY__ defined. */
1956-#ifdef __GNU_LIBRARY__
1957-#include <stdlib.h>
1958-#endif
1959-
1960-#ifndef NULL
1961-#define NULL 0
1962-#endif
1963-
1964-int
1965-getopt_long (int argc, char *__getopt_argv_const *argv, const char *options,
1966- const struct option *long_options, int *opt_index)
1967-{
1968- return _getopt_internal (argc, (char **) argv, options, long_options,
1969- opt_index, 0, 0);
1970-}
1971-
1972-int
1973-_getopt_long_r (int argc, char **argv, const char *options,
1974- const struct option *long_options, int *opt_index,
1975- struct _getopt_data *d)
1976-{
1977- return _getopt_internal_r (argc, argv, options, long_options, opt_index,
1978- 0, 0, d);
1979-}
1980-
1981-/* Like getopt_long, but '-' as well as '--' can indicate a long option.
1982- If an option that starts with '-' (not '--') doesn't match a long option,
1983- but does match a short option, it is parsed as a short option
1984- instead. */
1985-
1986-int
1987-getopt_long_only (int argc, char *__getopt_argv_const *argv,
1988- const char *options,
1989- const struct option *long_options, int *opt_index)
1990-{
1991- return _getopt_internal (argc, (char **) argv, options, long_options,
1992- opt_index, 1, 0);
1993-}
1994-
1995-int
1996-_getopt_long_only_r (int argc, char **argv, const char *options,
1997- const struct option *long_options, int *opt_index,
1998- struct _getopt_data *d)
1999-{
2000- return _getopt_internal_r (argc, argv, options, long_options, opt_index,
2001- 1, 0, d);
2002-}
2003-
2004-
2005
2006-#ifdef TEST
2007-
2008-#include <stdio.h>
2009-
2010-int
2011-main (int argc, char **argv)
2012-{
2013- int c;
2014- int digit_optind = 0;
2015-
2016- while (1)
2017- {
2018- int this_option_optind = optind ? optind : 1;
2019- int option_index = 0;
2020- static struct option long_options[] =
2021- {
2022- {"add", 1, 0, 0},
2023- {"append", 0, 0, 0},
2024- {"delete", 1, 0, 0},
2025- {"verbose", 0, 0, 0},
2026- {"create", 0, 0, 0},
2027- {"file", 1, 0, 0},
2028- {0, 0, 0, 0}
2029- };
2030-
2031- c = getopt_long (argc, argv, "abc:d:0123456789",
2032- long_options, &option_index);
2033- if (c == -1)
2034- break;
2035-
2036- switch (c)
2037- {
2038- case 0:
2039- printf ("option %s", long_options[option_index].name);
2040- if (optarg)
2041- printf (" with arg %s", optarg);
2042- printf ("\n");
2043- break;
2044-
2045- case '0':
2046- case '1':
2047- case '2':
2048- case '3':
2049- case '4':
2050- case '5':
2051- case '6':
2052- case '7':
2053- case '8':
2054- case '9':
2055- if (digit_optind != 0 && digit_optind != this_option_optind)
2056- printf ("digits occur in two different argv-elements.\n");
2057- digit_optind = this_option_optind;
2058- printf ("option %c\n", c);
2059- break;
2060-
2061- case 'a':
2062- printf ("option a\n");
2063- break;
2064-
2065- case 'b':
2066- printf ("option b\n");
2067- break;
2068-
2069- case 'c':
2070- printf ("option c with value `%s'\n", optarg);
2071- break;
2072-
2073- case 'd':
2074- printf ("option d with value `%s'\n", optarg);
2075- break;
2076-
2077- case '?':
2078- break;
2079-
2080- default:
2081- printf ("?? getopt returned character code 0%o ??\n", c);
2082- }
2083- }
2084-
2085- if (optind < argc)
2086- {
2087- printf ("non-option ARGV-elements: ");
2088- while (optind < argc)
2089- printf ("%s ", argv[optind++]);
2090- printf ("\n");
2091- }
2092-
2093- exit (0);
2094-}
2095-
2096-#endif /* TEST */
2097
2098=== removed file 'gnulib/getopt_int.h'
2099--- gnulib/getopt_int.h 2009-01-29 19:22:08 +0000
2100+++ gnulib/getopt_int.h 1970-01-01 00:00:00 +0000
2101@@ -1,130 +0,0 @@
2102-/* Internal declarations for getopt.
2103- Copyright (C) 1989-1994,1996-1999,2001,2003,2004
2104- Free Software Foundation, Inc.
2105- This file is part of the GNU C Library.
2106-
2107- This program is free software: you can redistribute it and/or modify
2108- it under the terms of the GNU Lesser General Public License as published by
2109- the Free Software Foundation; either version 3 of the License, or
2110- (at your option) any later version.
2111-
2112- This program is distributed in the hope that it will be useful,
2113- but WITHOUT ANY WARRANTY; without even the implied warranty of
2114- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2115- GNU Lesser General Public License for more details.
2116-
2117- You should have received a copy of the GNU Lesser General Public License
2118- along with this program. If not, see <http://www.gnu.org/licenses/>. */
2119-
2120-#ifndef _GETOPT_INT_H
2121-#define _GETOPT_INT_H 1
2122-
2123-extern int _getopt_internal (int ___argc, char **___argv,
2124- const char *__shortopts,
2125- const struct option *__longopts, int *__longind,
2126- int __long_only, int __posixly_correct);
2127-
2128-
2129
2130-/* Reentrant versions which can handle parsing multiple argument
2131- vectors at the same time. */
2132-
2133-/* Data type for reentrant functions. */
2134-struct _getopt_data
2135-{
2136- /* These have exactly the same meaning as the corresponding global
2137- variables, except that they are used for the reentrant
2138- versions of getopt. */
2139- int optind;
2140- int opterr;
2141- int optopt;
2142- char *optarg;
2143-
2144- /* Internal members. */
2145-
2146- /* True if the internal members have been initialized. */
2147- int __initialized;
2148-
2149- /* The next char to be scanned in the option-element
2150- in which the last option character we returned was found.
2151- This allows us to pick up the scan where we left off.
2152-
2153- If this is zero, or a null string, it means resume the scan
2154- by advancing to the next ARGV-element. */
2155- char *__nextchar;
2156-
2157- /* Describe how to deal with options that follow non-option ARGV-elements.
2158-
2159- If the caller did not specify anything,
2160- the default is REQUIRE_ORDER if the environment variable
2161- POSIXLY_CORRECT is defined, PERMUTE otherwise.
2162-
2163- REQUIRE_ORDER means don't recognize them as options;
2164- stop option processing when the first non-option is seen.
2165- This is what Unix does.
2166- This mode of operation is selected by either setting the environment
2167- variable POSIXLY_CORRECT, or using `+' as the first character
2168- of the list of option characters, or by calling getopt.
2169-
2170- PERMUTE is the default. We permute the contents of ARGV as we
2171- scan, so that eventually all the non-options are at the end.
2172- This allows options to be given in any order, even with programs
2173- that were not written to expect this.
2174-
2175- RETURN_IN_ORDER is an option available to programs that were
2176- written to expect options and other ARGV-elements in any order
2177- and that care about the ordering of the two. We describe each
2178- non-option ARGV-element as if it were the argument of an option
2179- with character code 1. Using `-' as the first character of the
2180- list of option characters selects this mode of operation.
2181-
2182- The special argument `--' forces an end of option-scanning regardless
2183- of the value of `ordering'. In the case of RETURN_IN_ORDER, only
2184- `--' can cause `getopt' to return -1 with `optind' != ARGC. */
2185-
2186- enum
2187- {
2188- REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
2189- } __ordering;
2190-
2191- /* If the POSIXLY_CORRECT environment variable is set
2192- or getopt was called. */
2193- int __posixly_correct;
2194-
2195-
2196- /* Handle permutation of arguments. */
2197-
2198- /* Describe the part of ARGV that contains non-options that have
2199- been skipped. `first_nonopt' is the index in ARGV of the first
2200- of them; `last_nonopt' is the index after the last of them. */
2201-
2202- int __first_nonopt;
2203- int __last_nonopt;
2204-
2205-#if defined _LIBC && defined USE_NONOPTION_FLAGS
2206- int __nonoption_flags_max_len;
2207- int __nonoption_flags_len;
2208-# endif
2209-};
2210-
2211-/* The initializer is necessary to set OPTIND and OPTERR to their
2212- default values and to clear the initialization flag. */
2213-#define _GETOPT_DATA_INITIALIZER { 1, 1 }
2214-
2215-extern int _getopt_internal_r (int ___argc, char **___argv,
2216- const char *__shortopts,
2217- const struct option *__longopts, int *__longind,
2218- int __long_only, int __posixly_correct,
2219- struct _getopt_data *__data);
2220-
2221-extern int _getopt_long_r (int ___argc, char **___argv,
2222- const char *__shortopts,
2223- const struct option *__longopts, int *__longind,
2224- struct _getopt_data *__data);
2225-
2226-extern int _getopt_long_only_r (int ___argc, char **___argv,
2227- const char *__shortopts,
2228- const struct option *__longopts,
2229- int *__longind,
2230- struct _getopt_data *__data);
2231-
2232-#endif /* getopt_int.h */
2233
2234=== removed file 'gnulib/gettext.h'
2235--- gnulib/gettext.h 2010-07-29 19:40:35 +0000
2236+++ gnulib/gettext.h 1970-01-01 00:00:00 +0000
2237@@ -1,279 +0,0 @@
2238-/* Convenience header for conditional use of GNU <libintl.h>.
2239- Copyright (C) 1995-1998, 2000-2002, 2004-2006 Free Software Foundation, Inc.
2240-
2241- This program is free software; you can redistribute it and/or modify
2242- it under the terms of the GNU Lesser General Public License as published by
2243- the Free Software Foundation; either version 2, or (at your option)
2244- any later version.
2245-
2246- This program is distributed in the hope that it will be useful,
2247- but WITHOUT ANY WARRANTY; without even the implied warranty of
2248- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2249- GNU Lesser General Public License for more details.
2250-
2251- You should have received a copy of the GNU Lesser General Public License along
2252- with this program; if not, write to the Free Software Foundation,
2253- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
2254-
2255-#ifndef _LIBGETTEXT_H
2256-#define _LIBGETTEXT_H 1
2257-
2258-/* NLS can be disabled through the configure --disable-nls option. */
2259-#if defined(ENABLE_NLS) && ENABLE_NLS
2260-
2261-/* Get declarations of GNU message catalog functions. */
2262-# include <libintl.h>
2263-
2264-/* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by
2265- the gettext() and ngettext() macros. This is an alternative to calling
2266- textdomain(), and is useful for libraries. */
2267-# ifdef DEFAULT_TEXT_DOMAIN
2268-# undef gettext
2269-# define gettext(Msgid) \
2270- dgettext (DEFAULT_TEXT_DOMAIN, Msgid)
2271-# undef ngettext
2272-# define ngettext(Msgid1, Msgid2, N) \
2273- dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N)
2274-# endif
2275-
2276-#else
2277-
2278-/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
2279- chokes if dcgettext is defined as a macro. So include it now, to make
2280- later inclusions of <locale.h> a NOP. We don't include <libintl.h>
2281- as well because people using "gettext.h" will not include <libintl.h>,
2282- and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
2283- is OK. */
2284-#if defined(__sun)
2285-# include <locale.h>
2286-#endif
2287-
2288-/* Many header files from the libstdc++ coming with g++ 3.3 or newer include
2289- <libintl.h>, which chokes if dcgettext is defined as a macro. So include
2290- it now, to make later inclusions of <libintl.h> a NOP. */
2291-#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
2292-# include <cstdlib>
2293-# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H
2294-# include <libintl.h>
2295-# endif
2296-#endif
2297-
2298-/* Disabled NLS.
2299- The casts to 'const char *' serve the purpose of producing warnings
2300- for invalid uses of the value returned from these functions.
2301- On pre-ANSI systems without 'const', the config.h file is supposed to
2302- contain "#define const". */
2303-# undef gettext
2304-# define gettext(Msgid) ((const char *) (Msgid))
2305-# undef dgettext
2306-# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid))
2307-# undef dcgettext
2308-# define dcgettext(Domainname, Msgid, Category) \
2309- ((void) (Category), dgettext (Domainname, Msgid))
2310-# undef ngettext
2311-# define ngettext(Msgid1, Msgid2, N) \
2312- ((N) == 1 \
2313- ? ((void) (Msgid2), (const char *) (Msgid1)) \
2314- : ((void) (Msgid1), (const char *) (Msgid2)))
2315-# undef dngettext
2316-# define dngettext(Domainname, Msgid1, Msgid2, N) \
2317- ((void) (Domainname), ngettext (Msgid1, Msgid2, N))
2318-# undef dcngettext
2319-# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
2320- ((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N))
2321-# undef textdomain
2322-# define textdomain(Domainname) ((const char *) (Domainname))
2323-# undef bindtextdomain
2324-# define bindtextdomain(Domainname, Dirname) \
2325- ((void) (Domainname), (const char *) (Dirname))
2326-# undef bind_textdomain_codeset
2327-# define bind_textdomain_codeset(Domainname, Codeset) \
2328- ((void) (Domainname), (const char *) (Codeset))
2329-
2330-#endif
2331-
2332-/* A pseudo function call that serves as a marker for the automated
2333- extraction of messages, but does not call gettext(). The run-time
2334- translation is done at a different place in the code.
2335- The argument, String, should be a literal string. Concatenated strings
2336- and other string expressions won't work.
2337- The macro's expansion is not parenthesized, so that it is suitable as
2338- initializer for static 'char[]' or 'const char[]' variables. */
2339-#define gettext_noop(String) String
2340-
2341-/* The separator between msgctxt and msgid in a .mo file. */
2342-#define GETTEXT_CONTEXT_GLUE "\004"
2343-
2344-/* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a
2345- MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be
2346- short and rarely need to change.
2347- The letter 'p' stands for 'particular' or 'special'. */
2348-#ifdef DEFAULT_TEXT_DOMAIN
2349-# define pgettext(Msgctxt, Msgid) \
2350- pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
2351-#else
2352-# define pgettext(Msgctxt, Msgid) \
2353- pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
2354-#endif
2355-#define dpgettext(Domainname, Msgctxt, Msgid) \
2356- pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES)
2357-#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \
2358- pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category)
2359-#ifdef DEFAULT_TEXT_DOMAIN
2360-# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
2361- npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
2362-#else
2363-# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \
2364- npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
2365-#endif
2366-#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
2367- npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES)
2368-#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \
2369- npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category)
2370-
2371-#ifdef __GNUC__
2372-__inline
2373-#else
2374-#ifdef __cplusplus
2375-inline
2376-#endif
2377-#endif
2378-static const char *
2379-pgettext_aux (const char *domain,
2380- const char *msg_ctxt_id, const char *msgid,
2381- int category)
2382-{
2383- const char *translation = dcgettext (domain, msg_ctxt_id, category);
2384- if (translation == msg_ctxt_id)
2385- return msgid;
2386- else
2387- return translation;
2388-}
2389-
2390-#ifdef __GNUC__
2391-__inline
2392-#else
2393-#ifdef __cplusplus
2394-inline
2395-#endif
2396-#endif
2397-static const char *
2398-npgettext_aux (const char *domain,
2399- const char *msg_ctxt_id, const char *msgid,
2400- const char *msgid_plural, unsigned long int n,
2401- int category)
2402-{
2403- const char *translation =
2404- dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
2405- if (translation == msg_ctxt_id || translation == msgid_plural)
2406- return (n == 1 ? msgid : msgid_plural);
2407- else
2408- return translation;
2409-}
2410-
2411-/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID
2412- can be arbitrary expressions. But for string literals these macros are
2413- less efficient than those above. */
2414-
2415-#include <string.h>
2416-
2417-#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \
2418- (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined(__STRICT_ANSI__)) \
2419- /* || __STDC_VERSION__ >= 199901L */ )
2420-
2421-#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
2422-#include <stdlib.h>
2423-#endif
2424-
2425-#define pgettext_expr(Msgctxt, Msgid) \
2426- dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES)
2427-#define dpgettext_expr(Domainname, Msgctxt, Msgid) \
2428- dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES)
2429-
2430-#ifdef __GNUC__
2431-__inline
2432-#else
2433-#ifdef __cplusplus
2434-inline
2435-#endif
2436-#endif
2437-static const char *
2438-dcpgettext_expr (const char *domain,
2439- const char *msgctxt, const char *msgid,
2440- int category)
2441-{
2442- size_t msgctxt_len = strlen (msgctxt) + 1;
2443- size_t msgid_len = strlen (msgid) + 1;
2444- const char *translation;
2445-#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
2446- char msg_ctxt_id[msgctxt_len + msgid_len];
2447-#else
2448- char buf[1024];
2449- char *msg_ctxt_id =
2450- (msgctxt_len + msgid_len <= sizeof (buf)
2451- ? buf
2452- : (char *) malloc (msgctxt_len + msgid_len));
2453- if (msg_ctxt_id != NULL)
2454-#endif
2455- {
2456- memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
2457- msg_ctxt_id[msgctxt_len - 1] = '\004';
2458- memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
2459- translation = dcgettext (domain, msg_ctxt_id, category);
2460-#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
2461- if (msg_ctxt_id != buf)
2462- free (msg_ctxt_id);
2463-#endif
2464- if (translation != msg_ctxt_id)
2465- return translation;
2466- }
2467- return msgid;
2468-}
2469-
2470-#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \
2471- dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
2472-#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \
2473- dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES)
2474-
2475-#ifdef __GNUC__
2476-__inline
2477-#else
2478-#ifdef __cplusplus
2479-inline
2480-#endif
2481-#endif
2482-static const char *
2483-dcnpgettext_expr (const char *domain,
2484- const char *msgctxt, const char *msgid,
2485- const char *msgid_plural, unsigned long int n,
2486- int category)
2487-{
2488- size_t msgctxt_len = strlen (msgctxt) + 1;
2489- size_t msgid_len = strlen (msgid) + 1;
2490- const char *translation;
2491-#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
2492- char msg_ctxt_id[msgctxt_len + msgid_len];
2493-#else
2494- char buf[1024];
2495- char *msg_ctxt_id =
2496- (msgctxt_len + msgid_len <= sizeof (buf)
2497- ? buf
2498- : (char *) malloc (msgctxt_len + msgid_len));
2499- if (msg_ctxt_id != NULL)
2500-#endif
2501- {
2502- memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
2503- msg_ctxt_id[msgctxt_len - 1] = '\004';
2504- memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
2505- translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category);
2506-#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
2507- if (msg_ctxt_id != buf)
2508- free (msg_ctxt_id);
2509-#endif
2510- if (!(translation == msg_ctxt_id || translation == msgid_plural))
2511- return translation;
2512- }
2513- return (n == 1 ? msgid : msgid_plural);
2514-}
2515-
2516-#endif /* _LIBGETTEXT_H */
2517
2518=== removed file 'gnulib/mktime.c'
2519--- gnulib/mktime.c 2009-07-14 00:56:49 +0000
2520+++ gnulib/mktime.c 1970-01-01 00:00:00 +0000
2521@@ -1,519 +0,0 @@
2522-/* Convert a `struct tm' to a time_t value.
2523- Copyright (C) 1993-1999, 2002-2005, 2006, 2007 Free Software Foundation, Inc.
2524- This file is part of the GNU C Library.
2525- Contributed by Paul Eggert <eggert@twinsun.com>.
2526-
2527- This program is free software; you can redistribute it and/or modify
2528- it under the terms of the GNU Lesser General Public License as published by
2529- the Free Software Foundation; either version 2, or (at your option)
2530- any later version.
2531-
2532- This program is distributed in the hope that it will be useful,
2533- but WITHOUT ANY WARRANTY; without even the implied warranty of
2534- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2535- GNU Lesser General Public License for more details.
2536-
2537- You should have received a copy of the GNU Lesser General Public License along
2538- with this program; if not, write to the Free Software Foundation,
2539- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
2540-
2541-#ifndef _LIBC
2542-# include <config.h>
2543-#endif
2544-
2545-/* Assume that leap seconds are possible, unless told otherwise.
2546- If the host has a `zic' command with a `-L leapsecondfilename' option,
2547- then it supports leap seconds; otherwise it probably doesn't. */
2548-#ifndef LEAP_SECONDS_POSSIBLE
2549-# define LEAP_SECONDS_POSSIBLE 1
2550-#endif
2551-
2552-#include <time.h>
2553-
2554-#include <limits.h>
2555-
2556-#include <string.h> /* For the real memcpy prototype. */
2557-
2558-
2559-/* Shift A right by B bits portably, by dividing A by 2**B and
2560- truncating towards minus infinity. A and B should be free of side
2561- effects, and B should be in the range 0 <= B <= INT_BITS - 2, where
2562- INT_BITS is the number of useful bits in an int. GNU code can
2563- assume that INT_BITS is at least 32.
2564-
2565- ISO C99 says that A >> B is implementation-defined if A < 0. Some
2566- implementations (e.g., UNICOS 9.0 on a Cray Y-MP EL) don't shift
2567- right in the usual way when A < 0, so SHR falls back on division if
2568- ordinary A >> B doesn't seem to be the usual signed shift. */
2569-#define SHR(a, b) \
2570- (-1 >> 1 == -1 \
2571- ? (a) >> (b) \
2572- : (a) / (1 << (b)) - ((a) % (1 << (b)) < 0))
2573-
2574-/* The extra casts in the following macros work around compiler bugs,
2575- e.g., in Cray C 5.0.3.0. */
2576-
2577-/* True if the arithmetic type T is an integer type. bool counts as
2578- an integer. */
2579-#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1)
2580-
2581-/* True if negative values of the signed integer type T use two's
2582- complement, ones' complement, or signed magnitude representation,
2583- respectively. Much GNU code assumes two's complement, but some
2584- people like to be portable to all possible C hosts. */
2585-#define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1)
2586-#define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0)
2587-#define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1)
2588-
2589-/* True if the arithmetic type T is signed. */
2590-#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
2591-
2592-/* The maximum and minimum values for the integer type T. These
2593- macros have undefined behavior if T is signed and has padding bits.
2594- If this is a problem for you, please let us know how to fix it for
2595- your host. */
2596-#define TYPE_MINIMUM(t) \
2597- ((t) (! TYPE_SIGNED (t) \
2598- ? (t) 0 \
2599- : TYPE_SIGNED_MAGNITUDE (t) \
2600- ? ~ (t) 0 \
2601- : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))
2602-#define TYPE_MAXIMUM(t) \
2603- ((t) (! TYPE_SIGNED (t) \
2604- ? (t) -1 \
2605- : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))))
2606-
2607-#ifndef TIME_T_MIN
2608-# define TIME_T_MIN TYPE_MINIMUM (time_t)
2609-#endif
2610-#ifndef TIME_T_MAX
2611-# define TIME_T_MAX TYPE_MAXIMUM (time_t)
2612-#endif
2613-#define TIME_T_MIDPOINT (SHR (TIME_T_MIN + TIME_T_MAX, 1) + 1)
2614-
2615-/* Verify a requirement at compile-time (unlike assert, which is runtime). */
2616-#define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]; }
2617-
2618-verify (time_t_is_integer, TYPE_IS_INTEGER (time_t));
2619-verify (twos_complement_arithmetic, TYPE_TWOS_COMPLEMENT (int));
2620-/* The code also assumes that signed integer overflow silently wraps
2621- around, but this assumption can't be stated without causing a
2622- diagnostic on some hosts. */
2623-
2624-#define EPOCH_YEAR 1970
2625-#define TM_YEAR_BASE 1900
2626-verify (base_year_is_a_multiple_of_100, TM_YEAR_BASE % 100 == 0);
2627-
2628-/* Return 1 if YEAR + TM_YEAR_BASE is a leap year. */
2629-static inline int
2630-leapyear (long int year)
2631-{
2632- /* Don't add YEAR to TM_YEAR_BASE, as that might overflow.
2633- Also, work even if YEAR is negative. */
2634- return
2635- ((year & 3) == 0
2636- && (year % 100 != 0
2637- || ((year / 100) & 3) == (- (TM_YEAR_BASE / 100) & 3)));
2638-}
2639-
2640-/* How many days come before each month (0-12). */
2641-#ifndef _LIBC
2642-static
2643-#endif
2644-const unsigned short int __mon_yday[2][13] =
2645- {
2646- /* Normal years. */
2647- { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
2648- /* Leap years. */
2649- { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
2650- };
2651-
2652-
2653-#ifndef _LIBC
2654-/* Portable standalone applications should supply a <time.h> that
2655- declares a POSIX-compliant localtime_r, for the benefit of older
2656- implementations that lack localtime_r or have a nonstandard one.
2657- See the gnulib time_r module for one way to implement this. */
2658-# undef __localtime_r
2659-# define __localtime_r localtime_r
2660-# define __mktime_internal mktime_internal
2661-#endif
2662-
2663-/* Return an integer value measuring (YEAR1-YDAY1 HOUR1:MIN1:SEC1) -
2664- (YEAR0-YDAY0 HOUR0:MIN0:SEC0) in seconds, assuming that the clocks
2665- were not adjusted between the time stamps.
2666-
2667- The YEAR values uses the same numbering as TP->tm_year. Values
2668- need not be in the usual range. However, YEAR1 must not be less
2669- than 2 * INT_MIN or greater than 2 * INT_MAX.
2670-
2671- The result may overflow. It is the caller's responsibility to
2672- detect overflow. */
2673-
2674-static inline time_t
2675-ydhms_diff (long int year1, long int yday1, int hour1, int min1, int sec1,
2676- int year0, int yday0, int hour0, int min0, int sec0)
2677-{
2678- verify (C99_integer_division, -1 / 2 == 0);
2679- verify (long_int_year_and_yday_are_wide_enough,
2680- INT_MAX <= LONG_MAX / 2 || TIME_T_MAX <= UINT_MAX);
2681-
2682- /* Compute intervening leap days correctly even if year is negative.
2683- Take care to avoid integer overflow here. */
2684- int a4 = SHR (year1, 2) + SHR (TM_YEAR_BASE, 2) - ! (year1 & 3);
2685- int b4 = SHR (year0, 2) + SHR (TM_YEAR_BASE, 2) - ! (year0 & 3);
2686- int a100 = a4 / 25 - (a4 % 25 < 0);
2687- int b100 = b4 / 25 - (b4 % 25 < 0);
2688- int a400 = SHR (a100, 2);
2689- int b400 = SHR (b100, 2);
2690- int intervening_leap_days = (a4 - b4) - (a100 - b100) + (a400 - b400);
2691-
2692- /* Compute the desired time in time_t precision. Overflow might
2693- occur here. */
2694- time_t tyear1 = year1;
2695- time_t years = tyear1 - year0;
2696- time_t days = 365 * years + yday1 - yday0 + intervening_leap_days;
2697- time_t hours = 24 * days + hour1 - hour0;
2698- time_t minutes = 60 * hours + min1 - min0;
2699- time_t seconds = 60 * minutes + sec1 - sec0;
2700- return seconds;
2701-}
2702-
2703-
2704-/* Return a time_t value corresponding to (YEAR-YDAY HOUR:MIN:SEC),
2705- assuming that *T corresponds to *TP and that no clock adjustments
2706- occurred between *TP and the desired time.
2707- If TP is null, return a value not equal to *T; this avoids false matches.
2708- If overflow occurs, yield the minimal or maximal value, except do not
2709- yield a value equal to *T. */
2710-static time_t
2711-guess_time_tm (long int year, long int yday, int hour, int min, int sec,
2712- const time_t *t, const struct tm *tp)
2713-{
2714- if (tp)
2715- {
2716- time_t d = ydhms_diff (year, yday, hour, min, sec,
2717- tp->tm_year, tp->tm_yday,
2718- tp->tm_hour, tp->tm_min, tp->tm_sec);
2719- time_t t1 = *t + d;
2720- if ((t1 < *t) == (TYPE_SIGNED (time_t) ? d < 0 : TIME_T_MAX / 2 < d))
2721- return t1;
2722- }
2723-
2724- /* Overflow occurred one way or another. Return the nearest result
2725- that is actually in range, except don't report a zero difference
2726- if the actual difference is nonzero, as that would cause a false
2727- match; and don't oscillate between two values, as that would
2728- confuse the spring-forward gap detector. */
2729- return (*t < TIME_T_MIDPOINT
2730- ? (*t <= TIME_T_MIN + 1 ? *t + 1 : TIME_T_MIN)
2731- : (TIME_T_MAX - 1 <= *t ? *t - 1 : TIME_T_MAX));
2732-}
2733-
2734-/* Use CONVERT to convert *T to a broken down time in *TP.
2735- If *T is out of range for conversion, adjust it so that
2736- it is the nearest in-range value and then convert that. */
2737-static struct tm *
2738-ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
2739- time_t *t, struct tm *tp)
2740-{
2741- struct tm *r = convert (t, tp);
2742-
2743- if (!r && *t)
2744- {
2745- time_t bad = *t;
2746- time_t ok = 0;
2747-
2748- /* BAD is a known unconvertible time_t, and OK is a known good one.
2749- Use binary search to narrow the range between BAD and OK until
2750- they differ by 1. */
2751- while (bad != ok + (bad < 0 ? -1 : 1))
2752- {
2753- time_t mid = *t = (bad < 0
2754- ? bad + ((ok - bad) >> 1)
2755- : ok + ((bad - ok) >> 1));
2756- r = convert (t, tp);
2757- if (r)
2758- ok = mid;
2759- else
2760- bad = mid;
2761- }
2762-
2763- if (!r && ok)
2764- {
2765- /* The last conversion attempt failed;
2766- revert to the most recent successful attempt. */
2767- *t = ok;
2768- r = convert (t, tp);
2769- }
2770- }
2771-
2772- return r;
2773-}
2774-
2775-
2776-extern time_t
2777-__mktime_internal (struct tm *tp,
2778- struct tm *(*convert) (const time_t *, struct tm *),
2779- time_t *offset);
2780-/* Convert *TP to a time_t value, inverting
2781- the monotonic and mostly-unit-linear conversion function CONVERT.
2782- Use *OFFSET to keep track of a guess at the offset of the result,
2783- compared to what the result would be for UTC without leap seconds.
2784- If *OFFSET's guess is correct, only one CONVERT call is needed.
2785- This function is external because it is used also by timegm.c. */
2786-time_t
2787-__mktime_internal (struct tm *tp,
2788- struct tm *(*convert) (const time_t *, struct tm *),
2789- time_t *offset)
2790-{
2791- time_t t, gt, t0, t1, t2;
2792- struct tm tm;
2793-
2794- /* The maximum number of probes (calls to CONVERT) should be enough
2795- to handle any combinations of time zone rule changes, solar time,
2796- leap seconds, and oscillations around a spring-forward gap.
2797- POSIX.1 prohibits leap seconds, but some hosts have them anyway. */
2798- int remaining_probes = 6;
2799-
2800- /* Time requested. Copy it in case CONVERT modifies *TP; this can
2801- occur if TP is localtime's returned value and CONVERT is localtime. */
2802- int sec = tp->tm_sec;
2803- int min = tp->tm_min;
2804- int hour = tp->tm_hour;
2805- int mday = tp->tm_mday;
2806- int mon = tp->tm_mon;
2807- int year_requested = tp->tm_year;
2808- /* Normalize the value. */
2809- int isdst = ((tp->tm_isdst >> (8 * sizeof (tp->tm_isdst) - 1))
2810- | (tp->tm_isdst != 0));
2811-
2812- /* 1 if the previous probe was DST. */
2813- int dst2;
2814-
2815- /* Ensure that mon is in range, and set year accordingly. */
2816- int mon_remainder = mon % 12;
2817- int negative_mon_remainder = mon_remainder < 0;
2818- int mon_years = mon / 12 - negative_mon_remainder;
2819- long int lyear_requested = year_requested;
2820- long int year = lyear_requested + mon_years;
2821-
2822- /* The other values need not be in range:
2823- the remaining code handles minor overflows correctly,
2824- assuming int and time_t arithmetic wraps around.
2825- Major overflows are caught at the end. */
2826-
2827- /* Calculate day of year from year, month, and day of month.
2828- The result need not be in range. */
2829- int mon_yday = ((__mon_yday[leapyear (year)]
2830- [mon_remainder + 12 * negative_mon_remainder])
2831- - 1);
2832- long int lmday = mday;
2833- long int yday = mon_yday + lmday;
2834-
2835- time_t guessed_offset = *offset;
2836-
2837- int sec_requested = sec;
2838-
2839- if (LEAP_SECONDS_POSSIBLE)
2840- {
2841- /* Handle out-of-range seconds specially,
2842- since ydhms_tm_diff assumes every minute has 60 seconds. */
2843- if (sec < 0)
2844- sec = 0;
2845- if (59 < sec)
2846- sec = 59;
2847- }
2848-
2849- /* Invert CONVERT by probing. First assume the same offset as last
2850- time. */
2851-
2852- t0 = ydhms_diff (year, yday, hour, min, sec,
2853- EPOCH_YEAR - TM_YEAR_BASE, 0, 0, 0, - guessed_offset);
2854-
2855- if (TIME_T_MAX / INT_MAX / 366 / 24 / 60 / 60 < 3)
2856- {
2857- /* time_t isn't large enough to rule out overflows, so check
2858- for major overflows. A gross check suffices, since if t0
2859- has overflowed, it is off by a multiple of TIME_T_MAX -
2860- TIME_T_MIN + 1. So ignore any component of the difference
2861- that is bounded by a small value. */
2862-
2863- /* Approximate log base 2 of the number of time units per
2864- biennium. A biennium is 2 years; use this unit instead of
2865- years to avoid integer overflow. For example, 2 average
2866- Gregorian years are 2 * 365.2425 * 24 * 60 * 60 seconds,
2867- which is 63113904 seconds, and rint (log2 (63113904)) is
2868- 26. */
2869- int ALOG2_SECONDS_PER_BIENNIUM = 26;
2870- int ALOG2_MINUTES_PER_BIENNIUM = 20;
2871- int ALOG2_HOURS_PER_BIENNIUM = 14;
2872- int ALOG2_DAYS_PER_BIENNIUM = 10;
2873- int LOG2_YEARS_PER_BIENNIUM = 1;
2874-
2875- int approx_requested_biennia =
2876- (SHR (year_requested, LOG2_YEARS_PER_BIENNIUM)
2877- - SHR (EPOCH_YEAR - TM_YEAR_BASE, LOG2_YEARS_PER_BIENNIUM)
2878- + SHR (mday, ALOG2_DAYS_PER_BIENNIUM)
2879- + SHR (hour, ALOG2_HOURS_PER_BIENNIUM)
2880- + SHR (min, ALOG2_MINUTES_PER_BIENNIUM)
2881- + (LEAP_SECONDS_POSSIBLE
2882- ? 0
2883- : SHR (sec, ALOG2_SECONDS_PER_BIENNIUM)));
2884-
2885- int approx_biennia = SHR (t0, ALOG2_SECONDS_PER_BIENNIUM);
2886- int diff = approx_biennia - approx_requested_biennia;
2887- int abs_diff = diff < 0 ? - diff : diff;
2888-
2889- /* IRIX 4.0.5 cc miscaculates TIME_T_MIN / 3: it erroneously
2890- gives a positive value of 715827882. Setting a variable
2891- first then doing math on it seems to work.
2892- (ghazi@caip.rutgers.edu) */
2893- time_t time_t_max = TIME_T_MAX;
2894- time_t time_t_min = TIME_T_MIN;
2895- time_t overflow_threshold =
2896- (time_t_max / 3 - time_t_min / 3) >> ALOG2_SECONDS_PER_BIENNIUM;
2897-
2898- if (overflow_threshold < abs_diff)
2899- {
2900- /* Overflow occurred. Try repairing it; this might work if
2901- the time zone offset is enough to undo the overflow. */
2902- time_t repaired_t0 = -1 - t0;
2903- approx_biennia = SHR (repaired_t0, ALOG2_SECONDS_PER_BIENNIUM);
2904- diff = approx_biennia - approx_requested_biennia;
2905- abs_diff = diff < 0 ? - diff : diff;
2906- if (overflow_threshold < abs_diff)
2907- return -1;
2908- guessed_offset += repaired_t0 - t0;
2909- t0 = repaired_t0;
2910- }
2911- }
2912-
2913- /* Repeatedly use the error to improve the guess. */
2914-
2915- for (t = t1 = t2 = t0, dst2 = 0;
2916- (gt = guess_time_tm (year, yday, hour, min, sec, &t,
2917- ranged_convert (convert, &t, &tm)),
2918- t != gt);
2919- t1 = t2, t2 = t, t = gt, dst2 = tm.tm_isdst != 0)
2920- if (t == t1 && t != t2
2921- && (tm.tm_isdst < 0
2922- || (isdst < 0
2923- ? dst2 <= (tm.tm_isdst != 0)
2924- : (isdst != 0) != (tm.tm_isdst != 0))))
2925- /* We can't possibly find a match, as we are oscillating
2926- between two values. The requested time probably falls
2927- within a spring-forward gap of size GT - T. Follow the common
2928- practice in this case, which is to return a time that is GT - T
2929- away from the requested time, preferring a time whose
2930- tm_isdst differs from the requested value. (If no tm_isdst
2931- was requested and only one of the two values has a nonzero
2932- tm_isdst, prefer that value.) In practice, this is more
2933- useful than returning -1. */
2934- goto offset_found;
2935- else if (--remaining_probes == 0)
2936- return -1;
2937-
2938- /* We have a match. Check whether tm.tm_isdst has the requested
2939- value, if any. */
2940- if (isdst != tm.tm_isdst && 0 <= isdst && 0 <= tm.tm_isdst)
2941- {
2942- /* tm.tm_isdst has the wrong value. Look for a neighboring
2943- time with the right value, and use its UTC offset.
2944-
2945- Heuristic: probe the adjacent timestamps in both directions,
2946- looking for the desired isdst. This should work for all real
2947- time zone histories in the tz database. */
2948-
2949- /* Distance between probes when looking for a DST boundary. In
2950- tzdata2003a, the shortest period of DST is 601200 seconds
2951- (e.g., America/Recife starting 2000-10-08 01:00), and the
2952- shortest period of non-DST surrounded by DST is 694800
2953- seconds (Africa/Tunis starting 1943-04-17 01:00). Use the
2954- minimum of these two values, so we don't miss these short
2955- periods when probing. */
2956- int stride = 601200;
2957-
2958- /* The longest period of DST in tzdata2003a is 536454000 seconds
2959- (e.g., America/Jujuy starting 1946-10-01 01:00). The longest
2960- period of non-DST is much longer, but it makes no real sense
2961- to search for more than a year of non-DST, so use the DST
2962- max. */
2963- int duration_max = 536454000;
2964-
2965- /* Search in both directions, so the maximum distance is half
2966- the duration; add the stride to avoid off-by-1 problems. */
2967- int delta_bound = duration_max / 2 + stride;
2968-
2969- int delta, direction;
2970-
2971- for (delta = stride; delta < delta_bound; delta += stride)
2972- for (direction = -1; direction <= 1; direction += 2)
2973- {
2974- time_t ot = t + delta * direction;
2975- if ((ot < t) == (direction < 0))
2976- {
2977- struct tm otm;
2978- ranged_convert (convert, &ot, &otm);
2979- if (otm.tm_isdst == isdst)
2980- {
2981- /* We found the desired tm_isdst.
2982- Extrapolate back to the desired time. */
2983- t = guess_time_tm (year, yday, hour, min, sec, &ot, &otm);
2984- ranged_convert (convert, &t, &tm);
2985- goto offset_found;
2986- }
2987- }
2988- }
2989- }
2990-
2991- offset_found:
2992- *offset = guessed_offset + t - t0;
2993-
2994- if (LEAP_SECONDS_POSSIBLE && sec_requested != tm.tm_sec)
2995- {
2996- /* Adjust time to reflect the tm_sec requested, not the normalized value.
2997- Also, repair any damage from a false match due to a leap second. */
2998- int sec_adjustment = (sec == 0 && tm.tm_sec == 60) - sec;
2999- t1 = t + sec_requested;
3000- t2 = t1 + sec_adjustment;
3001- if (((t1 < t) != (sec_requested < 0))
3002- | ((t2 < t1) != (sec_adjustment < 0))
3003- | ! convert (&t2, &tm))
3004- return -1;
3005- t = t2;
3006- }
3007-
3008- *tp = tm;
3009- return t;
3010-}
3011-
3012-
3013-/* FIXME: This should use a signed type wide enough to hold any UTC
3014- offset in seconds. 'int' should be good enough for GNU code. We
3015- can't fix this unilaterally though, as other modules invoke
3016- __mktime_internal. */
3017-static time_t localtime_offset;
3018-
3019-/* Convert *TP to a time_t value. */
3020-time_t
3021-mktime (struct tm *tp)
3022-{
3023-#ifdef _LIBC
3024- /* POSIX.1 8.1.1 requires that whenever mktime() is called, the
3025- time zone names contained in the external variable `tzname' shall
3026- be set as if the tzset() function had been called. */
3027- __tzset ();
3028-#endif
3029-
3030- return __mktime_internal (tp, __localtime_r, &localtime_offset);
3031-}
3032-
3033-#ifdef weak_alias
3034-weak_alias (mktime, timelocal)
3035-#endif
3036-
3037-#ifdef _LIBC
3038-libc_hidden_def (mktime)
3039-libc_hidden_weak (timelocal)
3040-#endif
3041
3042=== removed file 'gnulib/time.in.h'
3043--- gnulib/time.in.h 2009-07-28 00:45:16 +0000
3044+++ gnulib/time.in.h 1970-01-01 00:00:00 +0000
3045@@ -1,124 +0,0 @@
3046-/* A more-standard <time.h>.
3047-
3048- Copyright (C) 2007-2008 Free Software Foundation, Inc.
3049-
3050- This program is free software; you can redistribute it and/or modify
3051- it under the terms of the GNU Lesser General Public License as published by
3052- the Free Software Foundation; either version 2, or (at your option)
3053- any later version.
3054-
3055- This program is distributed in the hope that it will be useful,
3056- but WITHOUT ANY WARRANTY; without even the implied warranty of
3057- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3058- GNU Lesser General Public License for more details.
3059-
3060- You should have received a copy of the GNU Lesser General Public License
3061- along with this program; if not, write to the Free Software Foundation,
3062- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
3063-
3064-#if __GNUC__ >= 3
3065-@PRAGMA_SYSTEM_HEADER@
3066-#endif
3067-
3068-/* Don't get in the way of glibc when it includes time.h merely to
3069- declare a few standard symbols, rather than to declare all the
3070- symbols. Also, Solaris 8 <time.h> eventually includes itself
3071- recursively; if that is happening, just include the system <time.h>
3072- without adding our own declarations. */
3073-#if (defined __need_time_t || defined __need_clock_t \
3074- || defined __need_timespec \
3075- || defined _GL_TIME_H)
3076-
3077-# @INCLUDE_NEXT@ @NEXT_TIME_H@
3078-
3079-#else
3080-
3081-# define _GL_TIME_H
3082-
3083-# @INCLUDE_NEXT@ @NEXT_TIME_H@
3084-
3085-# ifdef __cplusplus
3086-extern "C" {
3087-# endif
3088-
3089-/* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3).
3090- Or they define it with the wrong member names or define it in <sys/time.h>
3091- (e.g., FreeBSD circa 1997). */
3092-# if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@
3093-# if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
3094-# include <sys/time.h>
3095-# else
3096-# undef timespec
3097-# define timespec rpl_timespec
3098-struct timespec
3099-{
3100- time_t tv_sec;
3101- long int tv_nsec;
3102-};
3103-# endif
3104-# endif
3105-
3106-/* Sleep for at least RQTP seconds unless interrupted, If interrupted,
3107- return -1 and store the remaining time into RMTP. See
3108- <http://www.opengroup.org/susv3xsh/nanosleep.html>. */
3109-# if @REPLACE_NANOSLEEP@
3110-# define nanosleep rpl_nanosleep
3111-int nanosleep (struct timespec const *__rqtp, struct timespec *__rmtp);
3112-# endif
3113-
3114-/* Return the 'time_t' representation of TP and normalize TP. */
3115-# if @REPLACE_MKTIME@
3116-# define mktime rpl_mktime
3117-extern time_t mktime (struct tm *__tp);
3118-# endif
3119-
3120-/* Convert TIMER to RESULT, assuming local time and UTC respectively. See
3121- <http://www.opengroup.org/susv3xsh/localtime_r.html> and
3122- <http://www.opengroup.org/susv3xsh/gmtime_r.html>. */
3123-# if @REPLACE_LOCALTIME_R@
3124-# undef localtime_r
3125-# define localtime_r rpl_localtime_r
3126-# undef gmtime_r
3127-# define gmtime_r rpl_gmtime_r
3128-struct tm *localtime_r (time_t const *restrict __timer,
3129- struct tm *restrict __result);
3130-struct tm *gmtime_r (time_t const *restrict __timer,
3131- struct tm *restrict __result);
3132-# endif
3133-
3134-/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
3135- the resulting broken-down time into TM. See
3136- <http://www.opengroup.org/susv3xsh/strptime.html>. */
3137-# if @REPLACE_STRPTIME@
3138-# undef strptime
3139-# define strptime rpl_strptime
3140-char *strptime (char const *restrict __buf, char const *restrict __format,
3141- struct tm *restrict __tm);
3142-# endif
3143-
3144-/* Convert TM to a time_t value, assuming UTC. */
3145-# if @REPLACE_TIMEGM@
3146-# undef timegm
3147-# define timegm rpl_timegm
3148-time_t timegm (struct tm *__tm);
3149-# endif
3150-
3151-/* Encourage applications to avoid unsafe functions that can overrun
3152- buffers when given outlandish struct tm values. Portable
3153- applications should use strftime (or even sprintf) instead. */
3154-# if GNULIB_PORTCHECK
3155-# undef asctime
3156-# define asctime eschew_asctime
3157-# undef asctime_r
3158-# define asctime_r eschew_asctime_r
3159-# undef ctime
3160-# define ctime eschew_ctime
3161-# undef ctime_r
3162-# define ctime_r eschew_ctime_r
3163-# endif
3164-
3165-# ifdef __cplusplus
3166-}
3167-# endif
3168-
3169-#endif
3170
3171=== removed file 'gnulib/time_r.c'
3172--- gnulib/time_r.c 2009-01-29 19:04:39 +0000
3173+++ gnulib/time_r.c 1970-01-01 00:00:00 +0000
3174@@ -1,47 +0,0 @@
3175-/* Reentrant time functions like localtime_r.
3176-
3177- Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc.
3178-
3179- This program is free software; you can redistribute it and/or modify
3180- it under the terms of the GNU Lesser General Public License as published by
3181- the Free Software Foundation; either version 2, or (at your option)
3182- any later version.
3183-
3184- This program is distributed in the hope that it will be useful,
3185- but WITHOUT ANY WARRANTY; without even the implied warranty of
3186- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3187- GNU Lesser General Public License for more details.
3188-
3189- You should have received a copy of the GNU Lesser General Public License along
3190- with this program; if not, write to the Free Software Foundation,
3191- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
3192-
3193-/* Written by Paul Eggert. */
3194-
3195-#include <config.h>
3196-
3197-#include <time.h>
3198-
3199-#include <string.h>
3200-
3201-static struct tm *
3202-copy_tm_result (struct tm *dest, struct tm const *src)
3203-{
3204- if (! src)
3205- return 0;
3206- *dest = *src;
3207- return dest;
3208-}
3209-
3210-
3211-struct tm *
3212-gmtime_r (time_t const * restrict t, struct tm * restrict tp)
3213-{
3214- return copy_tm_result (tp, gmtime (t));
3215-}
3216-
3217-struct tm *
3218-localtime_r (time_t const * restrict t, struct tm * restrict tp)
3219-{
3220- return copy_tm_result (tp, localtime (t));
3221-}
3222
3223=== removed file 'gnulib/timegm.c'
3224--- gnulib/timegm.c 2009-04-18 05:26:04 +0000
3225+++ gnulib/timegm.c 1970-01-01 00:00:00 +0000
3226@@ -1,41 +0,0 @@
3227-/* Convert UTC calendar time to simple time. Like mktime but assumes UTC.
3228-
3229- Copyright (C) 1994, 1997, 2003, 2004, 2006, 2007 Free Software
3230- Foundation, Inc. This file is part of the GNU C Library.
3231-
3232- This program is free software; you can redistribute it and/or modify
3233- it under the terms of the GNU Lesser General Public License as published by
3234- the Free Software Foundation; either version 2, or (at your option)
3235- any later version.
3236-
3237- This program is distributed in the hope that it will be useful,
3238- but WITHOUT ANY WARRANTY; without even the implied warranty of
3239- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3240- GNU Lesser General Public License for more details.
3241-
3242- You should have received a copy of the GNU Lesser General Public License
3243- along with this program; if not, write to the Free Software Foundation,
3244- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
3245-
3246-#ifndef _LIBC
3247-# include <config.h>
3248-#endif
3249-
3250-#include <time.h>
3251-
3252-#ifndef _LIBC
3253-# undef __gmtime_r
3254-# define __gmtime_r gmtime_r
3255-# define __mktime_internal mktime_internal
3256-time_t __mktime_internal (struct tm *,
3257- struct tm * (*) (time_t const *, struct tm *),
3258- time_t *);
3259-#endif
3260-
3261-time_t
3262-timegm (struct tm *tmp)
3263-{
3264- static time_t gmtime_offset;
3265- tmp->tm_isdst = 0;
3266- return __mktime_internal (tmp, __gmtime_r, &gmtime_offset);
3267-}
3268
3269=== removed file 'gnulib/unistd.in.h'
3270--- gnulib/unistd.in.h 2009-04-18 05:26:04 +0000
3271+++ gnulib/unistd.in.h 1970-01-01 00:00:00 +0000
3272@@ -1,554 +0,0 @@
3273-/* Substitute for and wrapper around <unistd.h>.
3274- Copyright (C) 2003-2008 Free Software Foundation, Inc.
3275-
3276- This program is free software; you can redistribute it and/or modify
3277- it under the terms of the GNU Lesser General Public License as published by
3278- the Free Software Foundation; either version 2, or (at your option)
3279- any later version.
3280-
3281- This program is distributed in the hope that it will be useful,
3282- but WITHOUT ANY WARRANTY; without even the implied warranty of
3283- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3284- GNU Lesser General Public License for more details.
3285-
3286- You should have received a copy of the GNU Lesser General Public License
3287- along with this program; if not, write to the Free Software Foundation,
3288- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
3289-
3290-#ifndef _GL_UNISTD_H
3291-
3292-#if __GNUC__ >= 3
3293-@PRAGMA_SYSTEM_HEADER@
3294-#endif
3295-
3296-/* The include_next requires a split double-inclusion guard. */
3297-#if @HAVE_UNISTD_H@
3298-# @INCLUDE_NEXT@ @NEXT_UNISTD_H@
3299-#endif
3300-
3301-#ifndef _GL_UNISTD_H
3302-#define _GL_UNISTD_H
3303-
3304-/* mingw doesn't define the SEEK_* macros in <unistd.h>. */
3305-#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET)
3306-# include <stdio.h>
3307-#endif
3308-
3309-/* mingw fails to declare _exit in <unistd.h>. */
3310-/* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>. */
3311-#include <stdlib.h>
3312-
3313-#if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
3314-/* Get ssize_t. */
3315-# include <sys/types.h>
3316-#endif
3317-
3318-#if @GNULIB_GETHOSTNAME@
3319-/* Get all possible declarations of gethostname(). */
3320-# if @UNISTD_H_HAVE_WINSOCK2_H@
3321-# include <winsock2.h>
3322-# if !defined _GL_SYS_SOCKET_H
3323-# undef socket
3324-# define socket socket_used_without_including_sys_socket_h
3325-# undef connect
3326-# define connect connect_used_without_including_sys_socket_h
3327-# undef accept
3328-# define accept accept_used_without_including_sys_socket_h
3329-# undef bind
3330-# define bind bind_used_without_including_sys_socket_h
3331-# undef getpeername
3332-# define getpeername getpeername_used_without_including_sys_socket_h
3333-# undef getsockname
3334-# define getsockname getsockname_used_without_including_sys_socket_h
3335-# undef getsockopt
3336-# define getsockopt getsockopt_used_without_including_sys_socket_h
3337-# undef listen
3338-# define listen listen_used_without_including_sys_socket_h
3339-# undef recv
3340-# define recv recv_used_without_including_sys_socket_h
3341-# undef send
3342-# define send send_used_without_including_sys_socket_h
3343-# undef recvfrom
3344-# define recvfrom recvfrom_used_without_including_sys_socket_h
3345-# undef sendto
3346-# define sendto sendto_used_without_including_sys_socket_h
3347-# undef setsockopt
3348-# define setsockopt setsockopt_used_without_including_sys_socket_h
3349-# undef shutdown
3350-# define shutdown shutdown_used_without_including_sys_socket_h
3351-# endif
3352-# if !defined _GL_SYS_SELECT_H
3353-# undef select
3354-# define select select_used_without_including_sys_select_h
3355-# endif
3356-# endif
3357-#endif
3358-
3359-/* The definition of GL_LINK_WARNING is copied here. */
3360-
3361-
3362-/* Declare overridden functions. */
3363-
3364-#ifdef __cplusplus
3365-extern "C" {
3366-#endif
3367-
3368-
3369-#if @GNULIB_CHOWN@
3370-# if @REPLACE_CHOWN@
3371-# ifndef REPLACE_CHOWN
3372-# define REPLACE_CHOWN 1
3373-# endif
3374-# if REPLACE_CHOWN
3375-/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
3376- to GID (if GID is not -1). Follow symbolic links.
3377- Return 0 if successful, otherwise -1 and errno set.
3378- See the POSIX:2001 specification
3379- <http://www.opengroup.org/susv3xsh/chown.html>. */
3380-# define chown rpl_chown
3381-extern int chown (const char *file, uid_t uid, gid_t gid);
3382-# endif
3383-# endif
3384-#elif defined GNULIB_POSIXCHECK
3385-# undef chown
3386-# define chown(f,u,g) \
3387- (GL_LINK_WARNING ("chown fails to follow symlinks on some systems and " \
3388- "doesn't treat a uid or gid of -1 on some systems - " \
3389- "use gnulib module chown for portability"), \
3390- chown (f, u, g))
3391-#endif
3392-
3393-
3394-#if @GNULIB_CLOSE@
3395-# if @UNISTD_H_HAVE_WINSOCK2_H@
3396-/* Need a gnulib internal function. */
3397-# define HAVE__GL_CLOSE_FD_MAYBE_SOCKET 1
3398-# endif
3399-# if @REPLACE_CLOSE@
3400-/* Automatically included by modules that need a replacement for close. */
3401-# undef close
3402-# define close rpl_close
3403-extern int close (int);
3404-# endif
3405-#elif @UNISTD_H_HAVE_WINSOCK2_H@
3406-# undef close
3407-# define close close_used_without_requesting_gnulib_module_close
3408-#elif defined GNULIB_POSIXCHECK
3409-# undef close
3410-# define close(f) \
3411- (GL_LINK_WARNING ("close does not portably work on sockets - " \
3412- "use gnulib module close for portability"), \
3413- close (f))
3414-#endif
3415-
3416-
3417-#if @GNULIB_DUP2@
3418-# if !@HAVE_DUP2@
3419-/* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
3420- NEWFD = OLDFD, otherwise close NEWFD first if it is open.
3421- Return 0 if successful, otherwise -1 and errno set.
3422- See the POSIX:2001 specification
3423- <http://www.opengroup.org/susv3xsh/dup2.html>. */
3424-extern int dup2 (int oldfd, int newfd);
3425-# endif
3426-#elif defined GNULIB_POSIXCHECK
3427-# undef dup2
3428-# define dup2(o,n) \
3429- (GL_LINK_WARNING ("dup2 is unportable - " \
3430- "use gnulib module dup2 for portability"), \
3431- dup2 (o, n))
3432-#endif
3433-
3434-
3435-#if @GNULIB_ENVIRON@
3436-# if !@HAVE_DECL_ENVIRON@
3437-/* Set of environment variables and values. An array of strings of the form
3438- "VARIABLE=VALUE", terminated with a NULL. */
3439-# if defined __APPLE__ && defined __MACH__
3440-# include <crt_externs.h>
3441-# define environ (*_NSGetEnviron ())
3442-# else
3443-extern char **environ;
3444-# endif
3445-# endif
3446-#elif defined GNULIB_POSIXCHECK
3447-# undef environ
3448-# define environ \
3449- (GL_LINK_WARNING ("environ is unportable - " \
3450- "use gnulib module environ for portability"), \
3451- environ)
3452-#endif
3453-
3454-
3455-#if @GNULIB_EUIDACCESS@
3456-# if !@HAVE_EUIDACCESS@
3457-/* Like access(), except that is uses the effective user id and group id of
3458- the current process. */
3459-extern int euidaccess (const char *filename, int mode);
3460-# endif
3461-#elif defined GNULIB_POSIXCHECK
3462-# undef euidaccess
3463-# define euidaccess(f,m) \
3464- (GL_LINK_WARNING ("euidaccess is unportable - " \
3465- "use gnulib module euidaccess for portability"), \
3466- euidaccess (f, m))
3467-#endif
3468-
3469-
3470-#if @GNULIB_FCHDIR@
3471-# if @REPLACE_FCHDIR@
3472-
3473-/* Change the process' current working directory to the directory on which
3474- the given file descriptor is open.
3475- Return 0 if successful, otherwise -1 and errno set.
3476- See the POSIX:2001 specification
3477- <http://www.opengroup.org/susv3xsh/fchdir.html>. */
3478-extern int fchdir (int /*fd*/);
3479-
3480-# define dup rpl_dup
3481-extern int dup (int);
3482-# define dup2 rpl_dup2
3483-extern int dup2 (int, int);
3484-
3485-# endif
3486-#elif defined GNULIB_POSIXCHECK
3487-# undef fchdir
3488-# define fchdir(f) \
3489- (GL_LINK_WARNING ("fchdir is unportable - " \
3490- "use gnulib module fchdir for portability"), \
3491- fchdir (f))
3492-#endif
3493-
3494-
3495-#if @GNULIB_FSYNC@
3496-/* Synchronize changes to a file.
3497- Return 0 if successful, otherwise -1 and errno set.
3498- See POSIX:2001 specification
3499- <http://www.opengroup.org/susv3xsh/fsync.html>. */
3500-# if !@HAVE_FSYNC@
3501-extern int fsync (int fd);
3502-# endif
3503-#elif defined GNULIB_POSIXCHECK
3504-# undef fsync
3505-# define fsync(fd) \
3506- (GL_LINK_WARNING ("fsync is unportable - " \
3507- "use gnulib module fsync for portability"), \
3508- fsync (fd))
3509-#endif
3510-
3511-
3512-#if @GNULIB_FTRUNCATE@
3513-# if !@HAVE_FTRUNCATE@
3514-/* Change the size of the file to which FD is opened to become equal to LENGTH.
3515- Return 0 if successful, otherwise -1 and errno set.
3516- See the POSIX:2001 specification
3517- <http://www.opengroup.org/susv3xsh/ftruncate.html>. */
3518-extern int ftruncate (int fd, off_t length);
3519-# endif
3520-#elif defined GNULIB_POSIXCHECK
3521-# undef ftruncate
3522-# define ftruncate(f,l) \
3523- (GL_LINK_WARNING ("ftruncate is unportable - " \
3524- "use gnulib module ftruncate for portability"), \
3525- ftruncate (f, l))
3526-#endif
3527-
3528-
3529-#if @GNULIB_GETCWD@
3530-/* Include the headers that might declare getcwd so that they will not
3531- cause confusion if included after this file. */
3532-# include <stdlib.h>
3533-# if @REPLACE_GETCWD@
3534-/* Get the name of the current working directory, and put it in SIZE bytes
3535- of BUF.
3536- Return BUF if successful, or NULL if the directory couldn't be determined
3537- or SIZE was too small.
3538- See the POSIX:2001 specification
3539- <http://www.opengroup.org/susv3xsh/getcwd.html>.
3540- Additionally, the gnulib module 'getcwd' guarantees the following GNU
3541- extension: If BUF is NULL, an array is allocated with 'malloc'; the array
3542- is SIZE bytes long, unless SIZE == 0, in which case it is as big as
3543- necessary. */
3544-# define getcwd rpl_getcwd
3545-extern char * getcwd (char *buf, size_t size);
3546-# endif
3547-#elif defined GNULIB_POSIXCHECK
3548-# undef getcwd
3549-# define getcwd(b,s) \
3550- (GL_LINK_WARNING ("getcwd is unportable - " \
3551- "use gnulib module getcwd for portability"), \
3552- getcwd (b, s))
3553-#endif
3554-
3555-
3556-#if @GNULIB_GETDOMAINNAME@
3557-/* Return the NIS domain name of the machine.
3558- WARNING! The NIS domain name is unrelated to the fully qualified host name
3559- of the machine. It is also unrelated to email addresses.
3560- WARNING! The NIS domain name is usually the empty string or "(none)" when
3561- not using NIS.
3562-
3563- Put up to LEN bytes of the NIS domain name into NAME.
3564- Null terminate it if the name is shorter than LEN.
3565- If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
3566- Return 0 if successful, otherwise set errno and return -1. */
3567-# if !@HAVE_GETDOMAINNAME@
3568-extern int getdomainname(char *name, size_t len);
3569-# endif
3570-#elif defined GNULIB_POSIXCHECK
3571-# undef getdomainname
3572-# define getdomainname(n,l) \
3573- (GL_LINK_WARNING ("getdomainname is unportable - " \
3574- "use gnulib module getdomainname for portability"), \
3575- getdomainname (n, l))
3576-#endif
3577-
3578-
3579-#if @GNULIB_GETDTABLESIZE@
3580-# if !@HAVE_GETDTABLESIZE@
3581-/* Return the maximum number of file descriptors in the current process. */
3582-extern int getdtablesize (void);
3583-# endif
3584-#elif defined GNULIB_POSIXCHECK
3585-# undef getdtablesize
3586-# define getdtablesize() \
3587- (GL_LINK_WARNING ("getdtablesize is unportable - " \
3588- "use gnulib module getdtablesize for portability"), \
3589- getdtablesize ())
3590-#endif
3591-
3592-
3593-#if @GNULIB_GETHOSTNAME@
3594-/* Return the standard host name of the machine.
3595- WARNING! The host name may or may not be fully qualified.
3596-
3597- Put up to LEN bytes of the host name into NAME.
3598- Null terminate it if the name is shorter than LEN.
3599- If the host name is longer than LEN, set errno = EINVAL and return -1.
3600- Return 0 if successful, otherwise set errno and return -1. */
3601-# if @UNISTD_H_HAVE_WINSOCK2_H@
3602-# undef gethostname
3603-# define gethostname rpl_gethostname
3604-# endif
3605-# if @UNISTD_H_HAVE_WINSOCK2_H@ || !@HAVE_GETHOSTNAME@
3606-extern int gethostname(char *name, size_t len);
3607-# endif
3608-#elif @UNISTD_H_HAVE_WINSOCK2_H@
3609-# undef gethostname
3610-# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
3611-#elif defined GNULIB_POSIXCHECK
3612-# undef gethostname
3613-# define gethostname(n,l) \
3614- (GL_LINK_WARNING ("gethostname is unportable - " \
3615- "use gnulib module gethostname for portability"), \
3616- gethostname (n, l))
3617-#endif
3618-
3619-
3620-#if @GNULIB_GETLOGIN_R@
3621-/* Copies the user's login name to NAME.
3622- The array pointed to by NAME has room for SIZE bytes.
3623-
3624- Returns 0 if successful. Upon error, an error number is returned, or -1 in
3625- the case that the login name cannot be found but no specific error is
3626- provided (this case is hopefully rare but is left open by the POSIX spec).
3627-
3628- See <http://www.opengroup.org/susv3xsh/getlogin.html>.
3629- */
3630-# if !@HAVE_DECL_GETLOGIN_R@
3631-# include <stddef.h>
3632-extern int getlogin_r (char *name, size_t size);
3633-# endif
3634-#elif defined GNULIB_POSIXCHECK
3635-# undef getlogin_r
3636-# define getlogin_r(n,s) \
3637- (GL_LINK_WARNING ("getlogin_r is unportable - " \
3638- "use gnulib module getlogin_r for portability"), \
3639- getlogin_r (n, s))
3640-#endif
3641-
3642-
3643-#if @GNULIB_GETPAGESIZE@
3644-# if @REPLACE_GETPAGESIZE@
3645-# define getpagesize rpl_getpagesize
3646-extern int getpagesize (void);
3647-# elif !@HAVE_GETPAGESIZE@
3648-/* This is for POSIX systems. */
3649-# if !defined getpagesize && defined _SC_PAGESIZE
3650-# if ! (defined __VMS && __VMS_VER < 70000000)
3651-# define getpagesize() sysconf (_SC_PAGESIZE)
3652-# endif
3653-# endif
3654-/* This is for older VMS. */
3655-# if !defined getpagesize && defined __VMS
3656-# ifdef __ALPHA
3657-# define getpagesize() 8192
3658-# else
3659-# define getpagesize() 512
3660-# endif
3661-# endif
3662-/* This is for BeOS. */
3663-# if !defined getpagesize && @HAVE_OS_H@
3664-# include <OS.h>
3665-# if defined B_PAGE_SIZE
3666-# define getpagesize() B_PAGE_SIZE
3667-# endif
3668-# endif
3669-/* This is for AmigaOS4.0. */
3670-# if !defined getpagesize && defined __amigaos4__
3671-# define getpagesize() 2048
3672-# endif
3673-/* This is for older Unix systems. */
3674-# if !defined getpagesize && @HAVE_SYS_PARAM_H@
3675-# include <sys/param.h>
3676-# ifdef EXEC_PAGESIZE
3677-# define getpagesize() EXEC_PAGESIZE
3678-# else
3679-# ifdef NBPG
3680-# ifndef CLSIZE
3681-# define CLSIZE 1
3682-# endif
3683-# define getpagesize() (NBPG * CLSIZE)
3684-# else
3685-# ifdef NBPC
3686-# define getpagesize() NBPC
3687-# endif
3688-# endif
3689-# endif
3690-# endif
3691-# endif
3692-#elif defined GNULIB_POSIXCHECK
3693-# undef getpagesize
3694-# define getpagesize() \
3695- (GL_LINK_WARNING ("getpagesize is unportable - " \
3696- "use gnulib module getpagesize for portability"), \
3697- getpagesize ())
3698-#endif
3699-
3700-
3701-#if @GNULIB_GETUSERSHELL@
3702-# if !@HAVE_GETUSERSHELL@
3703-/* Return the next valid login shell on the system, or NULL when the end of
3704- the list has been reached. */
3705-extern char *getusershell (void);
3706-/* Rewind to pointer that is advanced at each getusershell() call. */
3707-extern void setusershell (void);
3708-/* Free the pointer that is advanced at each getusershell() call and
3709- associated resources. */
3710-extern void endusershell (void);
3711-# endif
3712-#elif defined GNULIB_POSIXCHECK
3713-# undef getusershell
3714-# define getusershell() \
3715- (GL_LINK_WARNING ("getusershell is unportable - " \
3716- "use gnulib module getusershell for portability"), \
3717- getusershell ())
3718-# undef setusershell
3719-# define setusershell() \
3720- (GL_LINK_WARNING ("setusershell is unportable - " \
3721- "use gnulib module getusershell for portability"), \
3722- setusershell ())
3723-# undef endusershell
3724-# define endusershell() \
3725- (GL_LINK_WARNING ("endusershell is unportable - " \
3726- "use gnulib module getusershell for portability"), \
3727- endusershell ())
3728-#endif
3729-
3730-
3731-#if @GNULIB_LCHOWN@
3732-# if @REPLACE_LCHOWN@
3733-/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
3734- to GID (if GID is not -1). Do not follow symbolic links.
3735- Return 0 if successful, otherwise -1 and errno set.
3736- See the POSIX:2001 specification
3737- <http://www.opengroup.org/susv3xsh/lchown.html>. */
3738-# define lchown rpl_lchown
3739-extern int lchown (char const *file, uid_t owner, gid_t group);
3740-# endif
3741-#elif defined GNULIB_POSIXCHECK
3742-# undef lchown
3743-# define lchown(f,u,g) \
3744- (GL_LINK_WARNING ("lchown is unportable to pre-POSIX.1-2001 " \
3745- "systems - use gnulib module lchown for portability"), \
3746- lchown (f, u, g))
3747-#endif
3748-
3749-
3750-#if @GNULIB_LSEEK@
3751-# if @REPLACE_LSEEK@
3752-/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
3753- Return the new offset if successful, otherwise -1 and errno set.
3754- See the POSIX:2001 specification
3755- <http://www.opengroup.org/susv3xsh/lseek.html>. */
3756-# define lseek rpl_lseek
3757- extern off_t lseek (int fd, off_t offset, int whence);
3758-# endif
3759-#elif defined GNULIB_POSIXCHECK
3760-# undef lseek
3761-# define lseek(f,o,w) \
3762- (GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \
3763- "systems - use gnulib module lseek for portability"), \
3764- lseek (f, o, w))
3765-#endif
3766-
3767-
3768-#if @GNULIB_READLINK@
3769-/* Read the contents of the symbolic link FILE and place the first BUFSIZE
3770- bytes of it into BUF. Return the number of bytes placed into BUF if
3771- successful, otherwise -1 and errno set.
3772- See the POSIX:2001 specification
3773- <http://www.opengroup.org/susv3xsh/readlink.html>. */
3774-# if !@HAVE_READLINK@
3775-# include <stddef.h>
3776-extern int readlink (const char *file, char *buf, size_t bufsize);
3777-# endif
3778-#elif defined GNULIB_POSIXCHECK
3779-# undef readlink
3780-# define readlink(f,b,s) \
3781- (GL_LINK_WARNING ("readlink is unportable - " \
3782- "use gnulib module readlink for portability"), \
3783- readlink (f, b, s))
3784-#endif
3785-
3786-
3787-#if @GNULIB_SLEEP@
3788-/* Pause the execution of the current thread for N seconds.
3789- Returns the number of seconds left to sleep.
3790- See the POSIX:2001 specification
3791- <http://www.opengroup.org/susv3xsh/sleep.html>. */
3792-# if !@HAVE_SLEEP@
3793-extern unsigned int sleep (unsigned int n);
3794-# endif
3795-#elif defined GNULIB_POSIXCHECK
3796-# undef sleep
3797-# define sleep(n) \
3798- (GL_LINK_WARNING ("sleep is unportable - " \
3799- "use gnulib module sleep for portability"), \
3800- sleep (n))
3801-#endif
3802-
3803-
3804-#if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
3805-/* Write up to COUNT bytes starting at BUF to file descriptor FD.
3806- See the POSIX:2001 specification
3807- <http://www.opengroup.org/susv3xsh/write.html>. */
3808-# undef write
3809-# define write rpl_write
3810-extern ssize_t write (int fd, const void *buf, size_t count);
3811-#endif
3812-
3813-
3814-#ifdef FCHDIR_REPLACEMENT
3815-/* gnulib internal function. */
3816-extern void _gl_unregister_fd (int fd);
3817-#endif
3818-
3819-
3820-#ifdef __cplusplus
3821-}
3822-#endif
3823-
3824-
3825-#endif /* _GL_UNISTD_H */
3826-#endif /* _GL_UNISTD_H */
3827
3828=== removed file 'm4/getopt.m4'
3829--- m4/getopt.m4 2009-01-29 19:22:08 +0000
3830+++ m4/getopt.m4 1970-01-01 00:00:00 +0000
3831@@ -1,83 +0,0 @@
3832-# getopt.m4 serial 14
3833-dnl Copyright (C) 2002-2006, 2008 Free Software Foundation, Inc.
3834-dnl This file is free software; the Free Software Foundation
3835-dnl gives unlimited permission to copy and/or distribute it,
3836-dnl with or without modifications, as long as this notice is preserved.
3837-
3838-# The getopt module assume you want GNU getopt, with getopt_long etc,
3839-# rather than vanilla POSIX getopt. This means your code should
3840-# always include <getopt.h> for the getopt prototypes.
3841-
3842-AC_DEFUN([gl_GETOPT_SUBSTITUTE],
3843-[
3844- AC_LIBOBJ([getopt])
3845- AC_LIBOBJ([getopt1])
3846- gl_GETOPT_SUBSTITUTE_HEADER
3847- gl_PREREQ_GETOPT
3848-])
3849-
3850-AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
3851-[
3852- GETOPT_H=getopt.h
3853- AC_DEFINE([__GETOPT_PREFIX], [[rpl_]],
3854- [Define to rpl_ if the getopt replacement functions and variables
3855- should be used.])
3856- AC_SUBST([GETOPT_H])
3857-])
3858-
3859-AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
3860-[
3861- if test -z "$GETOPT_H"; then
3862- AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h])
3863- fi
3864-
3865- if test -z "$GETOPT_H"; then
3866- AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h])
3867- fi
3868-
3869- dnl BSD getopt_long uses an incompatible method to reset option processing,
3870- dnl and (as of 2004-10-15) mishandles optional option-arguments.
3871- if test -z "$GETOPT_H"; then
3872- AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include <getopt.h>])
3873- fi
3874-
3875- dnl Solaris 10 getopt doesn't handle `+' as a leading character in an
3876- dnl option string (as of 2005-05-05).
3877- if test -z "$GETOPT_H"; then
3878- AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_gnu_getopt],
3879- [AC_RUN_IFELSE(
3880- [AC_LANG_PROGRAM([[#include <getopt.h>]],
3881- [[
3882- char *myargv[3];
3883- myargv[0] = "conftest";
3884- myargv[1] = "-+";
3885- myargv[2] = 0;
3886- return getopt (2, myargv, "+a") != '?';
3887- ]])],
3888- [gl_cv_func_gnu_getopt=yes],
3889- [gl_cv_func_gnu_getopt=no],
3890- [dnl cross compiling - pessimistically guess based on decls
3891- dnl Solaris 10 getopt doesn't handle `+' as a leading character in an
3892- dnl option string (as of 2005-05-05).
3893- AC_CHECK_DECL([getopt_clip],
3894- [gl_cv_func_gnu_getopt=no], [gl_cv_func_gnu_getopt=yes],
3895- [#include <getopt.h>])])])
3896- if test "$gl_cv_func_gnu_getopt" = "no"; then
3897- GETOPT_H=getopt.h
3898- fi
3899- fi
3900-])
3901-
3902-AC_DEFUN([gl_GETOPT_IFELSE],
3903-[
3904- AC_REQUIRE([gl_GETOPT_CHECK_HEADERS])
3905- AS_IF([test -n "$GETOPT_H"], [$1], [$2])
3906-])
3907-
3908-AC_DEFUN([gl_GETOPT], [gl_GETOPT_IFELSE([gl_GETOPT_SUBSTITUTE])])
3909-
3910-# Prerequisites of lib/getopt*.
3911-AC_DEFUN([gl_PREREQ_GETOPT],
3912-[
3913- AC_CHECK_DECLS_ONCE([getenv])
3914-])
3915
3916=== removed file 'm4/gnulib-cache.m4'
3917--- m4/gnulib-cache.m4 2009-04-18 05:26:04 +0000
3918+++ m4/gnulib-cache.m4 1970-01-01 00:00:00 +0000
3919@@ -1,37 +0,0 @@
3920-# Copyright (C) 2002-2008 Free Software Foundation, Inc.
3921-#
3922-# This file is free software, distributed under the terms of the GNU
3923-# General Public License. As a special exception to the GNU General
3924-# Public License, this file may be distributed as part of a program
3925-# that contains a configuration script generated by Autoconf, under
3926-# the same distribution terms as the rest of that program.
3927-#
3928-# Generated by gnulib-tool.
3929-#
3930-# This file represents the specification of how gnulib-tool is used.
3931-# It acts as a cache: It is written and read by gnulib-tool.
3932-# In projects using CVS, this file is meant to be stored in CVS,
3933-# like the configure.ac and various Makefile.am files.
3934-
3935-
3936-# Specification in the form of a command-line invocation:
3937-# gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=config --lgpl --libtool --macro-prefix=gl getopt timegm
3938-
3939-# Specification in the form of a few gnulib-tool.m4 macro invocations:
3940-gl_LOCAL_DIR([])
3941-gl_MODULES([
3942- getopt
3943- timegm
3944-])
3945-gl_AVOID([])
3946-gl_SOURCE_BASE([gnulib])
3947-gl_M4_BASE([m4])
3948-gl_PO_BASE([])
3949-gl_DOC_BASE([doc])
3950-gl_TESTS_BASE([tests])
3951-gl_LIB([libgnu])
3952-gl_LGPL
3953-gl_MAKEFILE_NAME([])
3954-gl_LIBTOOL
3955-gl_MACRO_PREFIX([gl])
3956-gl_PO_DOMAIN([])
3957
3958=== removed file 'm4/gnulib-common.m4'
3959--- m4/gnulib-common.m4 2009-04-18 05:26:04 +0000
3960+++ m4/gnulib-common.m4 1970-01-01 00:00:00 +0000
3961@@ -1,101 +0,0 @@
3962-# gnulib-common.m4 serial 6
3963-dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
3964-dnl This file is free software; the Free Software Foundation
3965-dnl gives unlimited permission to copy and/or distribute it,
3966-dnl with or without modifications, as long as this notice is preserved.
3967-
3968-# gl_COMMON
3969-# is expanded unconditionally through gnulib-tool magic.
3970-AC_DEFUN([gl_COMMON], [
3971- dnl Use AC_REQUIRE here, so that the code is expanded once only.
3972- AC_REQUIRE([gl_COMMON_BODY])
3973-])
3974-AC_DEFUN([gl_COMMON_BODY], [
3975- AH_VERBATIM([isoc99_inline],
3976-[/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
3977- the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of
3978- earlier versions), but does not display it by setting __GNUC_STDC_INLINE__.
3979- __APPLE__ && __MACH__ test for MacOS X.
3980- __APPLE_CC__ tests for the Apple compiler and its version.
3981- __STDC_VERSION__ tests for the C99 mode. */
3982-#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
3983-# define __GNUC_STDC_INLINE__ 1
3984-#endif])
3985- AH_VERBATIM([unused_parameter],
3986-[/* Define as a marker that can be attached to function parameter declarations
3987- for parameters that are not used. This helps to reduce warnings, such as
3988- from GCC -Wunused-parameter. */
3989-#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
3990-# define _UNUSED_PARAMETER_ __attribute__ ((__unused__))
3991-#else
3992-# define _UNUSED_PARAMETER_
3993-#endif
3994-])
3995-])
3996-
3997-# gl_MODULE_INDICATOR([modulename])
3998-# defines a C macro indicating the presence of the given module.
3999-AC_DEFUN([gl_MODULE_INDICATOR],
4000-[
4001- AC_DEFINE([GNULIB_]translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1],
4002- [Define to 1 when using the gnulib module ]$1[.])
4003-])
4004-
4005-# m4_foreach_w
4006-# is a backport of autoconf-2.59c's m4_foreach_w.
4007-# Remove this macro when we can assume autoconf >= 2.60.
4008-m4_ifndef([m4_foreach_w],
4009- [m4_define([m4_foreach_w],
4010- [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
4011-
4012-# AC_PROG_MKDIR_P
4013-# is a backport of autoconf-2.60's AC_PROG_MKDIR_P.
4014-# Remove this macro when we can assume autoconf >= 2.60.
4015-m4_ifdef([AC_PROG_MKDIR_P], [], [
4016- AC_DEFUN([AC_PROG_MKDIR_P],
4017- [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
4018- MKDIR_P='$(mkdir_p)'
4019- AC_SUBST([MKDIR_P])])])
4020-
4021-# AC_C_RESTRICT
4022-# This definition overrides the AC_C_RESTRICT macro from autoconf 2.60..2.61,
4023-# so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++
4024-# works.
4025-# This definition can be removed once autoconf >= 2.62 can be assumed.
4026-AC_DEFUN([AC_C_RESTRICT],
4027-[AC_CACHE_CHECK([for C/C++ restrict keyword], ac_cv_c_restrict,
4028- [ac_cv_c_restrict=no
4029- # The order here caters to the fact that C++ does not require restrict.
4030- for ac_kw in __restrict __restrict__ _Restrict restrict; do
4031- AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
4032- [[typedef int * int_ptr;
4033- int foo (int_ptr $ac_kw ip) {
4034- return ip[0];
4035- }]],
4036- [[int s[1];
4037- int * $ac_kw t = s;
4038- t[0] = 0;
4039- return foo(t)]])],
4040- [ac_cv_c_restrict=$ac_kw])
4041- test "$ac_cv_c_restrict" != no && break
4042- done
4043- ])
4044- AH_VERBATIM([restrict],
4045-[/* Define to the equivalent of the C99 'restrict' keyword, or to
4046- nothing if this is not supported. Do not define if restrict is
4047- supported directly. */
4048-#undef restrict
4049-/* Work around a bug in Sun C++: it does not support _Restrict, even
4050- though the corresponding Sun C compiler does, which causes
4051- "#define restrict _Restrict" in the previous line. Perhaps some future
4052- version of Sun C++ will work with _Restrict; if so, it'll probably
4053- define __RESTRICT, just as Sun C does. */
4054-#if defined __SUNPRO_CC && !defined __RESTRICT
4055-# define _Restrict
4056-#endif])
4057- case $ac_cv_c_restrict in
4058- restrict) ;;
4059- no) AC_DEFINE([restrict], []) ;;
4060- *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
4061- esac
4062-])
4063
4064=== removed file 'm4/gnulib-comp.m4'
4065--- m4/gnulib-comp.m4 2009-04-18 05:26:04 +0000
4066+++ m4/gnulib-comp.m4 1970-01-01 00:00:00 +0000
4067@@ -1,202 +0,0 @@
4068-# DO NOT EDIT! GENERATED AUTOMATICALLY!
4069-# Copyright (C) 2002-2008 Free Software Foundation, Inc.
4070-#
4071-# This file is free software, distributed under the terms of the GNU
4072-# General Public License. As a special exception to the GNU General
4073-# Public License, this file may be distributed as part of a program
4074-# that contains a configuration script generated by Autoconf, under
4075-# the same distribution terms as the rest of that program.
4076-#
4077-# Generated by gnulib-tool.
4078-#
4079-# This file represents the compiled summary of the specification in
4080-# gnulib-cache.m4. It lists the computed macro invocations that need
4081-# to be invoked from configure.ac.
4082-# In projects using CVS, this file can be treated like other built files.
4083-
4084-
4085-# This macro should be invoked from ./configure.ac, in the section
4086-# "Checks for programs", right after AC_PROG_CC, and certainly before
4087-# any checks for libraries, header files, types and library functions.
4088-AC_DEFUN([gl_EARLY],
4089-[
4090- m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace
4091- m4_pattern_allow([^gl_ES$])dnl a valid locale name
4092- m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
4093- m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
4094- AC_REQUIRE([AC_PROG_RANLIB])
4095- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
4096-])
4097-
4098-# This macro should be invoked from ./configure.ac, in the section
4099-# "Check for header files, types and library functions".
4100-AC_DEFUN([gl_INIT],
4101-[
4102- AM_CONDITIONAL([GL_COND_LIBTOOL], [true])
4103- gl_cond_libtool=true
4104- m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ]))
4105- m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS]))
4106- m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES]))
4107- m4_pushdef([gl_LIBSOURCES_LIST], [])
4108- m4_pushdef([gl_LIBSOURCES_DIR], [])
4109- gl_COMMON
4110- gl_source_base='gnulib'
4111- gl_GETOPT
4112- AC_SUBST([LIBINTL])
4113- AC_SUBST([LTLIBINTL])
4114- gl_FUNC_MKTIME
4115- gl_HEADER_TIME_H
4116- gl_TIME_R
4117- gl_FUNC_TIMEGM
4118- gl_UNISTD_H
4119- m4_ifval(gl_LIBSOURCES_LIST, [
4120- m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ ||
4121- for gl_file in ]gl_LIBSOURCES_LIST[ ; do
4122- if test ! -r ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file ; then
4123- echo "missing file ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file" >&2
4124- exit 1
4125- fi
4126- done])dnl
4127- m4_if(m4_sysval, [0], [],
4128- [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])
4129- ])
4130- m4_popdef([gl_LIBSOURCES_DIR])
4131- m4_popdef([gl_LIBSOURCES_LIST])
4132- m4_popdef([AC_LIBSOURCES])
4133- m4_popdef([AC_REPLACE_FUNCS])
4134- m4_popdef([AC_LIBOBJ])
4135- AC_CONFIG_COMMANDS_PRE([
4136- gl_libobjs=
4137- gl_ltlibobjs=
4138- if test -n "$gl_LIBOBJS"; then
4139- # Remove the extension.
4140- sed_drop_objext='s/\.o$//;s/\.obj$//'
4141- for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do
4142- gl_libobjs="$gl_libobjs $i.$ac_objext"
4143- gl_ltlibobjs="$gl_ltlibobjs $i.lo"
4144- done
4145- fi
4146- AC_SUBST([gl_LIBOBJS], [$gl_libobjs])
4147- AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs])
4148- ])
4149- gltests_libdeps=
4150- gltests_ltlibdeps=
4151- m4_pushdef([AC_LIBOBJ], m4_defn([gltests_LIBOBJ]))
4152- m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gltests_REPLACE_FUNCS]))
4153- m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES]))
4154- m4_pushdef([gltests_LIBSOURCES_LIST], [])
4155- m4_pushdef([gltests_LIBSOURCES_DIR], [])
4156- gl_COMMON
4157- gl_source_base='tests'
4158- m4_ifval(gltests_LIBSOURCES_LIST, [
4159- m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ ||
4160- for gl_file in ]gltests_LIBSOURCES_LIST[ ; do
4161- if test ! -r ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file ; then
4162- echo "missing file ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file" >&2
4163- exit 1
4164- fi
4165- done])dnl
4166- m4_if(m4_sysval, [0], [],
4167- [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])
4168- ])
4169- m4_popdef([gltests_LIBSOURCES_DIR])
4170- m4_popdef([gltests_LIBSOURCES_LIST])
4171- m4_popdef([AC_LIBSOURCES])
4172- m4_popdef([AC_REPLACE_FUNCS])
4173- m4_popdef([AC_LIBOBJ])
4174- AC_CONFIG_COMMANDS_PRE([
4175- gltests_libobjs=
4176- gltests_ltlibobjs=
4177- if test -n "$gltests_LIBOBJS"; then
4178- # Remove the extension.
4179- sed_drop_objext='s/\.o$//;s/\.obj$//'
4180- for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do
4181- gltests_libobjs="$gltests_libobjs $i.$ac_objext"
4182- gltests_ltlibobjs="$gltests_ltlibobjs $i.lo"
4183- done
4184- fi
4185- AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs])
4186- AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs])
4187- ])
4188-])
4189-
4190-# Like AC_LIBOBJ, except that the module name goes
4191-# into gl_LIBOBJS instead of into LIBOBJS.
4192-AC_DEFUN([gl_LIBOBJ], [
4193- AS_LITERAL_IF([$1], [gl_LIBSOURCES([$1.c])])dnl
4194- gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext"
4195-])
4196-
4197-# Like AC_REPLACE_FUNCS, except that the module name goes
4198-# into gl_LIBOBJS instead of into LIBOBJS.
4199-AC_DEFUN([gl_REPLACE_FUNCS], [
4200- m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl
4201- AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)])
4202-])
4203-
4204-# Like AC_LIBSOURCES, except the directory where the source file is
4205-# expected is derived from the gnulib-tool parameterization,
4206-# and alloca is special cased (for the alloca-opt module).
4207-# We could also entirely rely on EXTRA_lib..._SOURCES.
4208-AC_DEFUN([gl_LIBSOURCES], [
4209- m4_foreach([_gl_NAME], [$1], [
4210- m4_if(_gl_NAME, [alloca.c], [], [
4211- m4_define([gl_LIBSOURCES_DIR], [gnulib])
4212- m4_append([gl_LIBSOURCES_LIST], _gl_NAME, [ ])
4213- ])
4214- ])
4215-])
4216-
4217-# Like AC_LIBOBJ, except that the module name goes
4218-# into gltests_LIBOBJS instead of into LIBOBJS.
4219-AC_DEFUN([gltests_LIBOBJ], [
4220- AS_LITERAL_IF([$1], [gltests_LIBSOURCES([$1.c])])dnl
4221- gltests_LIBOBJS="$gltests_LIBOBJS $1.$ac_objext"
4222-])
4223-
4224-# Like AC_REPLACE_FUNCS, except that the module name goes
4225-# into gltests_LIBOBJS instead of into LIBOBJS.
4226-AC_DEFUN([gltests_REPLACE_FUNCS], [
4227- m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl
4228- AC_CHECK_FUNCS([$1], , [gltests_LIBOBJ($ac_func)])
4229-])
4230-
4231-# Like AC_LIBSOURCES, except the directory where the source file is
4232-# expected is derived from the gnulib-tool parameterization,
4233-# and alloca is special cased (for the alloca-opt module).
4234-# We could also entirely rely on EXTRA_lib..._SOURCES.
4235-AC_DEFUN([gltests_LIBSOURCES], [
4236- m4_foreach([_gl_NAME], [$1], [
4237- m4_if(_gl_NAME, [alloca.c], [], [
4238- m4_define([gltests_LIBSOURCES_DIR], [tests])
4239- m4_append([gltests_LIBSOURCES_LIST], _gl_NAME, [ ])
4240- ])
4241- ])
4242-])
4243-
4244-# This macro records the list of files which have been installed by
4245-# gnulib-tool and may be removed by future gnulib-tool invocations.
4246-AC_DEFUN([gl_FILE_LIST], [
4247- build-aux/link-warning.h
4248- lib/dummy.c
4249- lib/getopt.c
4250- lib/getopt.in.h
4251- lib/getopt1.c
4252- lib/getopt_int.h
4253- lib/gettext.h
4254- lib/mktime.c
4255- lib/time.in.h
4256- lib/time_r.c
4257- lib/timegm.c
4258- lib/unistd.in.h
4259- m4/extensions.m4
4260- m4/getopt.m4
4261- m4/gnulib-common.m4
4262- m4/include_next.m4
4263- m4/mktime.m4
4264- m4/onceonly.m4
4265- m4/time_h.m4
4266- m4/time_r.m4
4267- m4/timegm.m4
4268- m4/unistd_h.m4
4269-])
4270
4271=== removed file 'm4/gnulib-tool.m4'
4272--- m4/gnulib-tool.m4 2009-01-29 19:04:39 +0000
4273+++ m4/gnulib-tool.m4 1970-01-01 00:00:00 +0000
4274@@ -1,57 +0,0 @@
4275-# gnulib-tool.m4 serial 2
4276-dnl Copyright (C) 2004-2005 Free Software Foundation, Inc.
4277-dnl This file is free software; the Free Software Foundation
4278-dnl gives unlimited permission to copy and/or distribute it,
4279-dnl with or without modifications, as long as this notice is preserved.
4280-
4281-dnl The following macros need not be invoked explicitly.
4282-dnl Invoking them does nothing except to declare default arguments
4283-dnl for "gnulib-tool --import".
4284-
4285-dnl Usage: gl_LOCAL_DIR([DIR])
4286-AC_DEFUN([gl_LOCAL_DIR], [])
4287-
4288-dnl Usage: gl_MODULES([module1 module2 ...])
4289-AC_DEFUN([gl_MODULES], [])
4290-
4291-dnl Usage: gl_AVOID([module1 module2 ...])
4292-AC_DEFUN([gl_AVOID], [])
4293-
4294-dnl Usage: gl_SOURCE_BASE([DIR])
4295-AC_DEFUN([gl_SOURCE_BASE], [])
4296-
4297-dnl Usage: gl_M4_BASE([DIR])
4298-AC_DEFUN([gl_M4_BASE], [])
4299-
4300-dnl Usage: gl_PO_BASE([DIR])
4301-AC_DEFUN([gl_PO_BASE], [])
4302-
4303-dnl Usage: gl_DOC_BASE([DIR])
4304-AC_DEFUN([gl_DOC_BASE], [])
4305-
4306-dnl Usage: gl_TESTS_BASE([DIR])
4307-AC_DEFUN([gl_TESTS_BASE], [])
4308-
4309-dnl Usage: gl_WITH_TESTS
4310-AC_DEFUN([gl_WITH_TESTS], [])
4311-
4312-dnl Usage: gl_LIB([LIBNAME])
4313-AC_DEFUN([gl_LIB], [])
4314-
4315-dnl Usage: gl_LGPL or gl_LGPL([VERSION])
4316-AC_DEFUN([gl_LGPL], [])
4317-
4318-dnl Usage: gl_MAKEFILE_NAME([FILENAME])
4319-AC_DEFUN([gl_MAKEFILE_NAME], [])
4320-
4321-dnl Usage: gl_LIBTOOL
4322-AC_DEFUN([gl_LIBTOOL], [])
4323-
4324-dnl Usage: gl_MACRO_PREFIX([PREFIX])
4325-AC_DEFUN([gl_MACRO_PREFIX], [])
4326-
4327-dnl Usage: gl_PO_DOMAIN([DOMAIN])
4328-AC_DEFUN([gl_PO_DOMAIN], [])
4329-
4330-dnl Usage: gl_VC_FILES([BOOLEAN])
4331-AC_DEFUN([gl_VC_FILES], [])
4332
4333=== removed file 'm4/include_next.m4'
4334--- m4/include_next.m4 2009-04-18 05:26:04 +0000
4335+++ m4/include_next.m4 1970-01-01 00:00:00 +0000
4336@@ -1,170 +0,0 @@
4337-# include_next.m4 serial 10
4338-dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
4339-dnl This file is free software; the Free Software Foundation
4340-dnl gives unlimited permission to copy and/or distribute it,
4341-dnl with or without modifications, as long as this notice is preserved.
4342-
4343-dnl From Paul Eggert and Derek Price.
4344-
4345-dnl Sets INCLUDE_NEXT and PRAGMA_SYSTEM_HEADER.
4346-dnl
4347-dnl INCLUDE_NEXT expands to 'include_next' if the compiler supports it, or to
4348-dnl 'include' otherwise.
4349-dnl
4350-dnl INCLUDE_NEXT_AS_FIRST_DIRECTIVE expands to 'include_next' if the compiler
4351-dnl supports it in the special case that it is the first include directive in
4352-dnl the given file, or to 'include' otherwise.
4353-dnl
4354-dnl PRAGMA_SYSTEM_HEADER can be used in files that contain #include_next,
4355-dnl so as to avoid GCC warnings when the gcc option -pedantic is used.
4356-dnl '#pragma GCC system_header' has the same effect as if the file was found
4357-dnl through the include search path specified with '-isystem' options (as
4358-dnl opposed to the search path specified with '-I' options). Namely, gcc
4359-dnl does not warn about some things, and on some systems (Solaris and Interix)
4360-dnl __STDC__ evaluates to 0 instead of to 1. The latter is an undesired side
4361-dnl effect; we are therefore careful to use 'defined __STDC__' or '1' instead
4362-dnl of plain '__STDC__'.
4363-
4364-AC_DEFUN([gl_INCLUDE_NEXT],
4365-[
4366- AC_LANG_PREPROC_REQUIRE()
4367- AC_CACHE_CHECK([whether the preprocessor supports include_next],
4368- [gl_cv_have_include_next],
4369- [rm -rf conftestd1a conftestd1b conftestd2
4370- mkdir conftestd1a conftestd1b conftestd2
4371- dnl The include of <stdio.h> is because IBM C 9.0 on AIX 6.1 supports
4372- dnl include_next when used as first preprocessor directive in a file,
4373- dnl but not when preceded by another include directive. Additionally,
4374- dnl with this same compiler, include_next is a no-op when used in a
4375- dnl header file that was included by specifying its absolute file name.
4376- dnl Despite these two bugs, include_next is used in the compiler's
4377- dnl <math.h>. By virtue of the second bug, we need to use include_next
4378- dnl as well in this case.
4379- cat <<EOF > conftestd1a/conftest.h
4380-#define DEFINED_IN_CONFTESTD1
4381-#include_next <conftest.h>
4382-#ifdef DEFINED_IN_CONFTESTD2
4383-int foo;
4384-#else
4385-#error "include_next doesn't work"
4386-#endif
4387-EOF
4388- cat <<EOF > conftestd1b/conftest.h
4389-#define DEFINED_IN_CONFTESTD1
4390-#include <stdio.h>
4391-#include_next <conftest.h>
4392-#ifdef DEFINED_IN_CONFTESTD2
4393-int foo;
4394-#else
4395-#error "include_next doesn't work"
4396-#endif
4397-EOF
4398- cat <<EOF > conftestd2/conftest.h
4399-#ifndef DEFINED_IN_CONFTESTD1
4400-#error "include_next test doesn't work"
4401-#endif
4402-#define DEFINED_IN_CONFTESTD2
4403-EOF
4404- gl_save_CPPFLAGS="$CPPFLAGS"
4405- CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2"
4406- AC_COMPILE_IFELSE([#include <conftest.h>],
4407- [gl_cv_have_include_next=yes],
4408- [CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2"
4409- AC_COMPILE_IFELSE([#include <conftest.h>],
4410- [gl_cv_have_include_next=buggy],
4411- [gl_cv_have_include_next=no])
4412- ])
4413- CPPFLAGS="$gl_save_CPPFLAGS"
4414- rm -rf conftestd1a conftestd1b conftestd2
4415- ])
4416- PRAGMA_SYSTEM_HEADER=
4417- if test $gl_cv_have_include_next = yes; then
4418- INCLUDE_NEXT=include_next
4419- INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next
4420- if test -n "$GCC"; then
4421- PRAGMA_SYSTEM_HEADER='#pragma GCC system_header'
4422- fi
4423- else
4424- if test $gl_cv_have_include_next = buggy; then
4425- INCLUDE_NEXT=include
4426- INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next
4427- else
4428- INCLUDE_NEXT=include
4429- INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include
4430- fi
4431- fi
4432- AC_SUBST([INCLUDE_NEXT])
4433- AC_SUBST([INCLUDE_NEXT_AS_FIRST_DIRECTIVE])
4434- AC_SUBST([PRAGMA_SYSTEM_HEADER])
4435-])
4436-
4437-# gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...)
4438-# ------------------------------------------
4439-# For each arg foo.h, if #include_next works, define NEXT_FOO_H to be
4440-# '<foo.h>'; otherwise define it to be
4441-# '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
4442-# That way, a header file with the following line:
4443-# #@INCLUDE_NEXT@ @NEXT_FOO_H@
4444-# behaves (after sed substitution) as if it contained
4445-# #include_next <foo.h>
4446-# even if the compiler does not support include_next.
4447-# The three "///" are to pacify Sun C 5.8, which otherwise would say
4448-# "warning: #include of /usr/include/... may be non-portable".
4449-# Use `""', not `<>', so that the /// cannot be confused with a C99 comment.
4450-# Note: This macro assumes that the header file is not empty after
4451-# preprocessing, i.e. it does not only define preprocessor macros but also
4452-# provides some type/enum definitions or function/variable declarations.
4453-AC_DEFUN([gl_CHECK_NEXT_HEADERS],
4454-[
4455- AC_REQUIRE([gl_INCLUDE_NEXT])
4456- AC_REQUIRE([AC_CANONICAL_HOST])
4457- AC_CHECK_HEADERS_ONCE([$1])
4458-
4459- m4_foreach_w([gl_HEADER_NAME], [$1],
4460- [AS_VAR_PUSHDEF([gl_next_header],
4461- [gl_cv_next_]m4_quote(m4_defn([gl_HEADER_NAME])))
4462- if test $gl_cv_have_include_next = yes; then
4463- AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
4464- else
4465- AC_CACHE_CHECK(
4466- [absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>],
4467- m4_quote(m4_defn([gl_next_header])),
4468- [AS_VAR_PUSHDEF([gl_header_exists],
4469- [ac_cv_header_]m4_quote(m4_defn([gl_HEADER_NAME])))
4470- if test AS_VAR_GET(gl_header_exists) = yes; then
4471- AC_LANG_CONFTEST(
4472- [AC_LANG_SOURCE(
4473- [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]]
4474- )])
4475- dnl AIX "xlc -E" and "cc -E" omit #line directives for header files
4476- dnl that contain only a #include of other header files and no
4477- dnl non-comment tokens of their own. This leads to a failure to
4478- dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h>
4479- dnl and others. The workaround is to force preservation of comments
4480- dnl through option -C. This ensures all necessary #line directives
4481- dnl are present. GCC supports option -C as well.
4482- case "$host_os" in
4483- aix*) gl_absname_cpp="$ac_cpp -C" ;;
4484- *) gl_absname_cpp="$ac_cpp" ;;
4485- esac
4486- dnl eval is necessary to expand gl_absname_cpp.
4487- dnl Ultrix and Pyramid sh refuse to redirect output of eval,
4488- dnl so use subshell.
4489- AS_VAR_SET([gl_next_header],
4490- ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
4491- sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{
4492- s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1#
4493- s#^/[^/]#//&#
4494- p
4495- q
4496- }'`'"'])
4497- else
4498- AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
4499- fi
4500- AS_VAR_POPDEF([gl_header_exists])])
4501- fi
4502- AC_SUBST(
4503- AS_TR_CPP([NEXT_]m4_quote(m4_defn([gl_HEADER_NAME]))),
4504- [AS_VAR_GET([gl_next_header])])
4505- AS_VAR_POPDEF([gl_next_header])])
4506-])
4507
4508=== removed file 'm4/mktime.m4'
4509--- m4/mktime.m4 2009-07-28 00:45:16 +0000
4510+++ m4/mktime.m4 1970-01-01 00:00:00 +0000
4511@@ -1,227 +0,0 @@
4512-#serial 13
4513-dnl Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
4514-dnl This file is free software; the Free Software Foundation
4515-dnl gives unlimited permission to copy and/or distribute it,
4516-dnl with or without modifications, as long as this notice is preserved.
4517-
4518-dnl From Jim Meyering.
4519-
4520-# Redefine AC_FUNC_MKTIME, to fix a bug in Autoconf 2.61a and earlier.
4521-# This redefinition can be removed once a new version of Autoconf is assumed.
4522-# The redefinition is taken from
4523-# <http://cvs.sv.gnu.org/viewcvs/*checkout*/autoconf/autoconf/lib/autoconf/functions.m4?rev=1.119>.
4524-# AC_FUNC_MKTIME
4525-# --------------
4526-AC_DEFUN([AC_FUNC_MKTIME],
4527-[AC_CHECK_HEADERS_ONCE(unistd.h)
4528-AC_CHECK_FUNCS_ONCE(alarm)
4529-AC_CACHE_CHECK([for working mktime], ac_cv_func_working_mktime,
4530-[AC_RUN_IFELSE([AC_LANG_SOURCE(
4531-[[/* Test program from Paul Eggert and Tony Leneis. */
4532-#include <limits.h>
4533-#include <stdlib.h>
4534-#include <time.h>
4535-
4536-#ifdef HAVE_UNISTD_H
4537-# include <unistd.h>
4538-#endif
4539-
4540-#ifndef HAVE_ALARM
4541-# define alarm(X) /* empty */
4542-#endif
4543-
4544-/* Work around redefinition to rpl_putenv by other config tests. */
4545-#undef putenv
4546-
4547-static time_t time_t_max;
4548-static time_t time_t_min;
4549-
4550-/* Values we'll use to set the TZ environment variable. */
4551-static char *tz_strings[] = {
4552- (char *) 0, "TZ=GMT0", "TZ=JST-9",
4553- "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00"
4554-};
4555-#define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0]))
4556-
4557-/* Return 0 if mktime fails to convert a date in the spring-forward gap.
4558- Based on a problem report from Andreas Jaeger. */
4559-static int
4560-spring_forward_gap ()
4561-{
4562- /* glibc (up to about 1998-10-07) failed this test. */
4563- struct tm tm;
4564-
4565- /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
4566- instead of "TZ=America/Vancouver" in order to detect the bug even
4567- on systems that don't support the Olson extension, or don't have the
4568- full zoneinfo tables installed. */
4569- putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
4570-
4571- tm.tm_year = 98;
4572- tm.tm_mon = 3;
4573- tm.tm_mday = 5;
4574- tm.tm_hour = 2;
4575- tm.tm_min = 0;
4576- tm.tm_sec = 0;
4577- tm.tm_isdst = -1;
4578- return mktime (&tm) != (time_t) -1;
4579-}
4580-
4581-static int
4582-mktime_test1 (now)
4583- time_t now;
4584-{
4585- struct tm *lt;
4586- return ! (lt = localtime (&now)) || mktime (lt) == now;
4587-}
4588-
4589-static int
4590-mktime_test (now)
4591- time_t now;
4592-{
4593- return (mktime_test1 (now)
4594- && mktime_test1 ((time_t) (time_t_max - now))
4595- && mktime_test1 ((time_t) (time_t_min + now)));
4596-}
4597-
4598-static int
4599-irix_6_4_bug ()
4600-{
4601- /* Based on code from Ariel Faigon. */
4602- struct tm tm;
4603- tm.tm_year = 96;
4604- tm.tm_mon = 3;
4605- tm.tm_mday = 0;
4606- tm.tm_hour = 0;
4607- tm.tm_min = 0;
4608- tm.tm_sec = 0;
4609- tm.tm_isdst = -1;
4610- mktime (&tm);
4611- return tm.tm_mon == 2 && tm.tm_mday == 31;
4612-}
4613-
4614-static int
4615-bigtime_test (j)
4616- int j;
4617-{
4618- struct tm tm;
4619- time_t now;
4620- tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j;
4621- now = mktime (&tm);
4622- if (now != (time_t) -1)
4623- {
4624- struct tm *lt = localtime (&now);
4625- if (! (lt
4626- && lt->tm_year == tm.tm_year
4627- && lt->tm_mon == tm.tm_mon
4628- && lt->tm_mday == tm.tm_mday
4629- && lt->tm_hour == tm.tm_hour
4630- && lt->tm_min == tm.tm_min
4631- && lt->tm_sec == tm.tm_sec
4632- && lt->tm_yday == tm.tm_yday
4633- && lt->tm_wday == tm.tm_wday
4634- && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst)
4635- == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst))))
4636- return 0;
4637- }
4638- return 1;
4639-}
4640-
4641-static int
4642-year_2050_test ()
4643-{
4644- /* The correct answer for 2050-02-01 00:00:00 in Pacific time,
4645- ignoring leap seconds. */
4646- unsigned long int answer = 2527315200UL;
4647-
4648- struct tm tm;
4649- time_t t;
4650- tm.tm_year = 2050 - 1900;
4651- tm.tm_mon = 2 - 1;
4652- tm.tm_mday = 1;
4653- tm.tm_hour = tm.tm_min = tm.tm_sec = 0;
4654- tm.tm_isdst = -1;
4655-
4656- /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0"
4657- instead of "TZ=America/Vancouver" in order to detect the bug even
4658- on systems that don't support the Olson extension, or don't have the
4659- full zoneinfo tables installed. */
4660- putenv ("TZ=PST8PDT,M4.1.0,M10.5.0");
4661-
4662- t = mktime (&tm);
4663-
4664- /* Check that the result is either a failure, or close enough
4665- to the correct answer that we can assume the discrepancy is
4666- due to leap seconds. */
4667- return (t == (time_t) -1
4668- || (0 < t && answer - 120 <= t && t <= answer + 120));
4669-}
4670-
4671-int
4672-main ()
4673-{
4674- time_t t, delta;
4675- int i, j;
4676-
4677- /* This test makes some buggy mktime implementations loop.
4678- Give up after 60 seconds; a mktime slower than that
4679- isn't worth using anyway. */
4680- alarm (60);
4681-
4682- for (;;)
4683- {
4684- t = (time_t_max << 1) + 1;
4685- if (t <= time_t_max)
4686- break;
4687- time_t_max = t;
4688- }
4689- time_t_min = - ((time_t) ~ (time_t) 0 == (time_t) -1) - time_t_max;
4690-
4691- delta = time_t_max / 997; /* a suitable prime number */
4692- for (i = 0; i < N_STRINGS; i++)
4693- {
4694- if (tz_strings[i])
4695- putenv (tz_strings[i]);
4696-
4697- for (t = 0; t <= time_t_max - delta; t += delta)
4698- if (! mktime_test (t))
4699- return 1;
4700- if (! (mktime_test ((time_t) 1)
4701- && mktime_test ((time_t) (60 * 60))
4702- && mktime_test ((time_t) (60 * 60 * 24))))
4703- return 1;
4704-
4705- for (j = 1; ; j <<= 1)
4706- if (! bigtime_test (j))
4707- return 1;
4708- else if (INT_MAX / 2 < j)
4709- break;
4710- if (! bigtime_test (INT_MAX))
4711- return 1;
4712- }
4713- return ! (irix_6_4_bug () && spring_forward_gap () && year_2050_test ());
4714-}]])],
4715- [ac_cv_func_working_mktime=yes],
4716- [ac_cv_func_working_mktime=no],
4717- [ac_cv_func_working_mktime=no])])
4718-if test $ac_cv_func_working_mktime = no; then
4719- AC_LIBOBJ([mktime])
4720-fi
4721-])# AC_FUNC_MKTIME
4722-
4723-AC_DEFUN([gl_FUNC_MKTIME],
4724-[
4725- AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
4726- AC_FUNC_MKTIME
4727- dnl Note: AC_FUNC_MKTIME does AC_LIBOBJ([mktime]).
4728- if test $ac_cv_func_working_mktime = no; then
4729- REPLACE_MKTIME=1
4730- gl_PREREQ_MKTIME
4731- fi
4732-])
4733-
4734-# Prerequisites of lib/mktime.c.
4735-AC_DEFUN([gl_PREREQ_MKTIME],
4736-[
4737- AC_REQUIRE([AC_C_INLINE])
4738-])
4739
4740=== removed file 'm4/onceonly.m4'
4741--- m4/onceonly.m4 2009-04-18 05:26:04 +0000
4742+++ m4/onceonly.m4 1970-01-01 00:00:00 +0000
4743@@ -1,90 +0,0 @@
4744-# onceonly.m4 serial 6
4745-dnl Copyright (C) 2002-2003, 2005-2006, 2008 Free Software Foundation, Inc.
4746-dnl This file is free software, distributed under the terms of the GNU
4747-dnl General Public License. As a special exception to the GNU General
4748-dnl Public License, this file may be distributed as part of a program
4749-dnl that contains a configuration script generated by Autoconf, under
4750-dnl the same distribution terms as the rest of that program.
4751-
4752-dnl This file defines some "once only" variants of standard autoconf macros.
4753-dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS
4754-dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS
4755-dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS
4756-dnl AC_REQUIRE([AC_FUNC_STRCOLL]) like AC_FUNC_STRCOLL
4757-dnl The advantage is that the check for each of the headers/functions/decls
4758-dnl will be put only once into the 'configure' file. It keeps the size of
4759-dnl the 'configure' file down, and avoids redundant output when 'configure'
4760-dnl is run.
4761-dnl The drawback is that the checks cannot be conditionalized. If you write
4762-dnl if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi
4763-dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to
4764-dnl empty, and the check will be inserted before the body of the AC_DEFUNed
4765-dnl function.
4766-
4767-dnl The original code implemented AC_CHECK_HEADERS_ONCE and AC_CHECK_FUNCS_ONCE
4768-dnl in terms of AC_DEFUN and AC_REQUIRE. This implementation uses diversions to
4769-dnl named sections DEFAULTS and INIT_PREPARE in order to check all requested
4770-dnl headers at once, thus reducing the size of 'configure'. It is known to work
4771-dnl with autoconf 2.57..2.62 at least . The size reduction is ca. 9%.
4772-
4773-dnl Autoconf version 2.59 plus gnulib is required; this file is not needed
4774-dnl with Autoconf 2.60 or greater. But note that autoconf's implementation of
4775-dnl AC_CHECK_DECLS_ONCE expects a comma-separated list of symbols as first
4776-dnl argument!
4777-AC_PREREQ([2.59])
4778-
4779-# AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of
4780-# AC_CHECK_HEADERS(HEADER1 HEADER2 ...).
4781-AC_DEFUN([AC_CHECK_HEADERS_ONCE], [
4782- :
4783- m4_foreach_w([gl_HEADER_NAME], [$1], [
4784- AC_DEFUN([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
4785- [./-], [___])), [
4786- m4_divert_text([INIT_PREPARE],
4787- [gl_header_list="$gl_header_list gl_HEADER_NAME"])
4788- gl_HEADERS_EXPANSION
4789- AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_HEADER_NAME])),
4790- [Define to 1 if you have the <]m4_defn([gl_HEADER_NAME])[> header file.])
4791- ])
4792- AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
4793- [./-], [___])))
4794- ])
4795-])
4796-m4_define([gl_HEADERS_EXPANSION], [
4797- m4_divert_text([DEFAULTS], [gl_header_list=])
4798- AC_CHECK_HEADERS([$gl_header_list])
4799- m4_define([gl_HEADERS_EXPANSION], [])
4800-])
4801-
4802-# AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of
4803-# AC_CHECK_FUNCS(FUNC1 FUNC2 ...).
4804-AC_DEFUN([AC_CHECK_FUNCS_ONCE], [
4805- :
4806- m4_foreach_w([gl_FUNC_NAME], [$1], [
4807- AC_DEFUN([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]), [
4808- m4_divert_text([INIT_PREPARE],
4809- [gl_func_list="$gl_func_list gl_FUNC_NAME"])
4810- gl_FUNCS_EXPANSION
4811- AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_FUNC_NAME])),
4812- [Define to 1 if you have the `]m4_defn([gl_FUNC_NAME])[' function.])
4813- ])
4814- AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]))
4815- ])
4816-])
4817-m4_define([gl_FUNCS_EXPANSION], [
4818- m4_divert_text([DEFAULTS], [gl_func_list=])
4819- AC_CHECK_FUNCS([$gl_func_list])
4820- m4_define([gl_FUNCS_EXPANSION], [])
4821-])
4822-
4823-# AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of
4824-# AC_CHECK_DECLS(DECL1, DECL2, ...).
4825-AC_DEFUN([AC_CHECK_DECLS_ONCE], [
4826- :
4827- m4_foreach_w([gl_DECL_NAME], [$1], [
4828- AC_DEFUN([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]), [
4829- AC_CHECK_DECLS(m4_defn([gl_DECL_NAME]))
4830- ])
4831- AC_REQUIRE([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]))
4832- ])
4833-])
4834
4835=== modified file 'm4/pandora_canonical.m4'
4836--- m4/pandora_canonical.m4 2010-07-31 17:48:00 +0000
4837+++ m4/pandora_canonical.m4 2010-08-12 22:43:43 +0000
4838@@ -86,6 +86,8 @@
4839
4840 m4_if(m4_substr(m4_esyscmd(test -d gnulib && echo 0),0,1),0,[
4841 gl_EARLY
4842+ ],[
4843+ PANDORA_EXTENSIONS
4844 ])
4845
4846 AC_REQUIRE([AC_PROG_CC])
4847
4848=== removed file 'm4/time_h.m4'
4849--- m4/time_h.m4 2009-07-28 00:45:16 +0000
4850+++ m4/time_h.m4 1970-01-01 00:00:00 +0000
4851@@ -1,75 +0,0 @@
4852-# Configure a more-standard replacement for <time.h>.
4853-
4854-# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2007 Free Software
4855-# Foundation, Inc.
4856-
4857-# This file is free software; the Free Software Foundation
4858-# gives unlimited permission to copy and/or distribute it,
4859-# with or without modifications, as long as this notice is preserved.
4860-
4861-# Written by Paul Eggert and Jim Meyering.
4862-
4863-AC_DEFUN([gl_HEADER_TIME_H],
4864-[
4865- dnl Use AC_REQUIRE here, so that the default behavior below is expanded
4866- dnl once only, before all statements that occur in other macros.
4867- AC_REQUIRE([gl_HEADER_TIME_H_BODY])
4868-])
4869-
4870-AC_DEFUN([gl_HEADER_TIME_H_BODY],
4871-[
4872- AC_REQUIRE([AC_C_RESTRICT])
4873- AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
4874- gl_CHECK_NEXT_HEADERS([time.h])
4875- AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC])
4876-])
4877-
4878-AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
4879-[
4880- dnl If another module says to replace or to not replace, do that.
4881- dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK;
4882- dnl this lets maintainers check for portability.
4883- REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME_R])
4884- REPLACE_MKTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_MKTIME])
4885- REPLACE_NANOSLEEP=GNULIB_PORTCHECK; AC_SUBST([REPLACE_NANOSLEEP])
4886- REPLACE_STRPTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_STRPTIME])
4887- REPLACE_TIMEGM=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMEGM])
4888-])
4889-
4890-dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
4891-dnl in time.h or sys/time.h.
4892-
4893-AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
4894-[
4895- AC_CHECK_HEADERS_ONCE([sys/time.h])
4896- AC_CACHE_CHECK([for struct timespec in <time.h>],
4897- [gl_cv_sys_struct_timespec_in_time_h],
4898- [AC_COMPILE_IFELSE(
4899- [AC_LANG_PROGRAM(
4900- [[#include <time.h>
4901- ]],
4902- [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
4903- [gl_cv_sys_struct_timespec_in_time_h=yes],
4904- [gl_cv_sys_struct_timespec_in_time_h=no])])
4905-
4906- TIME_H_DEFINES_STRUCT_TIMESPEC=0
4907- SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0
4908- if test $gl_cv_sys_struct_timespec_in_time_h = yes; then
4909- TIME_H_DEFINES_STRUCT_TIMESPEC=1
4910- else
4911- AC_CACHE_CHECK([for struct timespec in <sys/time.h>],
4912- [gl_cv_sys_struct_timespec_in_sys_time_h],
4913- [AC_COMPILE_IFELSE(
4914- [AC_LANG_PROGRAM(
4915- [[#include <sys/time.h>
4916- ]],
4917- [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
4918- [gl_cv_sys_struct_timespec_in_sys_time_h=yes],
4919- [gl_cv_sys_struct_timespec_in_sys_time_h=no])])
4920- if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then
4921- SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1
4922- fi
4923- fi
4924- AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC])
4925- AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC])
4926-])
4927
4928=== removed file 'm4/time_r.m4'
4929--- m4/time_r.m4 2009-01-29 19:04:39 +0000
4930+++ m4/time_r.m4 1970-01-01 00:00:00 +0000
4931@@ -1,43 +0,0 @@
4932-dnl Reentrant time functions like localtime_r.
4933-
4934-dnl Copyright (C) 2003, 2006, 2007, 2008 Free Software Foundation, Inc.
4935-dnl This file is free software; the Free Software Foundation
4936-dnl gives unlimited permission to copy and/or distribute it,
4937-dnl with or without modifications, as long as this notice is preserved.
4938-
4939-dnl Written by Paul Eggert.
4940-
4941-AC_DEFUN([gl_TIME_R],
4942-[
4943- dnl Persuade glibc and Solaris <time.h> to declare localtime_r.
4944- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
4945-
4946- AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
4947- AC_REQUIRE([AC_C_RESTRICT])
4948-
4949- AC_CACHE_CHECK([whether localtime_r is compatible with its POSIX signature],
4950- [gl_cv_time_r_posix],
4951- [AC_TRY_COMPILE(
4952- [#include <time.h>],
4953- [/* We don't need to append 'restrict's to the argument types,
4954- even though the POSIX signature has the 'restrict's,
4955- since C99 says they can't affect type compatibility. */
4956- struct tm * (*ptr) (time_t const *, struct tm *) = localtime_r;
4957- if (ptr) return 0;
4958- /* Check the return type is a pointer. On HP-UX 10 it is 'int'. */
4959- *localtime_r (0, 0);],
4960- [gl_cv_time_r_posix=yes],
4961- [gl_cv_time_r_posix=no])])
4962- if test $gl_cv_time_r_posix = yes; then
4963- REPLACE_LOCALTIME_R=0
4964- else
4965- REPLACE_LOCALTIME_R=1
4966- AC_LIBOBJ([time_r])
4967- gl_PREREQ_TIME_R
4968- fi
4969-])
4970-
4971-# Prerequisites of lib/time_r.c.
4972-AC_DEFUN([gl_PREREQ_TIME_R], [
4973- :
4974-])
4975
4976=== removed file 'm4/timegm.m4'
4977--- m4/timegm.m4 2009-01-29 19:04:39 +0000
4978+++ m4/timegm.m4 1970-01-01 00:00:00 +0000
4979@@ -1,40 +0,0 @@
4980-# timegm.m4 serial 5
4981-dnl Copyright (C) 2003, 2007 Free Software Foundation, Inc.
4982-dnl This file is free software; the Free Software Foundation
4983-dnl gives unlimited permission to copy and/or distribute it,
4984-dnl with or without modifications, as long as this notice is preserved.
4985-
4986-AC_DEFUN([gl_FUNC_TIMEGM],
4987-[
4988- AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
4989- AC_REQUIRE([gl_FUNC_MKTIME])
4990- if test $ac_cv_func_working_mktime = no; then
4991- # Assume that timegm is buggy if mktime is.
4992- AC_LIBOBJ([timegm])
4993- ac_cv_func_timegm=no
4994- else
4995- AC_REPLACE_FUNCS(timegm)
4996- fi
4997- REPLACE_TIMEGM=1
4998- if test $ac_cv_func_timegm = yes; then
4999- AC_CHECK_DECLS([timegm], [REPLACE_TIMEGM=0], [], [#include <time.h>])
5000- fi
The diff has been truncated for viewing.