1 diff -urN popt-for-windows/lib/alloca.c popt-for-windows-gnulib/lib/alloca.c
2 --- popt-for-windows/lib/alloca.c 1970-01-01 01:00:00.000000000 +0100
3 +++ popt-for-windows-gnulib/lib/alloca.c 2008-10-25 15:17:05.000000000 +0100
5 +/* alloca.c -- allocate automatically reclaimed memory
6 + (Mostly) portable public-domain implementation -- D A Gwyn
8 + This implementation of the PWB library alloca function,
9 + which is used to allocate space off the run-time stack so
10 + that it is automatically reclaimed upon procedure exit,
11 + was inspired by discussions with J. Q. Johnson of Cornell.
12 + J.Otto Tennant <jot@cray.com> contributed the Cray support.
14 + There are some preprocessor constants that can
15 + be defined when compiling for your specific system, for
16 + improved efficiency; however, the defaults should be okay.
18 + The general concept of this implementation is to keep
19 + track of all alloca-allocated blocks, and reclaim any
20 + that are found to be deeper in the stack than the current
21 + invocation. This heuristic does not reclaim storage as
22 + soon as it becomes invalid, but it will do so eventually.
24 + As a special case, alloca(0) reclaims storage without
25 + allocating any. It is a good idea to use alloca(0) in
26 + your main control loop, etc. to force garbage collection. */
37 +# include "blockinput.h"
40 +# define free EMACS_FREE
43 +# define memory_full() abort ()
46 +/* If compiling with GCC 2, this file's not needed. */
47 +#if !defined (__GNUC__) || __GNUC__ < 2
49 +/* If someone has defined alloca as a macro,
50 + there must be some other way alloca is supposed to work. */
55 +/* actually, only want this if static is defined as ""
56 + -- this is for usg, in which emacs must undefine static
57 + in order to make unexec workable
59 +# ifndef STACK_DIRECTION
62 +-- must know STACK_DIRECTION at compile-time
63 +/* Using #error here is not wise since this file should work for
64 + old and obscure compilers. */
65 +# endif /* STACK_DIRECTION undefined */
69 +/* If your stack is a linked list of frames, you have to
70 + provide an "address metric" ADDRESS_FUNCTION macro. */
72 +# if defined (CRAY) && defined (CRAY_STACKSEG_END)
74 +# define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
76 +# define ADDRESS_FUNCTION(arg) &(arg)
79 +/* Define STACK_DIRECTION if you know the direction of stack
80 + growth for your system; otherwise it will be automatically
81 + deduced at run-time.
83 + STACK_DIRECTION > 0 => grows toward higher addresses
84 + STACK_DIRECTION < 0 => grows toward lower addresses
85 + STACK_DIRECTION = 0 => direction of growth unknown */
87 +# ifndef STACK_DIRECTION
88 +# define STACK_DIRECTION 0 /* Direction unknown. */
91 +# if STACK_DIRECTION != 0
93 +# define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
95 +# else /* STACK_DIRECTION == 0; need run-time code. */
97 +static int stack_dir; /* 1 or -1 once known. */
98 +# define STACK_DIR stack_dir
101 +find_stack_direction (void)
103 + static char *addr = NULL; /* Address of first `dummy', once known. */
104 + auto char dummy; /* To get stack address. */
107 + { /* Initial entry. */
108 + addr = ADDRESS_FUNCTION (dummy);
110 + find_stack_direction (); /* Recurse once. */
114 + /* Second entry. */
115 + if (ADDRESS_FUNCTION (dummy) > addr)
116 + stack_dir = 1; /* Stack grew upward. */
118 + stack_dir = -1; /* Stack grew downward. */
122 +# endif /* STACK_DIRECTION == 0 */
124 +/* An "alloca header" is used to:
125 + (a) chain together all alloca'ed blocks;
126 + (b) keep track of stack depth.
128 + It is very important that sizeof(header) agree with malloc
129 + alignment chunk size. The following default should work okay. */
132 +# define ALIGN_SIZE sizeof(double)
137 + char align[ALIGN_SIZE]; /* To force sizeof(header). */
140 + union hdr *next; /* For chaining headers. */
141 + char *deep; /* For stack depth measure. */
145 +static header *last_alloca_header = NULL; /* -> last alloca header. */
147 +/* Return a pointer to at least SIZE bytes of storage,
148 + which will be automatically reclaimed upon exit from
149 + the procedure that called alloca. Originally, this space
150 + was supposed to be taken from the current stack frame of the
151 + caller, but that method cannot be made to work for some
152 + implementations of C, for example under Gould's UTX/32. */
155 +alloca (size_t size)
157 + auto char probe; /* Probes stack depth: */
158 + register char *depth = ADDRESS_FUNCTION (probe);
160 +# if STACK_DIRECTION == 0
161 + if (STACK_DIR == 0) /* Unknown growth direction. */
162 + find_stack_direction ();
165 + /* Reclaim garbage, defined as all alloca'd storage that
166 + was allocated from deeper in the stack than currently. */
169 + register header *hp; /* Traverses linked list. */
175 + for (hp = last_alloca_header; hp != NULL;)
176 + if ((STACK_DIR > 0 && hp->h.deep > depth)
177 + || (STACK_DIR < 0 && hp->h.deep < depth))
179 + register header *np = hp->h.next;
181 + free (hp); /* Collect garbage. */
183 + hp = np; /* -> next header. */
186 + break; /* Rest are not deeper. */
188 + last_alloca_header = hp; /* -> last valid storage. */
196 + return NULL; /* No allocation required. */
198 + /* Allocate combined header + user data storage. */
201 + /* Address of header. */
202 + register header *new;
204 + size_t combined_size = sizeof (header) + size;
205 + if (combined_size < sizeof (header))
208 + new = malloc (combined_size);
213 + new->h.next = last_alloca_header;
214 + new->h.deep = depth;
216 + last_alloca_header = new;
218 + /* User storage begins just after header. */
220 + return (void *) (new + 1);
224 +# if defined (CRAY) && defined (CRAY_STACKSEG_END)
226 +# ifdef DEBUG_I00AFUNC
233 +/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
234 +struct stack_control_header
236 + long shgrow:32; /* Number of times stack has grown. */
237 + long shaseg:32; /* Size of increments to stack. */
238 + long shhwm:32; /* High water mark of stack. */
239 + long shsize:32; /* Current size of stack (all segments). */
242 +/* The stack segment linkage control information occurs at
243 + the high-address end of a stack segment. (The stack
244 + grows from low addresses to high addresses.) The initial
245 + part of the stack segment linkage control information is
246 + 0200 (octal) words. This provides for register storage
247 + for the routine which overflows the stack. */
249 +struct stack_segment_linkage
251 + long ss[0200]; /* 0200 overflow words. */
252 + long sssize:32; /* Number of words in this segment. */
253 + long ssbase:32; /* Offset to stack base. */
255 + long sspseg:32; /* Offset to linkage control of previous
256 + segment of stack. */
258 + long sstcpt:32; /* Pointer to task common address block. */
259 + long sscsnm; /* Private control structure number for
261 + long ssusr1; /* Reserved for user. */
262 + long ssusr2; /* Reserved for user. */
263 + long sstpid; /* Process ID for pid based multi-tasking. */
264 + long ssgvup; /* Pointer to multitasking thread giveup. */
265 + long sscray[7]; /* Reserved for Cray Research. */
285 +/* The following structure defines the vector of words
286 + returned by the STKSTAT library routine. */
289 + long now; /* Current total stack size. */
290 + long maxc; /* Amount of contiguous space which would
291 + be required to satisfy the maximum
292 + stack demand to date. */
293 + long high_water; /* Stack high-water mark. */
294 + long overflows; /* Number of stack overflow ($STKOFEN) calls. */
295 + long hits; /* Number of internal buffer hits. */
296 + long extends; /* Number of block extensions. */
297 + long stko_mallocs; /* Block allocations by $STKOFEN. */
298 + long underflows; /* Number of stack underflow calls ($STKRETN). */
299 + long stko_free; /* Number of deallocations by $STKRETN. */
300 + long stkm_free; /* Number of deallocations by $STKMRET. */
301 + long segments; /* Current number of stack segments. */
302 + long maxs; /* Maximum number of stack segments so far. */
303 + long pad_size; /* Stack pad size. */
304 + long current_address; /* Current stack segment address. */
305 + long current_size; /* Current stack segment size. This
306 + number is actually corrupted by STKSTAT to
307 + include the fifteen word trailer area. */
308 + long initial_address; /* Address of initial segment. */
309 + long initial_size; /* Size of initial segment. */
312 +/* The following structure describes the data structure which trails
313 + any stack segment. I think that the description in 'asdef' is
314 + out of date. I only describe the parts that I am sure about. */
318 + long this_address; /* Address of this block. */
319 + long this_size; /* Size of this block (does not include
323 + long link; /* Address of trailer block of previous
338 +# endif /* not CRAY_STACK */
341 +/* Determine a "stack measure" for an arbitrary ADDRESS.
342 + I doubt that "lint" will like this much. */
345 +i00afunc (long *address)
347 + struct stk_stat status;
348 + struct stk_trailer *trailer;
352 + /* We want to iterate through all of the segments. The first
353 + step is to get the stack status structure. We could do this
354 + more quickly and more directly, perhaps, by referencing the
355 + $LM00 common block, but I know that this works. */
359 + /* Set up the iteration. */
361 + trailer = (struct stk_trailer *) (status.current_address
362 + + status.current_size
365 + /* There must be at least one stack segment. Therefore it is
366 + a fatal error if "trailer" is null. */
371 + /* Discard segments that do not contain our argument address. */
373 + while (trailer != 0)
375 + block = (long *) trailer->this_address;
376 + size = trailer->this_size;
377 + if (block == 0 || size == 0)
379 + trailer = (struct stk_trailer *) trailer->link;
380 + if ((block <= address) && (address < (block + size)))
384 + /* Set the result to the offset in this segment and add the sizes
385 + of all predecessor segments. */
387 + result = address - block;
396 + if (trailer->this_size <= 0)
398 + result += trailer->this_size;
399 + trailer = (struct stk_trailer *) trailer->link;
401 + while (trailer != 0);
403 + /* We are done. Note that if you present a bogus address (one
404 + not in any segment), you will get a different number back, formed
405 + from subtracting the address of the first block. This is probably
406 + not what you want. */
411 +# else /* not CRAY2 */
412 +/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
413 + Determine the number of the cell within the stack,
414 + given the address of the cell. The purpose of this
415 + routine is to linearize, in some sense, stack addresses
419 +i00afunc (long address)
423 + long size, pseg, this_segment, stack;
426 + struct stack_segment_linkage *ssptr;
428 + /* Register B67 contains the address of the end of the
429 + current stack segment. If you (as a subprogram) store
430 + your registers on the stack and find that you are past
431 + the contents of B67, you have overflowed the segment.
433 + B67 also points to the stack segment linkage control
434 + area, which is what we are really interested in. */
436 + stkl = CRAY_STACKSEG_END ();
437 + ssptr = (struct stack_segment_linkage *) stkl;
439 + /* If one subtracts 'size' from the end of the segment,
440 + one has the address of the first word of the segment.
442 + If this is not the first segment, 'pseg' will be
445 + pseg = ssptr->sspseg;
446 + size = ssptr->sssize;
448 + this_segment = stkl - size;
450 + /* It is possible that calling this routine itself caused
451 + a stack overflow. Discard stack segments which do not
452 + contain the target address. */
454 + while (!(this_segment <= address && address <= stkl))
456 +# ifdef DEBUG_I00AFUNC
457 + fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
461 + stkl = stkl - pseg;
462 + ssptr = (struct stack_segment_linkage *) stkl;
463 + size = ssptr->sssize;
464 + pseg = ssptr->sspseg;
465 + this_segment = stkl - size;
468 + result = address - this_segment;
470 + /* If you subtract pseg from the current end of the stack,
471 + you get the address of the previous stack segment's end.
472 + This seems a little convoluted to me, but I'll bet you save
473 + a cycle somewhere. */
477 +# ifdef DEBUG_I00AFUNC
478 + fprintf (stderr, "%011o %011o\n", pseg, size);
480 + stkl = stkl - pseg;
481 + ssptr = (struct stack_segment_linkage *) stkl;
482 + size = ssptr->sssize;
483 + pseg = ssptr->sspseg;
489 +# endif /* not CRAY2 */
492 +# endif /* no alloca */
493 +#endif /* not GCC version 3 */
494 diff -urN popt-for-windows/lib/alloca.in.h popt-for-windows-gnulib/lib/alloca.in.h
495 --- popt-for-windows/lib/alloca.in.h 1970-01-01 01:00:00.000000000 +0100
496 +++ popt-for-windows-gnulib/lib/alloca.in.h 2008-10-25 15:17:05.000000000 +0100
498 +/* Memory allocation on the stack.
500 + Copyright (C) 1995, 1999, 2001-2004, 2006-2008 Free Software
503 + This program is free software; you can redistribute it and/or modify it
504 + under the terms of the GNU General Public License as published
505 + by the Free Software Foundation; either version 3, or (at your option)
508 + This program is distributed in the hope that it will be useful,
509 + but WITHOUT ANY WARRANTY; without even the implied warranty of
510 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
511 + General Public License for more details.
513 + You should have received a copy of the GNU General Public
514 + License along with this program; if not, write to the Free Software
515 + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
518 +/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
519 + means there is a real alloca function. */
520 +#ifndef _GL_ALLOCA_H
521 +#define _GL_ALLOCA_H
523 +/* alloca (N) returns a pointer to N bytes of memory
524 + allocated on the stack, which will last until the function returns.
525 + Use of alloca should be avoided:
526 + - inside arguments of function calls - undefined behaviour,
527 + - in inline functions - the allocation may actually last until the
528 + calling function returns,
529 + - for huge N (say, N >= 65536) - you never know how large (or small)
530 + the stack is, and when the stack cannot fulfill the memory allocation
531 + request, the program just crashes.
536 +# define alloca __builtin_alloca
538 +# define alloca __alloca
539 +# elif defined _MSC_VER
540 +# include <malloc.h>
541 +# define alloca _alloca
542 +# elif defined __DECC && defined __VMS
543 +# define alloca __ALLOCA
545 +# include <stddef.h>
549 +void *alloca (size_t);
553 +#endif /* _GL_ALLOCA_H */
554 diff -urN popt-for-windows/lib/.cvsignore popt-for-windows-gnulib/lib/.cvsignore
555 --- popt-for-windows/lib/.cvsignore 1970-01-01 01:00:00.000000000 +0100
556 +++ popt-for-windows-gnulib/lib/.cvsignore 2008-10-25 15:17:05.000000000 +0100
583 diff -urN popt-for-windows/lib/dirent.in.h popt-for-windows-gnulib/lib/dirent.in.h
584 --- popt-for-windows/lib/dirent.in.h 1970-01-01 01:00:00.000000000 +0100
585 +++ popt-for-windows-gnulib/lib/dirent.in.h 2008-10-25 15:17:05.000000000 +0100
587 +/* A GNU-like <dirent.h>.
588 + Copyright (C) 2006-2008 Free Software Foundation, Inc.
590 + This program is free software: you can redistribute it and/or modify
591 + it under the terms of the GNU General Public License as published by
592 + the Free Software Foundation; either version 3 of the License, or
593 + (at your option) any later version.
595 + This program is distributed in the hope that it will be useful,
596 + but WITHOUT ANY WARRANTY; without even the implied warranty of
597 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
598 + GNU General Public License for more details.
600 + You should have received a copy of the GNU General Public License
601 + along with this program. If not, see <http://www.gnu.org/licenses/>. */
603 +#ifndef _GL_DIRENT_H
606 +@PRAGMA_SYSTEM_HEADER@
609 +/* The include_next requires a split double-inclusion guard. */
610 +#@INCLUDE_NEXT@ @NEXT_DIRENT_H@
612 +#ifndef _GL_DIRENT_H
613 +#define _GL_DIRENT_H
615 +/* The definition of GL_LINK_WARNING is copied here. */
622 +/* Declare overridden functions. */
624 +#if @REPLACE_FCHDIR@
625 +# define opendir rpl_opendir
626 +extern DIR * opendir (const char *);
627 +# define closedir rpl_closedir
628 +extern int closedir (DIR *);
631 +/* Declare GNU extensions. */
634 +# if !@HAVE_DECL_DIRFD@ && !defined dirfd
635 +/* Return the file descriptor associated with the given directory stream,
636 + or -1 if none exists. */
637 +extern int dirfd (DIR const *dir);
639 +#elif defined GNULIB_POSIXCHECK
642 + (GL_LINK_WARNING ("dirfd is unportable - " \
643 + "use gnulib module dirfd for portability"), \
652 +#endif /* _GL_DIRENT_H */
653 +#endif /* _GL_DIRENT_H */
654 diff -urN popt-for-windows/lib/dirfd.c popt-for-windows-gnulib/lib/dirfd.c
655 --- popt-for-windows/lib/dirfd.c 1970-01-01 01:00:00.000000000 +0100
656 +++ popt-for-windows-gnulib/lib/dirfd.c 2008-10-25 15:17:05.000000000 +0100
658 +/* dirfd.c -- return the file descriptor associated with an open DIR*
660 + Copyright (C) 2001, 2006, 2008 Free Software Foundation, Inc.
662 + This program is free software: you can redistribute it and/or modify
663 + it under the terms of the GNU General Public License as published by
664 + the Free Software Foundation; either version 3 of the License, or
665 + (at your option) any later version.
667 + This program is distributed in the hope that it will be useful,
668 + but WITHOUT ANY WARRANTY; without even the implied warranty of
669 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
670 + GNU General Public License for more details.
672 + You should have received a copy of the GNU General Public License
673 + along with this program. If not, see <http://www.gnu.org/licenses/>. */
675 +/* Written by Jim Meyering. */
682 +dirfd (DIR const *dir_p)
684 + return DIR_TO_FD (dir_p);
686 diff -urN popt-for-windows/lib/dummy.c popt-for-windows-gnulib/lib/dummy.c
687 --- popt-for-windows/lib/dummy.c 1970-01-01 01:00:00.000000000 +0100
688 +++ popt-for-windows-gnulib/lib/dummy.c 2008-10-25 15:17:05.000000000 +0100
690 +/* A dummy file, to prevent empty libraries from breaking builds.
691 + Copyright (C) 2004, 2007 Free Software Foundation, Inc.
693 + This program is free software: you can redistribute it and/or modify
694 + it under the terms of the GNU General Public License as published by
695 + the Free Software Foundation; either version 3 of the License, or
696 + (at your option) any later version.
698 + This program is distributed in the hope that it will be useful,
699 + but WITHOUT ANY WARRANTY; without even the implied warranty of
700 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
701 + GNU General Public License for more details.
703 + You should have received a copy of the GNU General Public License
704 + along with this program. If not, see <http://www.gnu.org/licenses/>. */
706 +/* Some systems, reportedly OpenBSD and Mac OS X, refuse to create
707 + libraries without any object files. You might get an error like:
709 + > ar cru .libs/libgl.a
710 + > ar: no archive members specified
712 + Compiling this file, and adding its object file to the library, will
713 + prevent the library from being empty. */
715 +/* Some systems, such as Solaris with cc 5.0, refuse to work with libraries
716 + that don't export any symbol. You might get an error like:
719 + > ild: (bad file) garbled symbol table in archive ../gllib/libgnu.a
721 + Compiling this file, and adding its object file to the library, will
722 + prevent the library from exporting no symbols. */
725 +/* This declaration ensures that the library will export at least 1 symbol. */
726 +int gl_dummy_symbol;
728 +/* This declaration is solely to ensure that after preprocessing
729 + this file is never empty. */
732 diff -urN popt-for-windows/lib/fnmatch.c popt-for-windows-gnulib/lib/fnmatch.c
733 --- popt-for-windows/lib/fnmatch.c 1970-01-01 01:00:00.000000000 +0100
734 +++ popt-for-windows-gnulib/lib/fnmatch.c 2008-10-25 15:17:05.000000000 +0100
736 +/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007
737 + Free Software Foundation, Inc.
739 + This program is free software; you can redistribute it and/or modify
740 + it under the terms of the GNU General Public License as published by
741 + the Free Software Foundation; either version 3, or (at your option)
744 + This program is distributed in the hope that it will be useful,
745 + but WITHOUT ANY WARRANTY; without even the implied warranty of
746 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
747 + GNU General Public License for more details.
749 + You should have received a copy of the GNU General Public License
750 + along with this program; if not, write to the Free Software Foundation,
751 + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
754 +# include <config.h>
757 +/* Enable GNU extensions in fnmatch.h. */
759 +# define _GNU_SOURCE 1
762 +#if ! defined __builtin_expect && __GNUC__ < 3
763 +# define __builtin_expect(expr, expected) (expr)
766 +#include <fnmatch.h>
773 +#include <stdbool.h>
777 +#define WIDE_CHAR_SUPPORT \
778 + (HAVE_WCTYPE_H && HAVE_BTOWC && HAVE_ISWCTYPE \
779 + && HAVE_WMEMCHR && (HAVE_WMEMCPY || HAVE_WMEMPCPY))
781 +/* For platform which support the ISO C amendement 1 functionality we
782 + support user defined character classes. */
783 +#if defined _LIBC || WIDE_CHAR_SUPPORT
784 +# include <wctype.h>
788 +/* We need some of the locale data (the collation sequence information)
789 + but there is no interface to get this information in general. Therefore
790 + we support a correct implementation only in glibc. */
792 +# include "../locale/localeinfo.h"
793 +# include "../locale/elem-hash.h"
794 +# include "../locale/coll-lookup.h"
795 +# include <shlib-compat.h>
797 +# define CONCAT(a,b) __CONCAT(a,b)
798 +# define mbsrtowcs __mbsrtowcs
799 +# define fnmatch __fnmatch
800 +extern int fnmatch (const char *pattern, const char *string, int flags);
804 +# define SIZE_MAX ((size_t) -1)
807 +/* We often have to test for FNM_FILE_NAME and FNM_PERIOD being both set. */
808 +#define NO_LEADING_PERIOD(flags) \
809 + ((flags & (FNM_FILE_NAME | FNM_PERIOD)) == (FNM_FILE_NAME | FNM_PERIOD))
811 +/* Comment out all this code if we are using the GNU C Library, and are not
812 + actually compiling the library itself, and have not detected a bug
813 + in the library. This code is part of the GNU C
814 + Library, but also included in many other GNU distributions. Compiling
815 + and linking in this code is a waste when using the GNU C library
816 + (especially if it is a shared library). Rather than having every GNU
817 + program understand `configure --with-gnu-libc' and omit the object files,
818 + it is simpler to just do this in the source for each such file. */
820 +#if defined _LIBC || !defined __GNU_LIBRARY__ || !HAVE_FNMATCH_GNU
823 +# if ! (defined isblank || (HAVE_ISBLANK && HAVE_DECL_ISBLANK))
824 +# define isblank(c) ((c) == ' ' || (c) == '\t')
827 +# define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
829 +# if defined _LIBC || WIDE_CHAR_SUPPORT
830 +/* The GNU C library provides support for user-defined character classes
831 + and the functions from ISO C amendement 1. */
832 +# ifdef CHARCLASS_NAME_MAX
833 +# define CHAR_CLASS_MAX_LENGTH CHARCLASS_NAME_MAX
835 +/* This shouldn't happen but some implementation might still have this
836 + problem. Use a reasonable default value. */
837 +# define CHAR_CLASS_MAX_LENGTH 256
841 +# define IS_CHAR_CLASS(string) __wctype (string)
843 +# define IS_CHAR_CLASS(string) wctype (string)
847 +# define ISWCTYPE(WC, WT) __iswctype (WC, WT)
849 +# define ISWCTYPE(WC, WT) iswctype (WC, WT)
852 +# if (HAVE_MBSTATE_T && HAVE_MBSRTOWCS) || _LIBC
853 +/* In this case we are implementing the multibyte character handling. */
854 +# define HANDLE_MULTIBYTE 1
858 +# define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */
860 +# define IS_CHAR_CLASS(string) \
861 + (STREQ (string, "alpha") || STREQ (string, "upper") \
862 + || STREQ (string, "lower") || STREQ (string, "digit") \
863 + || STREQ (string, "alnum") || STREQ (string, "xdigit") \
864 + || STREQ (string, "space") || STREQ (string, "print") \
865 + || STREQ (string, "punct") || STREQ (string, "graph") \
866 + || STREQ (string, "cntrl") || STREQ (string, "blank"))
869 +/* Avoid depending on library functions or files
870 + whose names are inconsistent. */
872 +/* Global variable. */
873 +static int posixly_correct;
875 +# ifndef internal_function
876 +/* Inside GNU libc we mark some function in a special way. In other
877 + environments simply ignore the marking. */
878 +# define internal_function
881 +/* Note that this evaluates C many times. */
882 +# define FOLD(c) ((flags & FNM_CASEFOLD) ? tolower (c) : (c))
884 +# define UCHAR unsigned char
886 +# define FCT internal_fnmatch
887 +# define EXT ext_match
888 +# define END end_pattern
891 +# define BTOWC(C) __btowc (C)
893 +# define BTOWC(C) btowc (C)
895 +# define STRLEN(S) strlen (S)
896 +# define STRCAT(D, S) strcat (D, S)
898 +# define MEMPCPY(D, S, N) __mempcpy (D, S, N)
901 +# define MEMPCPY(D, S, N) mempcpy (D, S, N)
903 +# define MEMPCPY(D, S, N) ((void *) ((char *) memcpy (D, S, N) + (N)))
906 +# define MEMCHR(S, C, N) memchr (S, C, N)
907 +# define STRCOLL(S1, S2) strcoll (S1, S2)
908 +# include "fnmatch_loop.c"
911 +# if HANDLE_MULTIBYTE
912 +# define FOLD(c) ((flags & FNM_CASEFOLD) ? towlower (c) : (c))
913 +# define CHAR wchar_t
914 +# define UCHAR wint_t
916 +# define FCT internal_fnwmatch
917 +# define EXT ext_wmatch
918 +# define END end_wpattern
919 +# define L_(CS) L##CS
920 +# define BTOWC(C) (C)
922 +# define STRLEN(S) __wcslen (S)
923 +# define STRCAT(D, S) __wcscat (D, S)
924 +# define MEMPCPY(D, S, N) __wmempcpy (D, S, N)
926 +# define STRLEN(S) wcslen (S)
927 +# define STRCAT(D, S) wcscat (D, S)
929 +# define MEMPCPY(D, S, N) wmempcpy (D, S, N)
931 +# define MEMPCPY(D, S, N) (wmemcpy (D, S, N) + (N))
934 +# define MEMCHR(S, C, N) wmemchr (S, C, N)
935 +# define STRCOLL(S1, S2) wcscoll (S1, S2)
936 +# define WIDE_CHAR_VERSION 1
938 +# undef IS_CHAR_CLASS
939 +/* We have to convert the wide character string in a multibyte string. But
940 + we know that the character class names consist of alphanumeric characters
941 + from the portable character set, and since the wide character encoding
942 + for a member of the portable character set is the same code point as
943 + its single-byte encoding, we can use a simplified method to convert the
944 + string to a multibyte character string. */
946 +is_char_class (const wchar_t *wcs)
948 + char s[CHAR_CLASS_MAX_LENGTH + 1];
953 + /* Test for a printable character from the portable character set. */
955 + if (*wcs < 0x20 || *wcs > 0x7e
956 + || *wcs == 0x24 || *wcs == 0x40 || *wcs == 0x60)
957 + return (wctype_t) 0;
961 + case L' ': case L'!': case L'"': case L'#': case L'%':
962 + case L'&': case L'\'': case L'(': case L')': case L'*':
963 + case L'+': case L',': case L'-': case L'.': case L'/':
964 + case L'0': case L'1': case L'2': case L'3': case L'4':
965 + case L'5': case L'6': case L'7': case L'8': case L'9':
966 + case L':': case L';': case L'<': case L'=': case L'>':
968 + case L'A': case L'B': case L'C': case L'D': case L'E':
969 + case L'F': case L'G': case L'H': case L'I': case L'J':
970 + case L'K': case L'L': case L'M': case L'N': case L'O':
971 + case L'P': case L'Q': case L'R': case L'S': case L'T':
972 + case L'U': case L'V': case L'W': case L'X': case L'Y':
974 + case L'[': case L'\\': case L']': case L'^': case L'_':
975 + case L'a': case L'b': case L'c': case L'd': case L'e':
976 + case L'f': case L'g': case L'h': case L'i': case L'j':
977 + case L'k': case L'l': case L'm': case L'n': case L'o':
978 + case L'p': case L'q': case L'r': case L's': case L't':
979 + case L'u': case L'v': case L'w': case L'x': case L'y':
980 + case L'z': case L'{': case L'|': case L'}': case L'~':
983 + return (wctype_t) 0;
987 + /* Avoid overrunning the buffer. */
988 + if (cp == s + CHAR_CLASS_MAX_LENGTH)
989 + return (wctype_t) 0;
991 + *cp++ = (char) *wcs++;
993 + while (*wcs != L'\0');
998 + return __wctype (s);
1000 + return wctype (s);
1003 +# define IS_CHAR_CLASS(string) is_char_class (string)
1005 +# include "fnmatch_loop.c"
1010 +fnmatch (const char *pattern, const char *string, int flags)
1012 +# if HANDLE_MULTIBYTE
1013 +# define ALLOCA_LIMIT 2000
1014 + if (__builtin_expect (MB_CUR_MAX, 1) != 1)
1020 + wchar_t *wpattern;
1024 + /* Calculate the size needed to convert the strings to
1025 + wide characters. */
1026 + memset (&ps, '\0', sizeof (ps));
1027 + patsize = mbsrtowcs (NULL, &pattern, 0, &ps) + 1;
1028 + if (__builtin_expect (patsize != 0, 1))
1030 + assert (mbsinit (&ps));
1031 + strsize = mbsrtowcs (NULL, &string, 0, &ps) + 1;
1032 + if (__builtin_expect (strsize != 0, 1))
1034 + assert (mbsinit (&ps));
1035 + totsize = patsize + strsize;
1036 + if (__builtin_expect (! (patsize <= totsize
1037 + && totsize <= SIZE_MAX / sizeof (wchar_t)),
1044 + /* Allocate room for the wide characters. */
1045 + if (__builtin_expect (totsize < ALLOCA_LIMIT, 1))
1046 + wpattern = (wchar_t *) alloca (totsize * sizeof (wchar_t));
1049 + wpattern = malloc (totsize * sizeof (wchar_t));
1050 + if (__builtin_expect (! wpattern, 0))
1056 + wstring = wpattern + patsize;
1058 + /* Convert the strings into wide characters. */
1059 + mbsrtowcs (wpattern, &pattern, patsize, &ps);
1060 + assert (mbsinit (&ps));
1061 + mbsrtowcs (wstring, &string, strsize, &ps);
1063 + res = internal_fnwmatch (wpattern, wstring, wstring + strsize - 1,
1064 + flags & FNM_PERIOD, flags);
1066 + if (__builtin_expect (! (totsize < ALLOCA_LIMIT), 0))
1073 +# endif /* HANDLE_MULTIBYTE */
1075 + return internal_fnmatch (pattern, string, string + strlen (string),
1076 + flags & FNM_PERIOD, flags);
1081 +versioned_symbol (libc, __fnmatch, fnmatch, GLIBC_2_2_3);
1082 +# if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_2_3)
1083 +strong_alias (__fnmatch, __fnmatch_old)
1084 +compat_symbol (libc, __fnmatch_old, fnmatch, GLIBC_2_0);
1086 +libc_hidden_ver (__fnmatch, fnmatch)
1089 +#endif /* _LIBC or not __GNU_LIBRARY__. */
1090 diff -urN popt-for-windows/lib/fnmatch.in.h popt-for-windows-gnulib/lib/fnmatch.in.h
1091 --- popt-for-windows/lib/fnmatch.in.h 1970-01-01 01:00:00.000000000 +0100
1092 +++ popt-for-windows-gnulib/lib/fnmatch.in.h 2008-10-25 15:17:05.000000000 +0100
1094 +/* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2001, 2002, 2003,
1095 + 2005, 2007 Free Software Foundation, Inc.
1097 + This file is part of the GNU C Library.
1099 + This program is free software; you can redistribute it and/or modify
1100 + it under the terms of the GNU General Public License as published by
1101 + the Free Software Foundation; either version 3, or (at your option)
1102 + any later version.
1104 + This program is distributed in the hope that it will be useful,
1105 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1106 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1107 + GNU General Public License for more details.
1109 + You should have received a copy of the GNU General Public License
1110 + along with this program; if not, write to the Free Software Foundation,
1111 + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
1114 +#define _FNMATCH_H 1
1120 +/* We #undef these before defining them because some losing systems
1121 + (HP-UX A.08.07 for example) define these in <unistd.h>. */
1122 +#undef FNM_PATHNAME
1123 +#undef FNM_NOESCAPE
1126 +/* Bits set in the FLAGS argument to `fnmatch'. */
1127 +#define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */
1128 +#define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */
1129 +#define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */
1131 +#if !defined _POSIX_C_SOURCE || _POSIX_C_SOURCE < 2 || defined _GNU_SOURCE
1132 +# define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */
1133 +# define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */
1134 +# define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */
1135 +# define FNM_EXTMATCH (1 << 5) /* Use ksh-like extended matching. */
1138 +/* Value returned by `fnmatch' if STRING does not match PATTERN. */
1139 +#define FNM_NOMATCH 1
1141 +/* This value is returned if the implementation does not support
1142 + `fnmatch'. Since this is not the case here it will never be
1143 + returned but the conformance test suites still require the symbol
1145 +#ifdef _XOPEN_SOURCE
1146 +# define FNM_NOSYS (-1)
1149 +/* Match NAME against the file name pattern PATTERN,
1150 + returning zero if it matches, FNM_NOMATCH if not. */
1151 +extern int fnmatch (const char *__pattern, const char *__name,
1158 +#endif /* fnmatch.h */
1159 diff -urN popt-for-windows/lib/fnmatch_loop.c popt-for-windows-gnulib/lib/fnmatch_loop.c
1160 --- popt-for-windows/lib/fnmatch_loop.c 1970-01-01 01:00:00.000000000 +0100
1161 +++ popt-for-windows-gnulib/lib/fnmatch_loop.c 2008-10-25 15:17:05.000000000 +0100
1163 +/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006
1164 + Free Software Foundation, Inc.
1165 + This file is part of the GNU C Library.
1167 + This program is free software; you can redistribute it and/or modify
1168 + it under the terms of the GNU General Public License as published by
1169 + the Free Software Foundation; either version 3, or (at your option)
1170 + any later version.
1172 + This program is distributed in the hope that it will be useful,
1173 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1174 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1175 + GNU General Public License for more details.
1177 + You should have received a copy of the GNU General Public License
1178 + along with this program; if not, write to the Free Software Foundation,
1179 + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
1181 +/* Match STRING against the file name pattern PATTERN, returning zero if
1182 + it matches, nonzero if not. */
1183 +static int EXT (INT opt, const CHAR *pattern, const CHAR *string,
1184 + const CHAR *string_end, bool no_leading_period, int flags)
1185 + internal_function;
1186 +static const CHAR *END (const CHAR *patternp) internal_function;
1190 +FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
1191 + bool no_leading_period, int flags)
1193 + register const CHAR *p = pattern, *n = string;
1196 +# if WIDE_CHAR_VERSION
1197 + const char *collseq = (const char *)
1198 + _NL_CURRENT(LC_COLLATE, _NL_COLLATE_COLLSEQWC);
1200 + const UCHAR *collseq = (const UCHAR *)
1201 + _NL_CURRENT(LC_COLLATE, _NL_COLLATE_COLLSEQMB);
1205 + while ((c = *p++) != L_('\0'))
1207 + bool new_no_leading_period = false;
1213 + if (__builtin_expect (flags & FNM_EXTMATCH, 0) && *p == '(')
1217 + res = EXT (c, p, n, string_end, no_leading_period,
1223 + if (n == string_end)
1224 + return FNM_NOMATCH;
1225 + else if (*n == L_('/') && (flags & FNM_FILE_NAME))
1226 + return FNM_NOMATCH;
1227 + else if (*n == L_('.') && no_leading_period)
1228 + return FNM_NOMATCH;
1232 + if (!(flags & FNM_NOESCAPE))
1235 + if (c == L_('\0'))
1236 + /* Trailing \ loses. */
1237 + return FNM_NOMATCH;
1240 + if (n == string_end || FOLD ((UCHAR) *n) != c)
1241 + return FNM_NOMATCH;
1245 + if (__builtin_expect (flags & FNM_EXTMATCH, 0) && *p == '(')
1249 + res = EXT (c, p, n, string_end, no_leading_period,
1255 + if (n != string_end && *n == L_('.') && no_leading_period)
1256 + return FNM_NOMATCH;
1258 + for (c = *p++; c == L_('?') || c == L_('*'); c = *p++)
1260 + if (*p == L_('(') && (flags & FNM_EXTMATCH) != 0)
1262 + const CHAR *endp = END (p);
1265 + /* This is a pattern. Skip over it. */
1273 + /* A ? needs to match one character. */
1274 + if (n == string_end)
1275 + /* There isn't another character; no match. */
1276 + return FNM_NOMATCH;
1277 + else if (*n == L_('/')
1278 + && __builtin_expect (flags & FNM_FILE_NAME, 0))
1279 + /* A slash does not match a wildcard under
1281 + return FNM_NOMATCH;
1283 + /* One character of the string is consumed in matching
1284 + this ? wildcard, so *??? won't match if there are
1285 + less than three characters. */
1290 + if (c == L_('\0'))
1291 + /* The wildcard(s) is/are the last element of the pattern.
1292 + If the name is a file name and contains another slash
1293 + this means it cannot match, unless the FNM_LEADING_DIR
1296 + int result = (flags & FNM_FILE_NAME) == 0 ? 0 : FNM_NOMATCH;
1298 + if (flags & FNM_FILE_NAME)
1300 + if (flags & FNM_LEADING_DIR)
1304 + if (MEMCHR (n, L_('/'), string_end - n) == NULL)
1315 + endp = MEMCHR (n, (flags & FNM_FILE_NAME) ? L_('/') : L_('\0'),
1318 + endp = string_end;
1321 + || (__builtin_expect (flags & FNM_EXTMATCH, 0) != 0
1322 + && (c == L_('@') || c == L_('+') || c == L_('!'))
1323 + && *p == L_('(')))
1325 + int flags2 = ((flags & FNM_FILE_NAME)
1326 + ? flags : (flags & ~FNM_PERIOD));
1327 + bool no_leading_period2 = no_leading_period;
1329 + for (--p; n < endp; ++n, no_leading_period2 = false)
1330 + if (FCT (p, n, string_end, no_leading_period2, flags2)
1334 + else if (c == L_('/') && (flags & FNM_FILE_NAME))
1336 + while (n < string_end && *n != L_('/'))
1338 + if (n < string_end && *n == L_('/')
1339 + && (FCT (p, n + 1, string_end, flags & FNM_PERIOD, flags)
1345 + int flags2 = ((flags & FNM_FILE_NAME)
1346 + ? flags : (flags & ~FNM_PERIOD));
1347 + int no_leading_period2 = no_leading_period;
1349 + if (c == L_('\\') && !(flags & FNM_NOESCAPE))
1352 + for (--p; n < endp; ++n, no_leading_period2 = false)
1353 + if (FOLD ((UCHAR) *n) == c
1354 + && (FCT (p, n, string_end, no_leading_period2, flags2)
1360 + /* If we come here no match is possible with the wildcard. */
1361 + return FNM_NOMATCH;
1365 + /* Nonzero if the sense of the character class is inverted. */
1366 + register bool not;
1370 + if (posixly_correct == 0)
1371 + posixly_correct = getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1;
1373 + if (n == string_end)
1374 + return FNM_NOMATCH;
1376 + if (*n == L_('.') && no_leading_period)
1377 + return FNM_NOMATCH;
1379 + if (*n == L_('/') && (flags & FNM_FILE_NAME))
1380 + /* `/' cannot be matched. */
1381 + return FNM_NOMATCH;
1383 + not = (*p == L_('!') || (posixly_correct < 0 && *p == L_('^')));
1387 + fn = FOLD ((UCHAR) *n);
1392 + if (!(flags & FNM_NOESCAPE) && c == L_('\\'))
1394 + if (*p == L_('\0'))
1395 + return FNM_NOMATCH;
1396 + c = FOLD ((UCHAR) *p);
1399 + goto normal_bracket;
1401 + else if (c == L_('[') && *p == L_(':'))
1403 + /* Leave room for the null. */
1404 + CHAR str[CHAR_CLASS_MAX_LENGTH + 1];
1406 +#if defined _LIBC || WIDE_CHAR_SUPPORT
1409 + const CHAR *startp = p;
1413 + if (c1 == CHAR_CLASS_MAX_LENGTH)
1414 + /* The name is too long and therefore the pattern
1416 + return FNM_NOMATCH;
1419 + if (c == L_(':') && p[1] == L_(']'))
1424 + if (c < L_('a') || c >= L_('z'))
1426 + /* This cannot possibly be a character class name.
1427 + Match it as a normal range. */
1430 + goto normal_bracket;
1434 + str[c1] = L_('\0');
1436 +#if defined _LIBC || WIDE_CHAR_SUPPORT
1437 + wt = IS_CHAR_CLASS (str);
1439 + /* Invalid character class name. */
1440 + return FNM_NOMATCH;
1442 +# if defined _LIBC && ! WIDE_CHAR_VERSION
1443 + /* The following code is glibc specific but does
1444 + there a good job in speeding up the code since
1445 + we can avoid the btowc() call. */
1446 + if (_ISCTYPE ((UCHAR) *n, wt))
1449 + if (ISWCTYPE (BTOWC ((UCHAR) *n), wt))
1453 + if ((STREQ (str, L_("alnum")) && isalnum ((UCHAR) *n))
1454 + || (STREQ (str, L_("alpha")) && isalpha ((UCHAR) *n))
1455 + || (STREQ (str, L_("blank")) && isblank ((UCHAR) *n))
1456 + || (STREQ (str, L_("cntrl")) && iscntrl ((UCHAR) *n))
1457 + || (STREQ (str, L_("digit")) && isdigit ((UCHAR) *n))
1458 + || (STREQ (str, L_("graph")) && isgraph ((UCHAR) *n))
1459 + || (STREQ (str, L_("lower")) && islower ((UCHAR) *n))
1460 + || (STREQ (str, L_("print")) && isprint ((UCHAR) *n))
1461 + || (STREQ (str, L_("punct")) && ispunct ((UCHAR) *n))
1462 + || (STREQ (str, L_("space")) && isspace ((UCHAR) *n))
1463 + || (STREQ (str, L_("upper")) && isupper ((UCHAR) *n))
1464 + || (STREQ (str, L_("xdigit")) && isxdigit ((UCHAR) *n)))
1470 + else if (c == L_('[') && *p == L_('='))
1474 + _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
1475 + const CHAR *startp = p;
1478 + if (c == L_('\0'))
1482 + goto normal_bracket;
1487 + if (c != L_('=') || p[1] != L_(']'))
1491 + goto normal_bracket;
1497 + if ((UCHAR) *n == str[0])
1502 + const int32_t *table;
1503 +# if WIDE_CHAR_VERSION
1504 + const int32_t *weights;
1505 + const int32_t *extra;
1507 + const unsigned char *weights;
1508 + const unsigned char *extra;
1510 + const int32_t *indirect;
1512 + const UCHAR *cp = (const UCHAR *) str;
1514 + /* This #include defines a local function! */
1515 +# if WIDE_CHAR_VERSION
1516 +# include <locale/weightwc.h>
1518 +# include <locale/weight.h>
1521 +# if WIDE_CHAR_VERSION
1522 + table = (const int32_t *)
1523 + _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEWC);
1524 + weights = (const int32_t *)
1525 + _NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTWC);
1526 + extra = (const int32_t *)
1527 + _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAWC);
1528 + indirect = (const int32_t *)
1529 + _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTWC);
1531 + table = (const int32_t *)
1532 + _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
1533 + weights = (const unsigned char *)
1534 + _NL_CURRENT (LC_COLLATE, _NL_COLLATE_WEIGHTMB);
1535 + extra = (const unsigned char *)
1536 + _NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB);
1537 + indirect = (const int32_t *)
1538 + _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB);
1541 + idx = findidx (&cp);
1544 + /* We found a table entry. Now see whether the
1545 + character we are currently at has the same
1546 + equivalance class value. */
1547 + int len = weights[idx];
1549 + const UCHAR *np = (const UCHAR *) n;
1551 + idx2 = findidx (&np);
1552 + if (idx2 != 0 && len == weights[idx2])
1557 + && (weights[idx + 1 + cnt]
1558 + == weights[idx2 + 1 + cnt]))
1570 + else if (c == L_('\0'))
1571 + /* [ (unterminated) loses. */
1572 + return FNM_NOMATCH;
1575 + bool is_range = false;
1578 + bool is_seqval = false;
1580 + if (c == L_('[') && *p == L_('.'))
1583 + _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
1584 + const CHAR *startp = p;
1590 + if (c == L_('.') && p[1] == L_(']'))
1596 + return FNM_NOMATCH;
1600 + /* We have to handling the symbols differently in
1601 + ranges since then the collation sequence is
1603 + is_range = *p == L_('-') && p[1] != L_('\0');
1607 + /* There are no names defined in the collation
1608 + data. Therefore we only accept the trivial
1609 + names consisting of the character itself. */
1611 + return FNM_NOMATCH;
1613 + if (!is_range && *n == startp[1])
1621 + int32_t table_size;
1622 + const int32_t *symb_table;
1623 +# ifdef WIDE_CHAR_VERSION
1627 +# define str (startp + 1)
1629 + const unsigned char *extra;
1635 +# ifdef WIDE_CHAR_VERSION
1636 + /* We have to convert the name to a single-byte
1637 + string. This is possible since the names
1638 + consist of ASCII characters and the internal
1639 + representation is UCS4. */
1640 + for (strcnt = 0; strcnt < c1; ++strcnt)
1641 + str[strcnt] = startp[1 + strcnt];
1645 + _NL_CURRENT_WORD (LC_COLLATE,
1646 + _NL_COLLATE_SYMB_HASH_SIZEMB);
1647 + symb_table = (const int32_t *)
1648 + _NL_CURRENT (LC_COLLATE,
1649 + _NL_COLLATE_SYMB_TABLEMB);
1650 + extra = (const unsigned char *)
1651 + _NL_CURRENT (LC_COLLATE,
1652 + _NL_COLLATE_SYMB_EXTRAMB);
1654 + /* Locate the character in the hashing table. */
1655 + hash = elem_hash (str, c1);
1658 + elem = hash % table_size;
1659 + if (symb_table[2 * elem] != 0)
1661 + second = hash % (table_size - 2) + 1;
1665 + /* First compare the hashing value. */
1666 + if (symb_table[2 * elem] == hash
1668 + == extra[symb_table[2 * elem + 1]])
1670 + &extra[symb_table[2 * elem
1674 + /* Yep, this is the entry. */
1675 + idx = symb_table[2 * elem + 1];
1676 + idx += 1 + extra[idx];
1683 + while (symb_table[2 * elem] != 0);
1686 + if (symb_table[2 * elem] != 0)
1688 + /* Compare the byte sequence but only if
1689 + this is not part of a range. */
1690 +# ifdef WIDE_CHAR_VERSION
1693 + idx += 1 + extra[idx];
1694 + /* Adjust for the alignment. */
1695 + idx = (idx + 3) & ~3;
1697 + wextra = (int32_t *) &extra[idx + 4];
1702 +# ifdef WIDE_CHAR_VERSION
1704 + (int32_t) c1 < wextra[idx];
1706 + if (n[c1] != wextra[1 + c1])
1709 + if ((int32_t) c1 == wextra[idx])
1712 + for (c1 = 0; c1 < extra[idx]; ++c1)
1713 + if (n[c1] != extra[1 + c1])
1716 + if (c1 == extra[idx])
1721 + /* Get the collation sequence value. */
1723 +# ifdef WIDE_CHAR_VERSION
1724 + cold = wextra[1 + wextra[idx]];
1726 + /* Adjust for the alignment. */
1727 + idx += 1 + extra[idx];
1728 + idx = (idx + 3) & ~4;
1729 + cold = *((int32_t *) &extra[idx]);
1736 + /* No valid character. Match it as a
1738 + if (!is_range && *n == str[0])
1745 + return FNM_NOMATCH;
1755 + /* We have to handling the symbols differently in
1756 + ranges since then the collation sequence is
1758 + is_range = (*p == L_('-') && p[1] != L_('\0')
1759 + && p[1] != L_(']'));
1761 + if (!is_range && c == fn)
1765 + /* This is needed if we goto normal_bracket; from
1766 + outside of is_seqval's scope. */
1767 + is_seqval = false;
1774 + if (c == L_('-') && *p != L_(']'))
1777 + /* We have to find the collation sequence
1778 + value for C. Collation sequence is nothing
1779 + we can regularly access. The sequence
1780 + value is defined by the order in which the
1781 + definitions of the collation values for the
1782 + various characters appear in the source
1783 + file. A strange concept, nowhere
1785 + uint32_t fcollseq;
1786 + uint32_t lcollseq;
1787 + UCHAR cend = *p++;
1789 +# ifdef WIDE_CHAR_VERSION
1790 + /* Search in the `names' array for the characters. */
1791 + fcollseq = __collseq_table_lookup (collseq, fn);
1792 + if (fcollseq == ~((uint32_t) 0))
1793 + /* XXX We don't know anything about the character
1794 + we are supposed to match. This means we are
1796 + goto range_not_matched;
1801 + lcollseq = __collseq_table_lookup (collseq, cold);
1803 + fcollseq = collseq[fn];
1804 + lcollseq = is_seqval ? cold : collseq[(UCHAR) cold];
1807 + is_seqval = false;
1808 + if (cend == L_('[') && *p == L_('.'))
1811 + _NL_CURRENT_WORD (LC_COLLATE,
1812 + _NL_COLLATE_NRULES);
1813 + const CHAR *startp = p;
1819 + if (c == L_('.') && p[1] == L_(']'))
1825 + return FNM_NOMATCH;
1831 + /* There are no names defined in the
1832 + collation data. Therefore we only
1833 + accept the trivial names consisting
1834 + of the character itself. */
1836 + return FNM_NOMATCH;
1842 + int32_t table_size;
1843 + const int32_t *symb_table;
1844 +# ifdef WIDE_CHAR_VERSION
1848 +# define str (startp + 1)
1850 + const unsigned char *extra;
1856 +# ifdef WIDE_CHAR_VERSION
1857 + /* We have to convert the name to a single-byte
1858 + string. This is possible since the names
1859 + consist of ASCII characters and the internal
1860 + representation is UCS4. */
1861 + for (strcnt = 0; strcnt < c1; ++strcnt)
1862 + str[strcnt] = startp[1 + strcnt];
1866 + _NL_CURRENT_WORD (LC_COLLATE,
1867 + _NL_COLLATE_SYMB_HASH_SIZEMB);
1868 + symb_table = (const int32_t *)
1869 + _NL_CURRENT (LC_COLLATE,
1870 + _NL_COLLATE_SYMB_TABLEMB);
1871 + extra = (const unsigned char *)
1872 + _NL_CURRENT (LC_COLLATE,
1873 + _NL_COLLATE_SYMB_EXTRAMB);
1875 + /* Locate the character in the hashing
1877 + hash = elem_hash (str, c1);
1880 + elem = hash % table_size;
1881 + if (symb_table[2 * elem] != 0)
1883 + second = hash % (table_size - 2) + 1;
1887 + /* First compare the hashing value. */
1888 + if (symb_table[2 * elem] == hash
1890 + == extra[symb_table[2 * elem + 1]])
1892 + &extra[symb_table[2 * elem + 1]
1895 + /* Yep, this is the entry. */
1896 + idx = symb_table[2 * elem + 1];
1897 + idx += 1 + extra[idx];
1904 + while (symb_table[2 * elem] != 0);
1907 + if (symb_table[2 * elem] != 0)
1909 + /* Compare the byte sequence but only if
1910 + this is not part of a range. */
1911 +# ifdef WIDE_CHAR_VERSION
1914 + idx += 1 + extra[idx];
1915 + /* Adjust for the alignment. */
1916 + idx = (idx + 3) & ~4;
1918 + wextra = (int32_t *) &extra[idx + 4];
1920 + /* Get the collation sequence value. */
1922 +# ifdef WIDE_CHAR_VERSION
1923 + cend = wextra[1 + wextra[idx]];
1925 + /* Adjust for the alignment. */
1926 + idx += 1 + extra[idx];
1927 + idx = (idx + 3) & ~4;
1928 + cend = *((int32_t *) &extra[idx]);
1931 + else if (symb_table[2 * elem] != 0 && c1 == 1)
1937 + return FNM_NOMATCH;
1943 + if (!(flags & FNM_NOESCAPE) && cend == L_('\\'))
1945 + if (cend == L_('\0'))
1946 + return FNM_NOMATCH;
1947 + cend = FOLD (cend);
1950 + /* XXX It is not entirely clear to me how to handle
1951 + characters which are not mentioned in the
1952 + collation specification. */
1954 +# ifdef WIDE_CHAR_VERSION
1955 + lcollseq == 0xffffffff ||
1957 + lcollseq <= fcollseq)
1959 + /* We have to look at the upper bound. */
1960 + uint32_t hcollseq;
1966 +# ifdef WIDE_CHAR_VERSION
1968 + __collseq_table_lookup (collseq, cend);
1969 + if (hcollseq == ~((uint32_t) 0))
1971 + /* Hum, no information about the upper
1972 + bound. The matching succeeds if the
1973 + lower bound is matched exactly. */
1974 + if (lcollseq != fcollseq)
1975 + goto range_not_matched;
1980 + hcollseq = collseq[cend];
1984 + if (lcollseq <= hcollseq && fcollseq <= hcollseq)
1987 +# ifdef WIDE_CHAR_VERSION
1988 + range_not_matched:
1991 + /* We use a boring value comparison of the character
1992 + values. This is better than comparing using
1993 + `strcoll' since the latter would have surprising
1994 + and sometimes fatal consequences. */
1995 + UCHAR cend = *p++;
1997 + if (!(flags & FNM_NOESCAPE) && cend == L_('\\'))
1999 + if (cend == L_('\0'))
2000 + return FNM_NOMATCH;
2002 + /* It is a range. */
2003 + if (cold <= fn && fn <= cend)
2016 + return FNM_NOMATCH;
2020 + /* Skip the rest of the [...] that already matched. */
2026 + if (c == L_('\0'))
2027 + /* [... (unterminated) loses. */
2028 + return FNM_NOMATCH;
2030 + if (!(flags & FNM_NOESCAPE) && c == L_('\\'))
2032 + if (*p == L_('\0'))
2033 + return FNM_NOMATCH;
2034 + /* XXX 1003.2d11 is unclear if this is right. */
2037 + else if (c == L_('[') && *p == L_(':'))
2040 + const CHAR *startp = p;
2045 + if (++c1 == CHAR_CLASS_MAX_LENGTH)
2046 + return FNM_NOMATCH;
2048 + if (*p == L_(':') && p[1] == L_(']'))
2051 + if (c < L_('a') || c >= L_('z'))
2060 + else if (c == L_('[') && *p == L_('='))
2063 + if (c == L_('\0'))
2064 + return FNM_NOMATCH;
2066 + if (c != L_('=') || p[1] != L_(']'))
2067 + return FNM_NOMATCH;
2071 + else if (c == L_('[') && *p == L_('.'))
2078 + return FNM_NOMATCH;
2080 + if (*p == L_('.') && p[1] == L_(']'))
2087 + while (c != L_(']'));
2089 + return FNM_NOMATCH;
2096 + if (__builtin_expect (flags & FNM_EXTMATCH, 0) && *p == '(')
2100 + res = EXT (c, p, n, string_end, no_leading_period, flags);
2104 + goto normal_match;
2107 + if (NO_LEADING_PERIOD (flags))
2109 + if (n == string_end || c != (UCHAR) *n)
2110 + return FNM_NOMATCH;
2112 + new_no_leading_period = true;
2118 + if (n == string_end || c != FOLD ((UCHAR) *n))
2119 + return FNM_NOMATCH;
2122 + no_leading_period = new_no_leading_period;
2126 + if (n == string_end)
2129 + if ((flags & FNM_LEADING_DIR) && n != string_end && *n == L_('/'))
2130 + /* The FNM_LEADING_DIR flag says that "foo*" matches "foobar/frobozz". */
2133 + return FNM_NOMATCH;
2137 +static const CHAR *
2139 +END (const CHAR *pattern)
2141 + const CHAR *p = pattern;
2144 + if (*++p == L_('\0'))
2145 + /* This is an invalid pattern. */
2147 + else if (*p == L_('['))
2149 + /* Handle brackets special. */
2150 + if (posixly_correct == 0)
2151 + posixly_correct = getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1;
2153 + /* Skip the not sign. We have to recognize it because of a possibly
2155 + if (*++p == L_('!') || (posixly_correct < 0 && *p == L_('^')))
2157 + /* A leading ']' is recognized as such. */
2158 + if (*p == L_(']'))
2160 + /* Skip over all characters of the list. */
2161 + while (*p != L_(']'))
2162 + if (*p++ == L_('\0'))
2163 + /* This is no valid pattern. */
2166 + else if ((*p == L_('?') || *p == L_('*') || *p == L_('+') || *p == L_('@')
2167 + || *p == L_('!')) && p[1] == L_('('))
2169 + else if (*p == L_(')'))
2178 +EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end,
2179 + bool no_leading_period, int flags)
2181 + const CHAR *startp;
2183 + struct patternlist
2185 + struct patternlist *next;
2188 + struct patternlist **lastp = &list;
2189 + size_t pattern_len = STRLEN (pattern);
2192 + enum { ALLOCA_LIMIT = 8000 };
2194 + /* Parse the pattern. Store the individual parts in the list. */
2196 + for (startp = p = pattern + 1; ; ++p)
2197 + if (*p == L_('\0'))
2198 + /* This is an invalid pattern. */
2200 + else if (*p == L_('['))
2202 + /* Handle brackets special. */
2203 + if (posixly_correct == 0)
2204 + posixly_correct = getenv ("POSIXLY_CORRECT") != NULL ? 1 : -1;
2206 + /* Skip the not sign. We have to recognize it because of a possibly
2208 + if (*++p == L_('!') || (posixly_correct < 0 && *p == L_('^')))
2210 + /* A leading ']' is recognized as such. */
2211 + if (*p == L_(']'))
2213 + /* Skip over all characters of the list. */
2214 + while (*p != L_(']'))
2215 + if (*p++ == L_('\0'))
2216 + /* This is no valid pattern. */
2219 + else if ((*p == L_('?') || *p == L_('*') || *p == L_('+') || *p == L_('@')
2220 + || *p == L_('!')) && p[1] == L_('('))
2221 + /* Remember the nesting level. */
2223 + else if (*p == L_(')'))
2227 + /* This means we found the end of the pattern. */
2228 +#define NEW_PATTERN \
2229 + struct patternlist *newp; \
2231 + size_t plensize; \
2232 + size_t newpsize; \
2234 + plen = (opt == L_('?') || opt == L_('@') \
2236 + : p - startp + 1); \
2237 + plensize = plen * sizeof (CHAR); \
2238 + newpsize = offsetof (struct patternlist, str) + plensize; \
2239 + if ((size_t) -1 / sizeof (CHAR) < plen \
2240 + || newpsize < offsetof (struct patternlist, str) \
2241 + || ALLOCA_LIMIT <= newpsize) \
2243 + newp = (struct patternlist *) alloca (newpsize); \
2244 + *((CHAR *) MEMPCPY (newp->str, startp, p - startp)) = L_('\0'); \
2245 + newp->next = NULL; \
2247 + lastp = &newp->next
2252 + else if (*p == L_('|'))
2260 + assert (list != NULL);
2261 + assert (p[-1] == L_(')'));
2267 + if (FCT (p, string, string_end, no_leading_period, flags) == 0)
2274 + for (rs = string; rs <= string_end; ++rs)
2275 + /* First match the prefix with the current pattern with the
2276 + current pattern. */
2277 + if (FCT (list->str, string, rs, no_leading_period,
2278 + flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD) == 0
2279 + /* This was successful. Now match the rest with the rest
2280 + of the pattern. */
2281 + && (FCT (p, rs, string_end,
2283 + ? no_leading_period
2284 + : rs[-1] == '/' && NO_LEADING_PERIOD (flags),
2285 + flags & FNM_FILE_NAME
2286 + ? flags : flags & ~FNM_PERIOD) == 0
2287 + /* This didn't work. Try the whole pattern. */
2289 + && FCT (pattern - 1, rs, string_end,
2291 + ? no_leading_period
2292 + : rs[-1] == '/' && NO_LEADING_PERIOD (flags),
2293 + flags & FNM_FILE_NAME
2294 + ? flags : flags & ~FNM_PERIOD) == 0)))
2295 + /* It worked. Signal success. */
2298 + while ((list = list->next) != NULL);
2300 + /* None of the patterns lead to a match. */
2301 + return FNM_NOMATCH;
2304 + if (FCT (p, string, string_end, no_leading_period, flags) == 0)
2310 + /* I cannot believe it but `strcat' is actually acceptable
2311 + here. Match the entire string with the prefix from the
2312 + pattern list and the rest of the pattern following the
2314 + if (FCT (STRCAT (list->str, p), string, string_end,
2315 + no_leading_period,
2316 + flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD) == 0)
2317 + /* It worked. Signal success. */
2319 + while ((list = list->next) != NULL);
2321 + /* None of the patterns lead to a match. */
2322 + return FNM_NOMATCH;
2325 + for (rs = string; rs <= string_end; ++rs)
2327 + struct patternlist *runp;
2329 + for (runp = list; runp != NULL; runp = runp->next)
2330 + if (FCT (runp->str, string, rs, no_leading_period,
2331 + flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD) == 0)
2334 + /* If none of the patterns matched see whether the rest does. */
2336 + && (FCT (p, rs, string_end,
2338 + ? no_leading_period
2339 + : rs[-1] == '/' && NO_LEADING_PERIOD (flags),
2340 + flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD)
2342 + /* This is successful. */
2346 + /* None of the patterns together with the rest of the pattern
2347 + lead to a match. */
2348 + return FNM_NOMATCH;
2351 + assert (! "Invalid extended matching operator");
2373 diff -urN popt-for-windows/lib/getlogin_r.c popt-for-windows-gnulib/lib/getlogin_r.c
2374 --- popt-for-windows/lib/getlogin_r.c 1970-01-01 01:00:00.000000000 +0100
2375 +++ popt-for-windows-gnulib/lib/getlogin_r.c 2008-10-25 15:17:05.000000000 +0100
2377 +/* Provide a working getlogin_r for systems which lack it.
2379 + Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
2381 + This program is free software; you can redistribute it and/or modify
2382 + it under the terms of the GNU General Public License as published by
2383 + the Free Software Foundation; either version 3, or (at your option)
2384 + any later version.
2386 + This program is distributed in the hope that it will be useful,
2387 + but WITHOUT ANY WARRANTY; without even the implied warranty of
2388 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2389 + GNU General Public License for more details.
2391 + You should have received a copy of the GNU General Public License
2392 + along with this program; if not, write to the Free Software Foundation,
2393 + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
2395 +/* written by Paul Eggert and Derek Price */
2397 +#include <config.h>
2399 +/* Specification. */
2400 +#include <unistd.h>
2403 +#include <string.h>
2405 +#if !HAVE_DECL_GETLOGIN
2406 +char *getlogin (void);
2409 +/* See unistd.in.h for documentation. */
2411 +getlogin_r (char *name, size_t size)
2419 + /* A system function like getlogin_r is never supposed to set errno
2420 + to zero, so make sure errno is nonzero here. ENOENT is a
2421 + reasonable errno value if getlogin returns NULL. */
2427 + nlen = strlen (n);
2430 + memcpy (name, n, nlen + 1);
2433 diff -urN popt-for-windows/lib/glob.c popt-for-windows-gnulib/lib/glob.c
2434 --- popt-for-windows/lib/glob.c 1970-01-01 01:00:00.000000000 +0100
2435 +++ popt-for-windows-gnulib/lib/glob.c 2008-10-25 15:17:05.000000000 +0100
2437 +/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006, 2007, 2008
2438 + Free Software Foundation, Inc.
2439 + This file is part of the GNU C Library.
2441 + The GNU C Library is free software; you can redistribute it and/or
2442 + modify it under the terms of the GNU General Public
2443 + License as published by the Free Software Foundation; either
2444 + version 3 of the License, or (at your option) any later version.
2446 + The GNU C Library is distributed in the hope that it will be useful,
2447 + but WITHOUT ANY WARRANTY; without even the implied warranty of
2448 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2449 + Lesser General Public License for more details.
2451 + You should have received a copy of the GNU General Public
2452 + License along with the GNU C Library; if not, write to the Free
2453 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
2454 + 02111-1307 USA. */
2457 +# include <config.h>
2463 +#include <sys/types.h>
2464 +#include <sys/stat.h>
2465 +#include <stddef.h>
2467 +/* Outcomment the following line for production quality code. */
2468 +/* #define NDEBUG 1 */
2469 +#include <assert.h>
2471 +#include <stdbool.h>
2473 +#include <stdio.h> /* Needed on stupid SunOS for assert. */
2475 +#if !defined _LIBC || !defined GLOB_ONLY_P
2477 +#include <unistd.h>
2478 +#if !defined POSIX && defined _POSIX_VERSION
2482 +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
2491 +#ifndef __set_errno
2492 +# define __set_errno(val) errno = (val)
2495 +#include <dirent.h>
2498 +/* In GNU systems, <dirent.h> defines this macro for us. */
2499 +#ifndef _D_EXACT_NAMLEN
2500 +# define _D_EXACT_NAMLEN(dirent) strlen ((dirent)->d_name)
2503 +/* When used in the GNU libc the symbol _DIRENT_HAVE_D_TYPE is available
2504 + if the `d_type' member for `struct dirent' is available.
2505 + HAVE_STRUCT_DIRENT_D_TYPE plays the same role in GNULIB. */
2506 +#if defined _DIRENT_HAVE_D_TYPE || defined HAVE_STRUCT_DIRENT_D_TYPE
2507 +/* True if the directory entry D must be of type T. */
2508 +# define DIRENT_MUST_BE(d, t) ((d)->d_type == (t))
2510 +/* True if the directory entry D might be a symbolic link. */
2511 +# define DIRENT_MIGHT_BE_SYMLINK(d) \
2512 + ((d)->d_type == DT_UNKNOWN || (d)->d_type == DT_LNK)
2514 +/* True if the directory entry D might be a directory. */
2515 +# define DIRENT_MIGHT_BE_DIR(d) \
2516 + ((d)->d_type == DT_DIR || DIRENT_MIGHT_BE_SYMLINK (d))
2518 +#else /* !HAVE_D_TYPE */
2519 +# define DIRENT_MUST_BE(d, t) false
2520 +# define DIRENT_MIGHT_BE_SYMLINK(d) true
2521 +# define DIRENT_MIGHT_BE_DIR(d) true
2522 +#endif /* HAVE_D_TYPE */
2524 +/* If the system has the `struct dirent64' type we use it internally. */
2525 +#if defined _LIBC && !defined COMPILE_GLOB64
2526 +# if (defined POSIX || defined WINDOWS32) && !defined __GNU_LIBRARY__
2527 +# define CONVERT_D_INO(d64, d32)
2529 +# define CONVERT_D_INO(d64, d32) \
2530 + (d64)->d_ino = (d32)->d_ino;
2533 +# ifdef _DIRENT_HAVE_D_TYPE
2534 +# define CONVERT_D_TYPE(d64, d32) \
2535 + (d64)->d_type = (d32)->d_type;
2537 +# define CONVERT_D_TYPE(d64, d32)
2540 +# define CONVERT_DIRENT_DIRENT64(d64, d32) \
2541 + memcpy ((d64)->d_name, (d32)->d_name, _D_EXACT_NAMLEN (d32) + 1); \
2542 + CONVERT_D_INO (d64, d32) \
2543 + CONVERT_D_TYPE (d64, d32)
2547 +#if (defined POSIX || defined WINDOWS32) && !defined __GNU_LIBRARY__
2548 +/* Posix does not require that the d_ino field be present, and some
2549 + systems do not provide it. */
2550 +# define REAL_DIR_ENTRY(dp) 1
2552 +# define REAL_DIR_ENTRY(dp) (dp->d_ino != 0)
2555 +#include <stdlib.h>
2556 +#include <string.h>
2558 +/* NAME_MAX is usually defined in <dirent.h> or <limits.h>. */
2559 +#include <limits.h>
2561 +# define NAME_MAX (sizeof (((struct dirent *) 0)->d_name))
2564 +#include <alloca.h>
2568 +# define strdup(str) __strdup (str)
2569 +# define sysconf(id) __sysconf (id)
2570 +# define closedir(dir) __closedir (dir)
2571 +# define opendir(name) __opendir (name)
2572 +# define readdir(str) __readdir64 (str)
2573 +# define getpwnam_r(name, bufp, buf, len, res) \
2574 + __getpwnam_r (name, bufp, buf, len, res)
2576 +# define __stat64(fname, buf) __xstat64 (_STAT_VER, fname, buf)
2578 +# define struct_stat64 struct stat64
2580 +# define __stat64(fname, buf) stat (fname, buf)
2581 +# define __fxstatat64(_, d, f, st, flag) fstatat (d, f, st, flag)
2582 +# define struct_stat64 struct stat
2583 +# define __stat(fname, buf) stat (fname, buf)
2584 +# define __alloca alloca
2585 +# define __readdir readdir
2586 +# define __readdir64 readdir64
2587 +# define __glob_pattern_p glob_pattern_p
2590 +#include <fnmatch.h>
2592 +#ifdef _SC_GETPW_R_SIZE_MAX
2593 +# define GETPW_R_SIZE_MAX() sysconf (_SC_GETPW_R_SIZE_MAX)
2595 +# define GETPW_R_SIZE_MAX() (-1)
2597 +#ifdef _SC_LOGIN_NAME_MAX
2598 +# define GET_LOGIN_NAME_MAX() sysconf (_SC_LOGIN_NAME_MAX)
2600 +# define GET_LOGIN_NAME_MAX() (-1)
2603 +static const char *next_brace_sub (const char *begin, int flags) __THROW;
2605 +#endif /* !defined _LIBC || !defined GLOB_ONLY_P */
2607 +#ifndef attribute_hidden
2608 +# define attribute_hidden
2611 +#ifndef __attribute_noinline__
2612 +# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 1)
2613 +# define __attribute_noinline__ /* Ignore */
2615 +# define __attribute_noinline__ __attribute__ ((__noinline__))
2619 +#if ! defined __builtin_expect && __GNUC__ < 3
2620 +# define __builtin_expect(expr, expected) (expr)
2624 +/* The results of opendir() in this file are not used with dirfd and fchdir,
2625 + therefore save some unnecessary work in fchdir.c. */
2630 +/* The OS usually guarantees only one guard page at the bottom of the stack,
2631 + and a page size can be as small as 4096 bytes. So we cannot safely
2632 + allocate anything larger than 4096 bytes. Also care for the possibility
2633 + of a few compiler-allocated temporary stack slots. */
2634 +# define __libc_use_alloca(n) ((n) < 4032)
2636 +/* alloca is implemented with malloc, so just use malloc. */
2637 +# define __libc_use_alloca(n) 0
2641 +static int glob_in_dir (const char *pattern, const char *directory,
2642 + int flags, int (*errfunc) (const char *, int),
2644 +extern int __glob_pattern_type (const char *pattern, int quote)
2647 +#if !defined _LIBC || !defined GLOB_ONLY_P
2648 +static int prefix_array (const char *prefix, char **array, size_t n) __THROW;
2649 +static int collated_compare (const void *, const void *) __THROW;
2652 +/* Find the end of the sub-pattern in a brace expression. */
2653 +static const char *
2654 +next_brace_sub (const char *cp, int flags)
2656 + unsigned int depth = 0;
2657 + while (*cp != '\0')
2658 + if ((flags & GLOB_NOESCAPE) == 0 && *cp == '\\')
2660 + if (*++cp == '\0')
2666 + if ((*cp == '}' && depth-- == 0) || (*cp == ',' && depth == 0))
2673 + return *cp != '\0' ? cp : NULL;
2676 +#endif /* !defined _LIBC || !defined GLOB_ONLY_P */
2678 +/* Do glob searching for PATTERN, placing results in PGLOB.
2679 + The bits defined above may be set in FLAGS.
2680 + If a directory cannot be opened or read and ERRFUNC is not nil,
2681 + it is called with the pathname that caused the error, and the
2682 + `errno' value from the failing call; if it returns non-zero
2683 + `glob' returns GLOB_ABORTED; if it returns zero, the error is ignored.
2684 + If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
2685 + Otherwise, `glob' returns zero. */
2687 +#ifdef GLOB_ATTRIBUTE
2690 +glob (pattern, flags, errfunc, pglob)
2691 + const char * restrict pattern;
2693 + int (*errfunc) (const char *, int);
2694 + glob_t * restrict pglob;
2696 + const char *filename;
2697 + const char *dirname;
2702 + int dirname_modified;
2705 + if (pattern == NULL || pglob == NULL || (flags & ~__GLOB_FLAGS) != 0)
2707 + __set_errno (EINVAL);
2711 + if (!(flags & GLOB_DOOFFS))
2712 + /* Have to do this so `globfree' knows where to start freeing. It
2713 + also makes all the code that uses gl_offs simpler. */
2714 + pglob->gl_offs = 0;
2716 + if (flags & GLOB_BRACE)
2718 + const char *begin;
2720 + if (flags & GLOB_NOESCAPE)
2721 + begin = strchr (pattern, '{');
2727 + if (*begin == '\0')
2733 + if (*begin == '\\' && begin[1] != '\0')
2735 + else if (*begin == '{')
2742 + if (begin != NULL)
2744 + /* Allocate working buffer large enough for our work. Note that
2745 + we have at least an opening and closing brace. */
2753 + char onealt[strlen (pattern) - 1];
2755 + char *onealt = malloc (strlen (pattern) - 1);
2756 + if (onealt == NULL)
2758 + if (!(flags & GLOB_APPEND))
2760 + pglob->gl_pathc = 0;
2761 + pglob->gl_pathv = NULL;
2763 + return GLOB_NOSPACE;
2767 + /* We know the prefix for all sub-patterns. */
2768 + alt_start = mempcpy (onealt, pattern, begin - pattern);
2770 + /* Find the first sub-pattern and at the same time find the
2771 + rest after the closing brace. */
2772 + next = next_brace_sub (begin + 1, flags);
2775 + /* It is an invalid expression. */
2779 + return glob (pattern, flags & ~GLOB_BRACE, errfunc, pglob);
2782 + /* Now find the end of the whole brace expression. */
2784 + while (*rest != '}')
2786 + rest = next_brace_sub (rest + 1, flags);
2789 + /* It is an invalid expression. */
2793 + return glob (pattern, flags & ~GLOB_BRACE, errfunc, pglob);
2796 + /* Please note that we now can be sure the brace expression
2797 + is well-formed. */
2798 + rest_len = strlen (++rest) + 1;
2800 + /* We have a brace expression. BEGIN points to the opening {,
2801 + NEXT points past the terminator of the first element, and END
2802 + points past the final }. We will accumulate result names from
2803 + recursive runs for each brace alternative in the buffer using
2806 + if (!(flags & GLOB_APPEND))
2808 + /* This call is to set a new vector, so clear out the
2809 + vector so we can append to it. */
2810 + pglob->gl_pathc = 0;
2811 + pglob->gl_pathv = NULL;
2813 + firstc = pglob->gl_pathc;
2820 + /* Construct the new glob expression. */
2821 + mempcpy (mempcpy (alt_start, p, next - p), rest, rest_len);
2823 + result = glob (onealt,
2824 + ((flags & ~(GLOB_NOCHECK | GLOB_NOMAGIC))
2825 + | GLOB_APPEND), errfunc, pglob);
2827 + /* If we got an error, return it. */
2828 + if (result && result != GLOB_NOMATCH)
2833 + if (!(flags & GLOB_APPEND))
2836 + pglob->gl_pathc = 0;
2842 + /* We saw the last entry. */
2846 + next = next_brace_sub (p, flags);
2847 + assert (next != NULL);
2854 + if (pglob->gl_pathc != firstc)
2855 + /* We found some entries. */
2857 + else if (!(flags & (GLOB_NOCHECK|GLOB_NOMAGIC)))
2858 + return GLOB_NOMATCH;
2862 + /* Find the filename. */
2863 + filename = strrchr (pattern, '/');
2864 +#if defined __MSDOS__ || defined WINDOWS32
2865 + /* The case of "d:pattern". Since `:' is not allowed in
2866 + file names, we can safely assume that wherever it
2867 + happens in pattern, it signals the filename part. This
2868 + is so we could some day support patterns like "[a-z]:foo". */
2869 + if (filename == NULL)
2870 + filename = strchr (pattern, ':');
2871 +#endif /* __MSDOS__ || WINDOWS32 */
2872 + dirname_modified = 0;
2873 + if (filename == NULL)
2875 + /* This can mean two things: a simple name or "~name". The latter
2876 + case is nothing but a notation for a directory. */
2877 + if ((flags & (GLOB_TILDE|GLOB_TILDE_CHECK)) && pattern[0] == '~')
2879 + dirname = pattern;
2880 + dirlen = strlen (pattern);
2882 + /* Set FILENAME to NULL as a special flag. This is ugly but
2883 + other solutions would require much more code. We test for
2884 + this special case below. */
2889 + filename = pattern;
2898 + else if (filename == pattern
2899 + || (filename == pattern + 1 && pattern[0] == '\\'
2900 + && (flags & GLOB_NOESCAPE) == 0))
2902 + /* "/pattern" or "\\/pattern". */
2910 + dirlen = filename - pattern;
2911 +#if defined __MSDOS__ || defined WINDOWS32
2912 + if (*filename == ':'
2913 + || (filename > pattern + 1 && filename[-1] == ':'))
2918 + drive_spec = __alloca (dirlen + 1);
2919 + *((char *) mempcpy (drive_spec, pattern, dirlen)) = '\0';
2920 + /* For now, disallow wildcards in the drive spec, to
2921 + prevent infinite recursion in glob. */
2922 + if (__glob_pattern_p (drive_spec, !(flags & GLOB_NOESCAPE)))
2923 + return GLOB_NOMATCH;
2924 + /* If this is "d:pattern", we need to copy `:' to DIRNAME
2925 + as well. If it's "d:/pattern", don't remove the slash
2926 + from "d:/", since "d:" and "d:/" are not the same.*/
2929 + newp = __alloca (dirlen + 1);
2930 + *((char *) mempcpy (newp, pattern, dirlen)) = '\0';
2934 + if (filename[0] == '\0'
2935 +#if defined __MSDOS__ || defined WINDOWS32
2936 + && dirname[dirlen - 1] != ':'
2937 + && (dirlen < 3 || dirname[dirlen - 2] != ':'
2938 + || dirname[dirlen - 1] != '/')
2941 + /* "pattern/". Expand "pattern", appending slashes. */
2943 + int orig_flags = flags;
2945 + if (!(flags & GLOB_NOESCAPE) && dirname[dirlen - 1] == '\\')
2947 + /* "pattern\\/". Remove the final backslash if it hasn't
2949 + char *p = (char *) &dirname[dirlen - 1];
2951 + while (p > dirname && p[-1] == '\\') --p;
2952 + if ((&dirname[dirlen] - p) & 1)
2954 + *(char *) &dirname[--dirlen] = '\0';
2955 + flags &= ~(GLOB_NOCHECK | GLOB_NOMAGIC);
2958 + val = glob (dirname, flags | GLOB_MARK, errfunc, pglob);
2960 + pglob->gl_flags = ((pglob->gl_flags & ~GLOB_MARK)
2961 + | (flags & GLOB_MARK));
2962 + else if (val == GLOB_NOMATCH && flags != orig_flags)
2964 + /* Make sure globfree (&dirs); is a nop. */
2965 + dirs.gl_pathv = NULL;
2966 + flags = orig_flags;
2967 + oldcount = pglob->gl_pathc + pglob->gl_offs;
2974 + if (!(flags & GLOB_APPEND))
2976 + pglob->gl_pathc = 0;
2977 + if (!(flags & GLOB_DOOFFS))
2978 + pglob->gl_pathv = NULL;
2982 + pglob->gl_pathv = malloc ((pglob->gl_offs + 1) * sizeof (char *));
2983 + if (pglob->gl_pathv == NULL)
2984 + return GLOB_NOSPACE;
2986 + for (i = 0; i <= pglob->gl_offs; ++i)
2987 + pglob->gl_pathv[i] = NULL;
2991 + oldcount = pglob->gl_pathc + pglob->gl_offs;
2993 + if ((flags & (GLOB_TILDE|GLOB_TILDE_CHECK)) && dirname[0] == '~')
2995 + if (dirname[1] == '\0' || dirname[1] == '/'
2996 + || (!(flags & GLOB_NOESCAPE) && dirname[1] == '\\'
2997 + && (dirname[2] == '\0' || dirname[2] == '/')))
2999 + /* Look up home directory. */
3000 + const char *home_dir = getenv ("HOME");
3002 + if (home_dir == NULL || home_dir[0] == '\0')
3003 + home_dir = "SYS:";
3006 + /* Windows NT defines HOMEDRIVE and HOMEPATH. But give preference
3007 + to HOME, because the user can change HOME. */
3008 + if (home_dir == NULL || home_dir[0] == '\0')
3010 + const char *home_drive = getenv ("HOMEDRIVE");
3011 + const char *home_path = getenv ("HOMEPATH");
3013 + if (home_drive != NULL && home_path != NULL)
3015 + size_t home_drive_len = strlen (home_drive);
3016 + size_t home_path_len = strlen (home_path);
3017 + char *mem = alloca (home_drive_len + home_path_len + 1);
3019 + memcpy (mem, home_drive, home_drive_len);
3020 + memcpy (mem + home_drive_len, home_path, home_path_len + 1);
3024 + home_dir = "c:/users/default"; /* poor default */
3027 + if (home_dir == NULL || home_dir[0] == '\0')
3031 + size_t buflen = GET_LOGIN_NAME_MAX () + 1;
3034 + /* `sysconf' does not support _SC_LOGIN_NAME_MAX. Try
3035 + a moderate value. */
3037 + name = __alloca (buflen);
3039 + success = getlogin_r (name, buflen) == 0;
3043 +# if defined HAVE_GETPWNAM_R || defined _LIBC
3044 + long int pwbuflen = GETPW_R_SIZE_MAX ();
3046 + struct passwd pwbuf;
3050 + if (pwbuflen == -1)
3051 + /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX.
3052 + Try a moderate value. */
3055 + pwtmpbuf = __alloca (pwbuflen);
3057 + while (getpwnam_r (name, &pwbuf, pwtmpbuf, pwbuflen, &p)
3060 + if (errno != ERANGE)
3066 + pwtmpbuf = extend_alloca (pwtmpbuf, pwbuflen,
3070 + pwtmpbuf = __alloca (pwbuflen);
3072 + __set_errno (save);
3075 + p = getpwnam (name);
3078 + home_dir = p->pw_dir;
3081 + if (home_dir == NULL || home_dir[0] == '\0')
3083 + if (flags & GLOB_TILDE_CHECK)
3084 + return GLOB_NOMATCH;
3086 + home_dir = "~"; /* No luck. */
3088 +# endif /* WINDOWS32 */
3090 + /* Now construct the full directory. */
3091 + if (dirname[1] == '\0')
3093 + dirname = home_dir;
3094 + dirlen = strlen (dirname);
3099 + size_t home_len = strlen (home_dir);
3100 + newp = __alloca (home_len + dirlen);
3101 + mempcpy (mempcpy (newp, home_dir, home_len),
3102 + &dirname[1], dirlen);
3104 + dirlen += home_len - 1;
3106 + dirname_modified = 1;
3108 +# if !defined _AMIGA && !defined WINDOWS32
3111 + char *end_name = strchr (dirname, '/');
3112 + const char *user_name;
3113 + const char *home_dir;
3114 + char *unescape = NULL;
3116 + if (!(flags & GLOB_NOESCAPE))
3118 + if (end_name == NULL)
3120 + unescape = strchr (dirname, '\\');
3122 + end_name = strchr (unescape, '\0');
3125 + unescape = memchr (dirname, '\\', end_name - dirname);
3127 + if (end_name == NULL)
3128 + user_name = dirname + 1;
3132 + newp = __alloca (end_name - dirname);
3133 + *((char *) mempcpy (newp, dirname + 1, end_name - dirname))
3135 + if (unescape != NULL)
3137 + char *p = mempcpy (newp, dirname + 1,
3138 + unescape - dirname - 1);
3139 + char *q = unescape;
3140 + while (*q != '\0')
3146 + /* "~fo\\o\\" unescape to user_name "foo\\",
3147 + but "~fo\\o\\/" unescape to user_name
3149 + if (filename == NULL)
3160 + *((char *) mempcpy (newp, dirname + 1, end_name - dirname))
3165 + /* Look up specific user's home directory. */
3168 +# if defined HAVE_GETPWNAM_R || defined _LIBC
3169 + long int buflen = GETPW_R_SIZE_MAX ();
3171 + struct passwd pwbuf;
3176 + /* `sysconf' does not support _SC_GETPW_R_SIZE_MAX. Try a
3177 + moderate value. */
3180 + pwtmpbuf = __alloca (buflen);
3182 + while (getpwnam_r (user_name, &pwbuf, pwtmpbuf, buflen, &p) != 0)
3184 + if (errno != ERANGE)
3190 + pwtmpbuf = extend_alloca (pwtmpbuf, buflen, 2 * buflen);
3193 + pwtmpbuf = __alloca (buflen);
3195 + __set_errno (save);
3198 + p = getpwnam (user_name);
3201 + home_dir = p->pw_dir;
3205 + /* If we found a home directory use this. */
3206 + if (home_dir != NULL)
3209 + size_t home_len = strlen (home_dir);
3210 + size_t rest_len = end_name == NULL ? 0 : strlen (end_name);
3211 + newp = __alloca (home_len + rest_len + 1);
3212 + *((char *) mempcpy (mempcpy (newp, home_dir, home_len),
3213 + end_name, rest_len)) = '\0';
3215 + dirlen = home_len + rest_len;
3216 + dirname_modified = 1;
3219 + if (flags & GLOB_TILDE_CHECK)
3220 + /* We have to regard it as an error if we cannot find the
3221 + home directory. */
3222 + return GLOB_NOMATCH;
3224 +# endif /* Not Amiga && not WINDOWS32. */
3227 + /* Now test whether we looked for "~" or "~NAME". In this case we
3228 + can give the answer now. */
3229 + if (filename == NULL)
3232 + struct_stat64 st64;
3234 + /* Return the directory if we don't check for error or if it exists. */
3235 + if ((flags & GLOB_NOCHECK)
3236 + || (((__builtin_expect (flags & GLOB_ALTDIRFUNC, 0))
3237 + ? ((*pglob->gl_stat) (dirname, &st) == 0
3238 + && S_ISDIR (st.st_mode))
3239 + : (__stat64 (dirname, &st64) == 0 && S_ISDIR (st64.st_mode)))))
3241 + int newcount = pglob->gl_pathc + pglob->gl_offs;
3242 + char **new_gl_pathv;
3245 + = realloc (pglob->gl_pathv, (newcount + 1 + 1) * sizeof (char *));
3246 + if (new_gl_pathv == NULL)
3249 + free (pglob->gl_pathv);
3250 + pglob->gl_pathv = NULL;
3251 + pglob->gl_pathc = 0;
3252 + return GLOB_NOSPACE;
3254 + pglob->gl_pathv = new_gl_pathv;
3256 + if (flags & GLOB_MARK)
3259 + pglob->gl_pathv[newcount] = malloc (dirlen + 2);
3260 + if (pglob->gl_pathv[newcount] == NULL)
3262 + p = mempcpy (pglob->gl_pathv[newcount], dirname, dirlen);
3268 + pglob->gl_pathv[newcount] = strdup (dirname);
3269 + if (pglob->gl_pathv[newcount] == NULL)
3272 + pglob->gl_pathv[++newcount] = NULL;
3273 + ++pglob->gl_pathc;
3274 + pglob->gl_flags = flags;
3280 + return GLOB_NOMATCH;
3283 + meta = __glob_pattern_type (dirname, !(flags & GLOB_NOESCAPE));
3284 + /* meta is 1 if correct glob pattern containing metacharacters.
3285 + If meta has bit (1 << 2) set, it means there was an unterminated
3286 + [ which we handle the same, using fnmatch. Broken unterminated
3287 + pattern bracket expressions ought to be rare enough that it is
3288 + not worth special casing them, fnmatch will do the right thing. */
3291 + /* The directory name contains metacharacters, so we
3292 + have to glob for the directory, and then glob for
3293 + the pattern in each directory found. */
3296 + if (!(flags & GLOB_NOESCAPE) && dirlen > 0 && dirname[dirlen - 1] == '\\')
3298 + /* "foo\\/bar". Remove the final backslash from dirname
3299 + if it has not been quoted. */
3300 + char *p = (char *) &dirname[dirlen - 1];
3302 + while (p > dirname && p[-1] == '\\') --p;
3303 + if ((&dirname[dirlen] - p) & 1)
3304 + *(char *) &dirname[--dirlen] = '\0';
3307 + if (__builtin_expect ((flags & GLOB_ALTDIRFUNC) != 0, 0))
3309 + /* Use the alternative access functions also in the recursive
3311 + dirs.gl_opendir = pglob->gl_opendir;
3312 + dirs.gl_readdir = pglob->gl_readdir;
3313 + dirs.gl_closedir = pglob->gl_closedir;
3314 + dirs.gl_stat = pglob->gl_stat;
3315 + dirs.gl_lstat = pglob->gl_lstat;
3318 + status = glob (dirname,
3319 + ((flags & (GLOB_ERR | GLOB_NOESCAPE
3320 + | GLOB_ALTDIRFUNC))
3321 + | GLOB_NOSORT | GLOB_ONLYDIR),
3325 + if ((flags & GLOB_NOCHECK) == 0 || status != GLOB_NOMATCH)
3330 + /* We have successfully globbed the preceding directory name.
3331 + For each name we found, call glob_in_dir on it and FILENAME,
3332 + appending the results to PGLOB. */
3333 + for (i = 0; i < dirs.gl_pathc; ++i)
3339 + /* Make globbing interruptible in the bash shell. */
3340 + extern int interrupt_state;
3342 + if (interrupt_state)
3345 + return GLOB_ABORTED;
3348 +#endif /* SHELL. */
3350 + old_pathc = pglob->gl_pathc;
3351 + status = glob_in_dir (filename, dirs.gl_pathv[i],
3352 + ((flags | GLOB_APPEND)
3353 + & ~(GLOB_NOCHECK | GLOB_NOMAGIC)),
3355 + if (status == GLOB_NOMATCH)
3356 + /* No matches in this directory. Try the next. */
3363 + pglob->gl_pathc = 0;
3367 + /* Stick the directory on the front of each name. */
3368 + if (prefix_array (dirs.gl_pathv[i],
3369 + &pglob->gl_pathv[old_pathc + pglob->gl_offs],
3370 + pglob->gl_pathc - old_pathc))
3374 + pglob->gl_pathc = 0;
3375 + return GLOB_NOSPACE;
3379 + flags |= GLOB_MAGCHAR;
3381 + /* We have ignored the GLOB_NOCHECK flag in the `glob_in_dir' calls.
3382 + But if we have not found any matching entry and the GLOB_NOCHECK
3383 + flag was set we must return the input pattern itself. */
3384 + if (pglob->gl_pathc + pglob->gl_offs == oldcount)
3388 + if (flags & GLOB_NOCHECK)
3390 + int newcount = pglob->gl_pathc + pglob->gl_offs;
3391 + char **new_gl_pathv;
3393 + new_gl_pathv = realloc (pglob->gl_pathv,
3394 + (newcount + 2) * sizeof (char *));
3395 + if (new_gl_pathv == NULL)
3398 + return GLOB_NOSPACE;
3400 + pglob->gl_pathv = new_gl_pathv;
3402 + pglob->gl_pathv[newcount] = strdup (pattern);
3403 + if (pglob->gl_pathv[newcount] == NULL)
3407 + pglob->gl_pathc = 0;
3408 + return GLOB_NOSPACE;
3411 + ++pglob->gl_pathc;
3414 + pglob->gl_pathv[newcount] = NULL;
3415 + pglob->gl_flags = flags;
3420 + return GLOB_NOMATCH;
3428 + int old_pathc = pglob->gl_pathc;
3429 + int orig_flags = flags;
3433 + char *p = strchr (dirname, '\\'), *q;
3434 + /* We need to unescape the dirname string. It is certainly
3435 + allocated by alloca, as otherwise filename would be NULL
3436 + or dirname wouldn't contain backslashes. */
3449 + while (*p++ != '\0');
3450 + dirname_modified = 1;
3452 + if (dirname_modified)
3453 + flags &= ~(GLOB_NOCHECK | GLOB_NOMAGIC);
3454 + status = glob_in_dir (filename, dirname, flags, errfunc, pglob);
3457 + if (status == GLOB_NOMATCH && flags != orig_flags
3458 + && pglob->gl_pathc + pglob->gl_offs == oldcount)
3460 + /* Make sure globfree (&dirs); is a nop. */
3461 + dirs.gl_pathv = NULL;
3462 + flags = orig_flags;
3470 + /* Stick the directory on the front of each name. */
3471 + if (prefix_array (dirname,
3472 + &pglob->gl_pathv[old_pathc + pglob->gl_offs],
3473 + pglob->gl_pathc - old_pathc))
3476 + pglob->gl_pathc = 0;
3477 + return GLOB_NOSPACE;
3482 + if (flags & GLOB_MARK)
3484 + /* Append slashes to directory names. */
3487 + struct_stat64 st64;
3489 + for (i = oldcount; i < pglob->gl_pathc + pglob->gl_offs; ++i)
3490 + if ((__builtin_expect (flags & GLOB_ALTDIRFUNC, 0)
3491 + ? ((*pglob->gl_stat) (pglob->gl_pathv[i], &st) == 0
3492 + && S_ISDIR (st.st_mode))
3493 + : (__stat64 (pglob->gl_pathv[i], &st64) == 0
3494 + && S_ISDIR (st64.st_mode))))
3496 + size_t len = strlen (pglob->gl_pathv[i]) + 2;
3497 + char *new = realloc (pglob->gl_pathv[i], len);
3501 + pglob->gl_pathc = 0;
3502 + return GLOB_NOSPACE;
3504 + strcpy (&new[len - 2], "/");
3505 + pglob->gl_pathv[i] = new;
3509 + if (!(flags & GLOB_NOSORT))
3511 + /* Sort the vector. */
3512 + qsort (&pglob->gl_pathv[oldcount],
3513 + pglob->gl_pathc + pglob->gl_offs - oldcount,
3514 + sizeof (char *), collated_compare);
3519 +#if defined _LIBC && !defined glob
3520 +libc_hidden_def (glob)
3524 +#if !defined _LIBC || !defined GLOB_ONLY_P
3526 +/* Free storage allocated in PGLOB by a previous `glob' call. */
3529 + register glob_t *pglob;
3531 + if (pglob->gl_pathv != NULL)
3534 + for (i = 0; i < pglob->gl_pathc; ++i)
3535 + if (pglob->gl_pathv[pglob->gl_offs + i] != NULL)
3536 + free (pglob->gl_pathv[pglob->gl_offs + i]);
3537 + free (pglob->gl_pathv);
3538 + pglob->gl_pathv = NULL;
3541 +#if defined _LIBC && !defined globfree
3542 +libc_hidden_def (globfree)
3546 +/* Do a collated comparison of A and B. */
3548 +collated_compare (const void *a, const void *b)
3550 + char *const *ps1 = a; char *s1 = *ps1;
3551 + char *const *ps2 = b; char *s2 = *ps2;
3559 + return strcoll (s1, s2);
3563 +/* Prepend DIRNAME to each of N members of ARRAY, replacing ARRAY's
3564 + elements in place. Return nonzero if out of memory, zero if successful.
3565 + A slash is inserted between DIRNAME and each elt of ARRAY,
3566 + unless DIRNAME is just "/". Each old element of ARRAY is freed. */
3568 +prefix_array (const char *dirname, char **array, size_t n)
3570 + register size_t i;
3571 + size_t dirlen = strlen (dirname);
3572 +#if defined __MSDOS__ || defined WINDOWS32
3573 + int sep_char = '/';
3574 +# define DIRSEP_CHAR sep_char
3576 +# define DIRSEP_CHAR '/'
3579 + if (dirlen == 1 && dirname[0] == '/')
3580 + /* DIRNAME is just "/", so normal prepending would get us "//foo".
3581 + We want "/foo" instead, so don't prepend any chars from DIRNAME. */
3583 +#if defined __MSDOS__ || defined WINDOWS32
3584 + else if (dirlen > 1)
3586 + if (dirname[dirlen - 1] == '/' && dirname[dirlen - 2] == ':')
3587 + /* DIRNAME is "d:/". Don't prepend the slash from DIRNAME. */
3589 + else if (dirname[dirlen - 1] == ':')
3591 + /* DIRNAME is "d:". Use `:' instead of `/'. */
3598 + for (i = 0; i < n; ++i)
3600 + size_t eltlen = strlen (array[i]) + 1;
3601 + char *new = malloc (dirlen + 1 + eltlen);
3605 + free (array[--i]);
3610 + char *endp = mempcpy (new, dirname, dirlen);
3611 + *endp++ = DIRSEP_CHAR;
3612 + mempcpy (endp, array[i], eltlen);
3622 +/* We must not compile this function twice. */
3623 +#if !defined _LIBC || !defined NO_GLOB_PATTERN_P
3625 +__glob_pattern_type (pattern, quote)
3626 + const char *pattern;
3629 + register const char *p;
3632 + for (p = pattern; *p != '\0'; ++p)
3661 +/* Return nonzero if PATTERN contains any metacharacters.
3662 + Metacharacters can be quoted with backslashes if QUOTE is nonzero. */
3664 +__glob_pattern_p (pattern, quote)
3665 + const char *pattern;
3668 + return __glob_pattern_type (pattern, quote) == 1;
3671 +weak_alias (__glob_pattern_p, glob_pattern_p)
3675 +#endif /* !GLOB_ONLY_P */
3678 +#if !defined _LIBC || !defined GLOB_ONLY_P
3679 +/* We put this in a separate function mainly to allow the memory
3680 + allocated with alloca to be recycled. */
3682 +__attribute_noinline__
3683 +link_exists2_p (const char *dir, size_t dirlen, const char *fname,
3685 +# if !defined _LIBC && !HAVE_FSTATAT
3690 + size_t fnamelen = strlen (fname);
3691 + char *fullname = __alloca (dirlen + 1 + fnamelen + 1);
3694 + mempcpy (mempcpy (mempcpy (fullname, dir, dirlen), "/", 1),
3695 + fname, fnamelen + 1);
3697 +# if !defined _LIBC && !HAVE_FSTATAT
3698 + if (__builtin_expect ((flags & GLOB_ALTDIRFUNC) == 0, 1))
3700 + struct_stat64 st64;
3701 + return __stat64 (fullname, &st64) == 0;
3704 + return (*pglob->gl_stat) (fullname, &st) == 0;
3707 +/* Return true if DIR/FNAME exists. */
3709 +link_exists_p (int dfd, const char *dir, size_t dirlen, const char *fname,
3710 + glob_t *pglob, int flags)
3712 +# if defined _LIBC || HAVE_FSTATAT
3713 + if (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0))
3714 + return link_exists2_p (dir, dirlen, fname, pglob);
3717 + struct_stat64 st64;
3718 + return __fxstatat64 (_STAT_VER, dfd, fname, &st64, 0) == 0;
3721 + return link_exists2_p (dir, dirlen, fname, pglob, flags);
3727 +/* Like `glob', but PATTERN is a final pathname component,
3728 + and matches are searched for in DIRECTORY.
3729 + The GLOB_NOSORT bit in FLAGS is ignored. No sorting is ever done.
3730 + The GLOB_APPEND flag is assumed to be set (always appends). */
3732 +glob_in_dir (const char *pattern, const char *directory, int flags,
3733 + int (*errfunc) (const char *, int),
3736 + size_t dirlen = strlen (directory);
3737 + void *stream = NULL;
3740 + struct globnames *next;
3744 +#define INITIAL_COUNT sizeof (init_names.name) / sizeof (init_names.name[0])
3745 + struct globnames init_names;
3746 + struct globnames *names = &init_names;
3747 + struct globnames *names_alloca = &init_names;
3748 + size_t nfound = 0;
3749 + size_t allocasize = sizeof (init_names);
3755 + init_names.next = NULL;
3756 + init_names.count = INITIAL_COUNT;
3758 + meta = __glob_pattern_type (pattern, !(flags & GLOB_NOESCAPE));
3759 + if (meta == 0 && (flags & (GLOB_NOCHECK|GLOB_NOMAGIC)))
3761 + /* We need not do any tests. The PATTERN contains no meta
3762 + characters and we must not return an error therefore the
3763 + result will always contain exactly one name. */
3764 + flags |= GLOB_NOCHECK;
3766 + else if (meta == 0)
3768 + /* Since we use the normal file functions we can also use stat()
3769 + to verify the file is there. */
3771 + struct_stat64 st64;
3772 + size_t patlen = strlen (pattern);
3773 + char *fullname = __alloca (dirlen + 1 + patlen + 1);
3775 + mempcpy (mempcpy (mempcpy (fullname, directory, dirlen),
3777 + pattern, patlen + 1);
3778 + if ((__builtin_expect (flags & GLOB_ALTDIRFUNC, 0)
3779 + ? (*pglob->gl_stat) (fullname, &st)
3780 + : __stat64 (fullname, &st64)) == 0)
3781 + /* We found this file to be existing. Now tell the rest
3782 + of the function to copy this name into the result. */
3783 + flags |= GLOB_NOCHECK;
3787 + stream = (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0)
3788 + ? (*pglob->gl_opendir) (directory)
3789 + : opendir (directory));
3790 + if (stream == NULL)
3792 + if (errno != ENOTDIR
3793 + && ((errfunc != NULL && (*errfunc) (directory, errno))
3794 + || (flags & GLOB_ERR)))
3795 + return GLOB_ABORTED;
3799 + int dfd = (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0)
3800 + ? -1 : dirfd ((DIR *) stream));
3801 + int fnm_flags = ((!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0)
3802 + | ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0)
3803 +#if defined _AMIGA || defined VMS
3807 + flags |= GLOB_MAGCHAR;
3813 +#if defined _LIBC && !defined COMPILE_GLOB64
3814 + struct dirent64 *d;
3817 + struct dirent64 d64;
3818 + char room [offsetof (struct dirent64, d_name[0])
3823 + if (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0))
3825 + struct dirent *d32 = (*pglob->gl_readdir) (stream);
3828 + CONVERT_DIRENT_DIRENT64 (&d64buf.d64, d32);
3835 + d = __readdir64 (stream);
3837 + struct dirent *d = (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0)
3838 + ? ((struct dirent *)
3839 + (*pglob->gl_readdir) (stream))
3840 + : __readdir (stream));
3844 + if (! REAL_DIR_ENTRY (d))
3847 + /* If we shall match only directories use the information
3848 + provided by the dirent call if possible. */
3849 + if ((flags & GLOB_ONLYDIR) && !DIRENT_MIGHT_BE_DIR (d))
3854 + if (fnmatch (pattern, name, fnm_flags) == 0)
3856 + /* If the file we found is a symlink we have to
3857 + make sure the target file exists. */
3858 + if (!DIRENT_MIGHT_BE_SYMLINK (d)
3859 + || link_exists_p (dfd, directory, dirlen, name, pglob,
3862 + if (cur == names->count)
3864 + struct globnames *newnames;
3865 + size_t count = names->count * 2;
3866 + size_t size = (sizeof (struct globnames)
3867 + + ((count - INITIAL_COUNT)
3868 + * sizeof (char *)));
3869 + allocasize += size;
3870 + if (__libc_use_alloca (allocasize))
3871 + newnames = names_alloca = __alloca (size);
3872 + else if ((newnames = malloc (size))
3874 + goto memory_error;
3875 + newnames->count = count;
3876 + newnames->next = names;
3880 + len = _D_EXACT_NAMLEN (d);
3881 + names->name[cur] = malloc (len + 1);
3882 + if (names->name[cur] == NULL)
3883 + goto memory_error;
3884 + *((char *) mempcpy (names->name[cur++], name, len))
3893 + if (nfound == 0 && (flags & GLOB_NOCHECK))
3895 + size_t len = strlen (pattern);
3897 + names->name[cur] = malloc (len + 1);
3898 + if (names->name[cur] == NULL)
3899 + goto memory_error;
3900 + *((char *) mempcpy (names->name[cur++], pattern, len)) = '\0';
3903 + result = GLOB_NOMATCH;
3906 + char **new_gl_pathv
3907 + = realloc (pglob->gl_pathv,
3908 + (pglob->gl_pathc + pglob->gl_offs + nfound + 1)
3909 + * sizeof (char *));
3912 + if (new_gl_pathv == NULL)
3917 + struct globnames *old = names;
3919 + for (i = 0; i < cur; ++i)
3920 + free (names->name[i]);
3921 + names = names->next;
3922 + /* NB: we will not leak memory here if we exit without
3923 + freeing the current block assigned to OLD. At least
3924 + the very first block is always allocated on the stack
3925 + and this is the block assigned to OLD here. */
3926 + if (names == NULL)
3928 + assert (old == &init_names);
3931 + cur = names->count;
3932 + if (old == names_alloca)
3933 + names_alloca = names;
3937 + result = GLOB_NOSPACE;
3943 + struct globnames *old = names;
3945 + for (i = 0; i < cur; ++i)
3946 + new_gl_pathv[pglob->gl_offs + pglob->gl_pathc++]
3948 + names = names->next;
3949 + /* NB: we will not leak memory here if we exit without
3950 + freeing the current block assigned to OLD. At least
3951 + the very first block is always allocated on the stack
3952 + and this is the block assigned to OLD here. */
3953 + if (names == NULL)
3955 + assert (old == &init_names);
3958 + cur = names->count;
3959 + if (old == names_alloca)
3960 + names_alloca = names;
3965 + pglob->gl_pathv = new_gl_pathv;
3967 + pglob->gl_pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;
3969 + pglob->gl_flags = flags;
3973 + if (stream != NULL)
3976 + if (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0))
3977 + (*pglob->gl_closedir) (stream);
3979 + closedir (stream);
3980 + __set_errno (save);
3985 diff -urN popt-for-windows/lib/glob.in.h popt-for-windows-gnulib/lib/glob.in.h
3986 --- popt-for-windows/lib/glob.in.h 1970-01-01 01:00:00.000000000 +0100
3987 +++ popt-for-windows-gnulib/lib/glob.in.h 2008-10-25 15:17:05.000000000 +0100
3989 +/* glob.h -- Find a path matching a pattern.
3991 + Copyright (C) 2005-2007 Free Software Foundation, Inc.
3993 + Written by Derek Price <derek@ximbiot.com> & Paul Eggert <eggert@CS.UCLA.EDU>
3995 + This program is free software; you can redistribute it and/or modify
3996 + it under the terms of the GNU General Public License as published by
3997 + the Free Software Foundation; either version 3, or (at your option)
3998 + any later version.
4000 + This program is distributed in the hope that it will be useful,
4001 + but WITHOUT ANY WARRANTY; without even the implied warranty of
4002 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4003 + GNU General Public License for more details.
4005 + You should have received a copy of the GNU General Public License
4006 + along with this program; if not, write to the Free Software Foundation,
4007 + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
4012 +#if @HAVE_SYS_CDEFS_H@
4013 +# include <sys/cdefs.h>
4016 +#include <stddef.h>
4018 +/* On some systems, such as AIX 5.1, <sys/stat.h> does a "#define stat stat64".
4019 + Make sure this definition is seen before glob-libc.h defines types that
4020 + rely on 'struct stat'. */
4021 +#include <sys/stat.h>
4023 +#ifndef __BEGIN_DECLS
4024 +# define __BEGIN_DECLS
4025 +# define __END_DECLS
4032 +# define __size_t size_t
4035 +# define __USE_GNU 1
4039 +#define glob rpl_glob
4040 +#define globfree rpl_globfree
4041 +#define glob_pattern_p rpl_glob_pattern_p
4043 +#define __GLOB_GNULIB 1
4045 +/* Now the standard GNU C Library header should work. */
4046 +#include "glob-libc.h"
4048 +#endif /* _GL_GLOB_H */
4049 diff -urN popt-for-windows/lib/glob-libc.h popt-for-windows-gnulib/lib/glob-libc.h
4050 --- popt-for-windows/lib/glob-libc.h 1970-01-01 01:00:00.000000000 +0100
4051 +++ popt-for-windows-gnulib/lib/glob-libc.h 2008-10-25 15:17:05.000000000 +0100
4053 +/* Copyright (C) 1991,92,95-98,2000,2001,2004-2007 Free Software Foundation, Inc.
4054 + This file is part of the GNU C Library.
4056 + The GNU C Library is free software; you can redistribute it and/or
4057 + modify it under the terms of the GNU General Public
4058 + License as published by the Free Software Foundation; either
4059 + version 3 of the License, or (at your option) any later version.
4061 + The GNU C Library is distributed in the hope that it will be useful,
4062 + but WITHOUT ANY WARRANTY; without even the implied warranty of
4063 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4064 + Lesser General Public License for more details.
4066 + You should have received a copy of the GNU General Public
4067 + License along with the GNU C Library; if not, write to the Free
4068 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4069 + 02111-1307 USA. */
4074 +#ifndef __GLOB_GNULIB
4075 +# include <sys/cdefs.h>
4078 +/* GCC 2.95 and later have "__restrict"; C99 compilers have
4079 + "restrict", and "configure" may have defined "restrict".
4080 + Other compilers use __restrict, __restrict__, and _Restrict, and
4081 + 'configure' might #define 'restrict' to those words, so pick a
4082 + different name. */
4084 +# if 199901L <= __STDC_VERSION__
4085 +# define _Restrict_ restrict
4086 +# elif 2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)
4087 +# define _Restrict_ __restrict
4089 +# define _Restrict_
4095 +/* We need `size_t' for the following definitions. */
4097 +# if defined __GNUC__ && __GNUC__ >= 2
4098 +typedef __SIZE_TYPE__ __size_t;
4099 +# ifdef __USE_XOPEN
4100 +typedef __SIZE_TYPE__ size_t;
4103 +# include <stddef.h>
4105 +# define __size_t size_t
4109 +/* The GNU CC stddef.h version defines __size_t as empty. We need a real
4112 +# define __size_t size_t
4115 +/* Bits set in the FLAGS argument to `glob'. */
4116 +#define GLOB_ERR (1 << 0)/* Return on read errors. */
4117 +#define GLOB_MARK (1 << 1)/* Append a slash to each name. */
4118 +#define GLOB_NOSORT (1 << 2)/* Don't sort the names. */
4119 +#define GLOB_DOOFFS (1 << 3)/* Insert PGLOB->gl_offs NULLs. */
4120 +#define GLOB_NOCHECK (1 << 4)/* If nothing matches, return the pattern. */
4121 +#define GLOB_APPEND (1 << 5)/* Append to results of a previous call. */
4122 +#define GLOB_NOESCAPE (1 << 6)/* Backslashes don't quote metacharacters. */
4123 +#define GLOB_PERIOD (1 << 7)/* Leading `.' can be matched by metachars. */
4125 +#if !defined __USE_POSIX2 || defined __USE_BSD || defined __USE_GNU
4126 +# define GLOB_MAGCHAR (1 << 8)/* Set in gl_flags if any metachars seen. */
4127 +# define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions. */
4128 +# define GLOB_BRACE (1 << 10)/* Expand "{a,b}" to "a" "b". */
4129 +# define GLOB_NOMAGIC (1 << 11)/* If no magic chars, return the pattern. */
4130 +# define GLOB_TILDE (1 << 12)/* Expand ~user and ~ to home directories. */
4131 +# define GLOB_ONLYDIR (1 << 13)/* Match only directories. */
4132 +# define GLOB_TILDE_CHECK (1 << 14)/* Like GLOB_TILDE but return an error
4133 + if the user name is not available. */
4134 +# define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \
4135 + GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \
4136 + GLOB_PERIOD|GLOB_ALTDIRFUNC|GLOB_BRACE| \
4137 + GLOB_NOMAGIC|GLOB_TILDE|GLOB_ONLYDIR|GLOB_TILDE_CHECK)
4139 +# define __GLOB_FLAGS (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \
4140 + GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND| \
4144 +/* Error returns from `glob'. */
4145 +#define GLOB_NOSPACE 1 /* Ran out of memory. */
4146 +#define GLOB_ABORTED 2 /* Read error. */
4147 +#define GLOB_NOMATCH 3 /* No matches found. */
4148 +#define GLOB_NOSYS 4 /* Not implemented. */
4150 +/* Previous versions of this file defined GLOB_ABEND instead of
4151 + GLOB_ABORTED. Provide a compatibility definition here. */
4152 +# define GLOB_ABEND GLOB_ABORTED
4155 +/* Structure describing a globbing run. */
4161 + __size_t gl_pathc; /* Count of paths matched by the pattern. */
4162 + char **gl_pathv; /* List of matched pathnames. */
4163 + __size_t gl_offs; /* Slots to reserve in `gl_pathv'. */
4164 + int gl_flags; /* Set to FLAGS, maybe | GLOB_MAGCHAR. */
4166 + /* If the GLOB_ALTDIRFUNC flag is set, the following functions
4167 + are used instead of the normal file access functions. */
4168 + void (*gl_closedir) (void *);
4170 + struct dirent *(*gl_readdir) (void *);
4172 + void *(*gl_readdir) (void *);
4174 + void *(*gl_opendir) (const char *);
4176 + int (*gl_lstat) (const char *_Restrict_, struct stat *_Restrict_);
4177 + int (*gl_stat) (const char *_Restrict_, struct stat *_Restrict_);
4179 + int (*gl_lstat) (const char *_Restrict_, void *_Restrict_);
4180 + int (*gl_stat) (const char *_Restrict_, void *_Restrict_);
4184 +#if defined __USE_LARGEFILE64 && !defined __GLOB_GNULIB
4190 + __size_t gl_pathc;
4195 + /* If the GLOB_ALTDIRFUNC flag is set, the following functions
4196 + are used instead of the normal file access functions. */
4197 + void (*gl_closedir) (void *);
4199 + struct dirent64 *(*gl_readdir) (void *);
4201 + void *(*gl_readdir) (void *);
4203 + void *(*gl_opendir) (const char *);
4205 + int (*gl_lstat) (const char *_Restrict_, struct stat64 *_Restrict_);
4206 + int (*gl_stat) (const char *_Restrict_, struct stat64 *_Restrict_);
4208 + int (*gl_lstat) (const char *_Restrict_, void *_Restrict_);
4209 + int (*gl_stat) (const char *_Restrict_, void *_Restrict_);
4214 +#if __USE_FILE_OFFSET64 && __GNUC__ < 2 && !defined __GLOB_GNULIB
4215 +# define glob glob64
4216 +# define globfree globfree64
4219 +/* Do glob searching for PATTERN, placing results in PGLOB.
4220 + The bits defined above may be set in FLAGS.
4221 + If a directory cannot be opened or read and ERRFUNC is not nil,
4222 + it is called with the pathname that caused the error, and the
4223 + `errno' value from the failing call; if it returns non-zero
4224 + `glob' returns GLOB_ABEND; if it returns zero, the error is ignored.
4225 + If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
4226 + Otherwise, `glob' returns zero. */
4227 +#if !defined __USE_FILE_OFFSET64 || __GNUC__ < 2 || defined __GLOB_GNULIB
4228 +extern int glob (const char *_Restrict_ __pattern, int __flags,
4229 + int (*__errfunc) (const char *, int),
4230 + glob_t *_Restrict_ __pglob) __THROW;
4232 +/* Free storage allocated in PGLOB by a previous `glob' call. */
4233 +extern void globfree (glob_t *__pglob) __THROW;
4235 +extern int __REDIRECT_NTH (glob, (const char *_Restrict_ __pattern,
4237 + int (*__errfunc) (const char *, int),
4238 + glob_t *_Restrict_ __pglob), glob64);
4240 +extern void __REDIRECT_NTH (globfree, (glob_t *__pglob), globfree64);
4243 +#if defined __USE_LARGEFILE64 && !defined __GLOB_GNULIB
4244 +extern int glob64 (const char *_Restrict_ __pattern, int __flags,
4245 + int (*__errfunc) (const char *, int),
4246 + glob64_t *_Restrict_ __pglob) __THROW;
4248 +extern void globfree64 (glob64_t *__pglob) __THROW;
4253 +/* Return nonzero if PATTERN contains any metacharacters.
4254 + Metacharacters can be quoted with backslashes if QUOTE is nonzero.
4256 + This function is not part of the interface specified by POSIX.2
4257 + but several programs want to use it. */
4258 +extern int glob_pattern_p (const char *__pattern, int __quote) __THROW;
4263 +#endif /* glob.h */
4264 diff -urN popt-for-windows/lib/Makefile.am popt-for-windows-gnulib/lib/Makefile.am
4265 --- popt-for-windows/lib/Makefile.am 1970-01-01 01:00:00.000000000 +0100
4266 +++ popt-for-windows-gnulib/lib/Makefile.am 2008-10-25 15:17:05.000000000 +0100
4268 +## DO NOT EDIT! GENERATED AUTOMATICALLY!
4269 +## Process this file with automake to produce Makefile.in.
4270 +# Copyright (C) 2002-2008 Free Software Foundation, Inc.
4272 +# This file is free software, distributed under the terms of the GNU
4273 +# General Public License. As a special exception to the GNU General
4274 +# Public License, this file may be distributed as part of a program
4275 +# that contains a configuration script generated by Autoconf, under
4276 +# the same distribution terms as the rest of that program.
4278 +# Generated by gnulib-tool.
4279 +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --libtool --macro-prefix=gl glob
4281 +AUTOMAKE_OPTIONS = 1.5 gnits
4286 +noinst_LTLIBRARIES =
4290 +MOSTLYCLEANFILES = core *.stackdump
4294 +MAINTAINERCLEANFILES =
4298 +noinst_LTLIBRARIES += libgnu.la
4300 +libgnu_la_SOURCES =
4301 +libgnu_la_LIBADD = $(gl_LTLIBOBJS)
4302 +libgnu_la_DEPENDENCIES = $(gl_LTLIBOBJS)
4303 +EXTRA_libgnu_la_SOURCES =
4304 +libgnu_la_LDFLAGS = $(AM_LDFLAGS)
4306 +## begin gnulib module alloca
4309 +EXTRA_DIST += alloca.c
4311 +EXTRA_libgnu_la_SOURCES += alloca.c
4313 +libgnu_la_LIBADD += @LTALLOCA@
4314 +libgnu_la_DEPENDENCIES += @LTALLOCA@
4315 +## end gnulib module alloca
4317 +## begin gnulib module alloca-opt
4319 +BUILT_SOURCES += $(ALLOCA_H)
4321 +# We need the following in order to create <alloca.h> when the system
4322 +# doesn't have one that works with the given compiler.
4323 +alloca.h: alloca.in.h
4324 + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
4325 + cat $(srcdir)/alloca.in.h; \
4328 +MOSTLYCLEANFILES += alloca.h alloca.h-t
4330 +EXTRA_DIST += alloca.in.h
4332 +## end gnulib module alloca-opt
4334 +## begin gnulib module dirent
4336 +BUILT_SOURCES += $(DIRENT_H)
4338 +# We need the following in order to create <dirent.h> when the system
4339 +# doesn't have one that works with the given compiler.
4340 +dirent.h: dirent.in.h
4342 + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
4343 + sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
4344 + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
4345 + -e 's|@''NEXT_DIRENT_H''@|$(NEXT_DIRENT_H)|g' \
4346 + -e 's|@''GNULIB_DIRFD''@|$(GNULIB_DIRFD)|g' \
4347 + -e 's|@''HAVE_DECL_DIRFD''@|$(HAVE_DECL_DIRFD)|g' \
4348 + -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
4349 + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
4350 + < $(srcdir)/dirent.in.h; \
4353 +MOSTLYCLEANFILES += dirent.h dirent.h-t
4355 +EXTRA_DIST += dirent.in.h
4357 +## end gnulib module dirent
4359 +## begin gnulib module dirfd
4362 +EXTRA_DIST += dirfd.c
4364 +EXTRA_libgnu_la_SOURCES += dirfd.c
4366 +## end gnulib module dirfd
4368 +## begin gnulib module fnmatch
4370 +BUILT_SOURCES += $(FNMATCH_H)
4372 +# We need the following in order to create <fnmatch.h> when the system
4373 +# doesn't have one that supports the required API.
4374 +fnmatch.h: fnmatch.in.h
4375 + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
4376 + cat $(srcdir)/fnmatch.in.h; \
4379 +MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t
4381 +EXTRA_DIST += fnmatch.c fnmatch.in.h fnmatch_loop.c
4383 +EXTRA_libgnu_la_SOURCES += fnmatch.c fnmatch_loop.c
4385 +## end gnulib module fnmatch
4387 +## begin gnulib module getlogin_r
4390 +EXTRA_DIST += getlogin_r.c
4392 +EXTRA_libgnu_la_SOURCES += getlogin_r.c
4394 +## end gnulib module getlogin_r
4396 +## begin gnulib module glob
4398 +BUILT_SOURCES += $(GLOB_H)
4400 +# We need the following in order to create <glob.h> when the system
4401 +# doesn't have one that works with the given compiler.
4403 + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
4404 + sed -e 's|@''HAVE_SYS_CDEFS_H''@|$(HAVE_SYS_CDEFS_H)|g' \
4405 + < $(srcdir)/glob.in.h; \
4408 +MOSTLYCLEANFILES += glob.h glob.h-t
4410 +EXTRA_DIST += glob-libc.h glob.c glob.in.h
4412 +EXTRA_libgnu_la_SOURCES += glob.c
4414 +## end gnulib module glob
4416 +## begin gnulib module link-warning
4418 +LINK_WARNING_H=$(top_srcdir)/./link-warning.h
4420 +EXTRA_DIST += $(top_srcdir)/./link-warning.h
4422 +## end gnulib module link-warning
4424 +## begin gnulib module malloc-posix
4427 +EXTRA_DIST += malloc.c
4429 +EXTRA_libgnu_la_SOURCES += malloc.c
4431 +## end gnulib module malloc-posix
4433 +## begin gnulib module mempcpy
4436 +EXTRA_DIST += mempcpy.c
4438 +EXTRA_libgnu_la_SOURCES += mempcpy.c
4440 +## end gnulib module mempcpy
4442 +## begin gnulib module stdbool
4444 +BUILT_SOURCES += $(STDBOOL_H)
4446 +# We need the following in order to create <stdbool.h> when the system
4447 +# doesn't have one that works.
4448 +stdbool.h: stdbool.in.h
4450 + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
4451 + sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \
4454 +MOSTLYCLEANFILES += stdbool.h stdbool.h-t
4456 +EXTRA_DIST += stdbool.in.h
4458 +## end gnulib module stdbool
4460 +## begin gnulib module stdlib
4462 +BUILT_SOURCES += stdlib.h
4464 +# We need the following in order to create <stdlib.h> when the system
4465 +# doesn't have one that works with the given compiler.
4466 +stdlib.h: stdlib.in.h
4468 + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
4469 + sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
4470 + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
4471 + -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \
4472 + -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \
4473 + -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \
4474 + -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \
4475 + -e 's|@''GNULIB_ATOLL''@|$(GNULIB_ATOLL)|g' \
4476 + -e 's|@''GNULIB_GETLOADAVG''@|$(GNULIB_GETLOADAVG)|g' \
4477 + -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \
4478 + -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
4479 + -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \
4480 + -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \
4481 + -e 's|@''GNULIB_RAND48''@|$(GNULIB_RAND48)|g' \
4482 + -e 's|@''GNULIB_RANDOM_R''@|$(GNULIB_RANDOM_R)|g' \
4483 + -e 's|@''GNULIB_RPMATCH''@|$(GNULIB_RPMATCH)|g' \
4484 + -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \
4485 + -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \
4486 + -e 's|@''GNULIB_STRTOLL''@|$(GNULIB_STRTOLL)|g' \
4487 + -e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \
4488 + -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
4489 + -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \
4490 + -e 's|@''HAVE_CALLOC_POSIX''@|$(HAVE_CALLOC_POSIX)|g' \
4491 + -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
4492 + -e 's|@''HAVE_MALLOC_POSIX''@|$(HAVE_MALLOC_POSIX)|g' \
4493 + -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
4494 + -e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \
4495 + -e 's|@''HAVE_RAND48''@|$(HAVE_RAND48)|g' \
4496 + -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
4497 + -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \
4498 + -e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \
4499 + -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
4500 + -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \
4501 + -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \
4502 + -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \
4503 + -e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \
4504 + -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \
4505 + -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
4506 + -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
4507 + -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
4508 + -e 's|@''VOID_UNSETENV''@|$(VOID_UNSETENV)|g' \
4509 + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
4510 + < $(srcdir)/stdlib.in.h; \
4513 +MOSTLYCLEANFILES += stdlib.h stdlib.h-t
4515 +EXTRA_DIST += stdlib.in.h
4517 +## end gnulib module stdlib
4519 +## begin gnulib module strdup
4522 +EXTRA_DIST += strdup.c
4524 +EXTRA_libgnu_la_SOURCES += strdup.c
4526 +## end gnulib module strdup
4528 +## begin gnulib module string
4530 +BUILT_SOURCES += string.h
4532 +# We need the following in order to create <string.h> when the system
4533 +# doesn't have one that works with the given compiler.
4534 +string.h: string.in.h
4536 + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
4537 + sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
4538 + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
4539 + -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \
4540 + -e 's|@''GNULIB_MBSLEN''@|$(GNULIB_MBSLEN)|g' \
4541 + -e 's|@''GNULIB_MBSNLEN''@|$(GNULIB_MBSNLEN)|g' \
4542 + -e 's|@''GNULIB_MBSCHR''@|$(GNULIB_MBSCHR)|g' \
4543 + -e 's|@''GNULIB_MBSRCHR''@|$(GNULIB_MBSRCHR)|g' \
4544 + -e 's|@''GNULIB_MBSSTR''@|$(GNULIB_MBSSTR)|g' \
4545 + -e 's|@''GNULIB_MBSCASECMP''@|$(GNULIB_MBSCASECMP)|g' \
4546 + -e 's|@''GNULIB_MBSNCASECMP''@|$(GNULIB_MBSNCASECMP)|g' \
4547 + -e 's|@''GNULIB_MBSPCASECMP''@|$(GNULIB_MBSPCASECMP)|g' \
4548 + -e 's|@''GNULIB_MBSCASESTR''@|$(GNULIB_MBSCASESTR)|g' \
4549 + -e 's|@''GNULIB_MBSCSPN''@|$(GNULIB_MBSCSPN)|g' \
4550 + -e 's|@''GNULIB_MBSPBRK''@|$(GNULIB_MBSPBRK)|g' \
4551 + -e 's|@''GNULIB_MBSSPN''@|$(GNULIB_MBSSPN)|g' \
4552 + -e 's|@''GNULIB_MBSSEP''@|$(GNULIB_MBSSEP)|g' \
4553 + -e 's|@''GNULIB_MBSTOK_R''@|$(GNULIB_MBSTOK_R)|g' \
4554 + -e 's|@''GNULIB_MEMMEM''@|$(GNULIB_MEMMEM)|g' \
4555 + -e 's|@''GNULIB_MEMPCPY''@|$(GNULIB_MEMPCPY)|g' \
4556 + -e 's|@''GNULIB_MEMRCHR''@|$(GNULIB_MEMRCHR)|g' \
4557 + -e 's|@''GNULIB_RAWMEMCHR''@|$(GNULIB_RAWMEMCHR)|g' \
4558 + -e 's|@''GNULIB_STPCPY''@|$(GNULIB_STPCPY)|g' \
4559 + -e 's|@''GNULIB_STPNCPY''@|$(GNULIB_STPNCPY)|g' \
4560 + -e 's|@''GNULIB_STRCHRNUL''@|$(GNULIB_STRCHRNUL)|g' \
4561 + -e 's|@''GNULIB_STRDUP''@|$(GNULIB_STRDUP)|g' \
4562 + -e 's|@''GNULIB_STRNDUP''@|$(GNULIB_STRNDUP)|g' \
4563 + -e 's|@''GNULIB_STRNLEN''@|$(GNULIB_STRNLEN)|g' \
4564 + -e 's|@''GNULIB_STRPBRK''@|$(GNULIB_STRPBRK)|g' \
4565 + -e 's|@''GNULIB_STRSEP''@|$(GNULIB_STRSEP)|g' \
4566 + -e 's|@''GNULIB_STRSTR''@|$(GNULIB_STRSTR)|g' \
4567 + -e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \
4568 + -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \
4569 + -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \
4570 + -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \
4571 + -e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \
4572 + -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
4573 + -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
4574 + -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
4575 + -e 's|@''HAVE_RAWMEMCHR''@|$(HAVE_RAWMEMCHR)|g' \
4576 + -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \
4577 + -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \
4578 + -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \
4579 + -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \
4580 + -e 's|@''HAVE_STRNDUP''@|$(HAVE_STRNDUP)|g' \
4581 + -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \
4582 + -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \
4583 + -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \
4584 + -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \
4585 + -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \
4586 + -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
4587 + -e 's|@''HAVE_DECL_STRERROR''@|$(HAVE_DECL_STRERROR)|g' \
4588 + -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \
4589 + -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \
4590 + -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \
4591 + -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \
4592 + -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \
4593 + -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
4594 + -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
4595 + -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
4596 + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
4597 + < $(srcdir)/string.in.h; \
4600 +MOSTLYCLEANFILES += string.h string.h-t
4602 +EXTRA_DIST += string.in.h
4604 +## end gnulib module string
4606 +## begin gnulib module sys_stat
4608 +BUILT_SOURCES += $(SYS_STAT_H)
4610 +# We need the following in order to create <sys/stat.h> when the system
4611 +# has one that is incomplete.
4612 +sys/stat.h: sys_stat.in.h
4615 + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
4616 + sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
4617 + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
4618 + -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
4619 + -e 's|@''GNULIB_LCHMOD''@|$(GNULIB_LCHMOD)|g' \
4620 + -e 's|@''GNULIB_LSTAT''@|$(GNULIB_LSTAT)|g' \
4621 + -e 's|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \
4622 + -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \
4623 + -e 's|@''REPLACE_LSTAT''@|$(REPLACE_LSTAT)|g' \
4624 + -e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \
4625 + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
4626 + < $(srcdir)/sys_stat.in.h; \
4629 +MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t
4630 +MOSTLYCLEANDIRS += sys
4632 +EXTRA_DIST += sys_stat.in.h
4634 +## end gnulib module sys_stat
4636 +## begin gnulib module unistd
4638 +BUILT_SOURCES += unistd.h
4640 +# We need the following in order to create an empty placeholder for
4641 +# <unistd.h> when the system doesn't have one.
4642 +unistd.h: unistd.in.h
4644 + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
4645 + sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
4646 + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
4647 + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
4648 + -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
4649 + -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \
4650 + -e 's|@''GNULIB_CLOSE''@|$(GNULIB_CLOSE)|g' \
4651 + -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \
4652 + -e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \
4653 + -e 's|@''GNULIB_EUIDACCESS''@|$(GNULIB_EUIDACCESS)|g' \
4654 + -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \
4655 + -e 's|@''GNULIB_FSYNC''@|$(GNULIB_FSYNC)|g' \
4656 + -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \
4657 + -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \
4658 + -e 's|@''GNULIB_GETDOMAINNAME''@|$(GNULIB_GETDOMAINNAME)|g' \
4659 + -e 's|@''GNULIB_GETDTABLESIZE''@|$(GNULIB_GETDTABLESIZE)|g' \
4660 + -e 's|@''GNULIB_GETHOSTNAME''@|$(GNULIB_GETHOSTNAME)|g' \
4661 + -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \
4662 + -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \
4663 + -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \
4664 + -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \
4665 + -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \
4666 + -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \
4667 + -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \
4668 + -e 's|@''GNULIB_UNISTD_H_SIGPIPE''@|$(GNULIB_UNISTD_H_SIGPIPE)|g' \
4669 + -e 's|@''GNULIB_WRITE''@|$(GNULIB_WRITE)|g' \
4670 + -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
4671 + -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \
4672 + -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \
4673 + -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
4674 + -e 's|@''HAVE_GETDOMAINNAME''@|$(HAVE_GETDOMAINNAME)|g' \
4675 + -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \
4676 + -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \
4677 + -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \
4678 + -e 's|@''HAVE_GETUSERSHELL''@|$(HAVE_GETUSERSHELL)|g' \
4679 + -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
4680 + -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
4681 + -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \
4682 + -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
4683 + -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
4684 + -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
4685 + -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
4686 + -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \
4687 + -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
4688 + -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
4689 + -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
4690 + -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
4691 + -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
4692 + -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \
4693 + -e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \
4694 + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
4695 + < $(srcdir)/unistd.in.h; \
4698 +MOSTLYCLEANFILES += unistd.h unistd.h-t
4700 +EXTRA_DIST += unistd.in.h
4702 +## end gnulib module unistd
4704 +## begin gnulib module wchar
4706 +BUILT_SOURCES += $(WCHAR_H)
4708 +# We need the following in order to create <wchar.h> when the system
4709 +# version does not work standalone.
4710 +wchar.h: wchar.in.h
4712 + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
4713 + sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
4714 + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
4715 + -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
4716 + -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \
4717 + -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \
4718 + -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
4719 + -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
4720 + -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
4721 + -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
4722 + < $(srcdir)/wchar.in.h; \
4725 +MOSTLYCLEANFILES += wchar.h wchar.h-t
4727 +EXTRA_DIST += wchar.in.h
4729 +## end gnulib module wchar
4731 +## begin gnulib module wctype
4733 +BUILT_SOURCES += $(WCTYPE_H)
4735 +# We need the following in order to create <wctype.h> when the system
4736 +# doesn't have one that works with the given compiler.
4737 +wctype.h: wctype.in.h
4739 + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
4740 + sed -e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \
4741 + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
4742 + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
4743 + -e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \
4744 + -e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \
4745 + -e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
4746 + -e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \
4747 + < $(srcdir)/wctype.in.h; \
4750 +MOSTLYCLEANFILES += wctype.h wctype.h-t
4752 +EXTRA_DIST += wctype.in.h
4754 +## end gnulib module wctype
4756 +## begin gnulib module dummy
4758 +libgnu_la_SOURCES += dummy.c
4760 +## end gnulib module dummy
4763 +mostlyclean-local: mostlyclean-generic
4764 + @for dir in '' $(MOSTLYCLEANDIRS); do \
4765 + if test -n "$$dir" && test -d $$dir; then \
4766 + echo "rmdir $$dir"; rmdir $$dir; \
4770 diff -urN popt-for-windows/lib/malloc.c popt-for-windows-gnulib/lib/malloc.c
4771 --- popt-for-windows/lib/malloc.c 1970-01-01 01:00:00.000000000 +0100
4772 +++ popt-for-windows-gnulib/lib/malloc.c 2008-10-25 15:17:05.000000000 +0100
4774 +/* malloc() function that is glibc compatible.
4776 + Copyright (C) 1997, 1998, 2006, 2007 Free Software Foundation, Inc.
4778 + This program is free software; you can redistribute it and/or modify
4779 + it under the terms of the GNU General Public License as published by
4780 + the Free Software Foundation; either version 3, or (at your option)
4781 + any later version.
4783 + This program is distributed in the hope that it will be useful,
4784 + but WITHOUT ANY WARRANTY; without even the implied warranty of
4785 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4786 + GNU General Public License for more details.
4788 + You should have received a copy of the GNU General Public License
4789 + along with this program; if not, write to the Free Software Foundation,
4790 + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
4792 +/* written by Jim Meyering and Bruno Haible */
4794 +#include <config.h>
4795 +/* Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h. */
4797 +# define NEED_MALLOC_GNU
4801 +/* Specification. */
4802 +#include <stdlib.h>
4806 +/* Call the system's malloc below. */
4809 +/* Allocate an N-byte block of memory from the heap.
4810 + If N is zero, allocate a 1-byte block. */
4813 +rpl_malloc (size_t n)
4817 +#ifdef NEED_MALLOC_GNU
4822 + result = malloc (n);
4824 +#if !HAVE_MALLOC_POSIX
4825 + if (result == NULL)
4831 diff -urN popt-for-windows/lib/mempcpy.c popt-for-windows-gnulib/lib/mempcpy.c
4832 --- popt-for-windows/lib/mempcpy.c 1970-01-01 01:00:00.000000000 +0100
4833 +++ popt-for-windows-gnulib/lib/mempcpy.c 2008-10-25 15:17:05.000000000 +0100
4835 +/* Copy memory area and return pointer after last written byte.
4836 + Copyright (C) 2003, 2007 Free Software Foundation, Inc.
4838 + This program is free software; you can redistribute it and/or modify
4839 + it under the terms of the GNU General Public License as published by
4840 + the Free Software Foundation; either version 3, or (at your option)
4841 + any later version.
4843 + This program is distributed in the hope that it will be useful,
4844 + but WITHOUT ANY WARRANTY; without even the implied warranty of
4845 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4846 + GNU General Public License for more details.
4848 + You should have received a copy of the GNU General Public License
4849 + along with this program; if not, write to the Free Software Foundation,
4850 + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
4852 +#include <config.h>
4854 +/* Specification. */
4855 +#include <string.h>
4857 +/* Copy N bytes of SRC to DEST, return pointer to bytes after the
4858 + last written byte. */
4860 +mempcpy (void *dest, const void *src, size_t n)
4862 + return (char *) memcpy (dest, src, n) + n;
4864 diff -urN popt-for-windows/lib/stdbool.in.h popt-for-windows-gnulib/lib/stdbool.in.h
4865 --- popt-for-windows/lib/stdbool.in.h 1970-01-01 01:00:00.000000000 +0100
4866 +++ popt-for-windows-gnulib/lib/stdbool.in.h 2008-10-25 15:17:05.000000000 +0100
4868 +/* Copyright (C) 2001-2003, 2006-2008 Free Software Foundation, Inc.
4869 + Written by Bruno Haible <haible@clisp.cons.org>, 2001.
4871 + This program is free software; you can redistribute it and/or modify
4872 + it under the terms of the GNU General Public License as published by
4873 + the Free Software Foundation; either version 3, or (at your option)
4874 + any later version.
4876 + This program is distributed in the hope that it will be useful,
4877 + but WITHOUT ANY WARRANTY; without even the implied warranty of
4878 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4879 + GNU General Public License for more details.
4881 + You should have received a copy of the GNU General Public License
4882 + along with this program; if not, write to the Free Software Foundation,
4883 + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
4885 +#ifndef _GL_STDBOOL_H
4886 +#define _GL_STDBOOL_H
4888 +/* ISO C 99 <stdbool.h> for platforms that lack it. */
4890 +/* Usage suggestions:
4892 + Programs that use <stdbool.h> should be aware of some limitations
4893 + and standards compliance issues.
4895 + Standards compliance:
4897 + - <stdbool.h> must be #included before 'bool', 'false', 'true'
4900 + - You cannot assume that sizeof (bool) == 1.
4902 + - Programs should not undefine the macros bool, true, and false,
4903 + as C99 lists that as an "obsolescent feature".
4905 + Limitations of this substitute, when used in a C89 environment:
4907 + - <stdbool.h> must be #included before the '_Bool' type can be used.
4909 + - You cannot assume that _Bool is a typedef; it might be a macro.
4911 + - Bit-fields of type 'bool' are not supported. Portable code
4912 + should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'.
4914 + - In C99, casts and automatic conversions to '_Bool' or 'bool' are
4915 + performed in such a way that every nonzero value gets converted
4916 + to 'true', and zero gets converted to 'false'. This doesn't work
4917 + with this substitute. With this substitute, only the values 0 and 1
4918 + give the expected result when converted to _Bool' or 'bool'.
4920 + Also, it is suggested that programs use 'bool' rather than '_Bool';
4921 + this isn't required, but 'bool' is more common. */
4924 +/* 7.16. Boolean type and values */
4926 +/* BeOS <sys/socket.h> already #defines false 0, true 1. We use the same
4927 + definitions below, but temporarily we have to #undef them. */
4928 +#if defined __BEOS__ && !defined __HAIKU__
4929 +# include <OS.h> /* defines bool but not _Bool */
4934 +/* For the sake of symbolic names in gdb, we define true and false as
4935 + enum constants, not only as macros.
4936 + It is tempting to write
4937 + typedef enum { false = 0, true = 1 } _Bool;
4938 + so that gdb prints values of type 'bool' symbolically. But if we do
4939 + this, values of type '_Bool' may promote to 'int' or 'unsigned int'
4940 + (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
4941 + (see ISO C 99 6.3.1.1.(2)). So we add a negative value to the
4942 + enum; this ensures that '_Bool' promotes to 'int'. */
4943 +#if defined __cplusplus || (defined __BEOS__ && !defined __HAIKU__)
4944 + /* A compiler known to have 'bool'. */
4945 + /* If the compiler already has both 'bool' and '_Bool', we can assume they
4946 + are the same types. */
4948 +typedef bool _Bool;
4951 +# if !defined __GNUC__
4952 + /* If @HAVE__BOOL@:
4953 + Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when
4954 + the built-in _Bool type is used. See
4955 + http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
4956 + http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
4957 + http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
4958 + Similar bugs are likely with other compilers as well; this file
4959 + wouldn't be used if <stdbool.h> was working.
4960 + So we override the _Bool type.
4962 + Need to define _Bool ourselves. As 'signed char' or as an enum type?
4963 + Use of a typedef, with SunPRO C, leads to a stupid
4964 + "warning: _Bool is a keyword in ISO C99".
4965 + Use of an enum type, with IRIX cc, leads to a stupid
4966 + "warning(1185): enumerated type mixed with another type".
4967 + Even the existence of an enum type, without a typedef,
4968 + "Invalid enumerator. (badenum)" with HP-UX cc on Tru64.
4969 + The only benefit of the enum, debuggability, is not important
4970 + with these compilers. So use 'signed char' and no enum. */
4971 +# define _Bool signed char
4973 + /* With this compiler, trust the _Bool type if the compiler has it. */
4975 +typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
4981 +/* The other macros must be usable in preprocessor directives. */
4984 +#define __bool_true_false_are_defined 1
4986 +#endif /* _GL_STDBOOL_H */
4987 diff -urN popt-for-windows/lib/stdlib.in.h popt-for-windows-gnulib/lib/stdlib.in.h
4988 --- popt-for-windows/lib/stdlib.in.h 1970-01-01 01:00:00.000000000 +0100
4989 +++ popt-for-windows-gnulib/lib/stdlib.in.h 2008-10-25 15:17:05.000000000 +0100
4991 +/* A GNU-like <stdlib.h>.
4993 + Copyright (C) 1995, 2001-2004, 2006-2008 Free Software Foundation, Inc.
4995 + This program is free software: you can redistribute it and/or modify
4996 + it under the terms of the GNU General Public License as published by
4997 + the Free Software Foundation; either version 3 of the License, or
4998 + (at your option) any later version.
5000 + This program is distributed in the hope that it will be useful,
5001 + but WITHOUT ANY WARRANTY; without even the implied warranty of
5002 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5003 + GNU General Public License for more details.
5005 + You should have received a copy of the GNU General Public License
5006 + along with this program. If not, see <http://www.gnu.org/licenses/>. */
5009 +@PRAGMA_SYSTEM_HEADER@
5012 +#if defined __need_malloc_and_calloc
5013 +/* Special invocation convention inside glibc header files. */
5015 +#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
5018 +/* Normal invocation convention. */
5020 +#ifndef _GL_STDLIB_H
5022 +/* The include_next requires a split double-inclusion guard. */
5023 +#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
5025 +#ifndef _GL_STDLIB_H
5026 +#define _GL_STDLIB_H
5029 +/* Solaris declares getloadavg() in <sys/loadavg.h>. */
5030 +#if @GNULIB_GETLOADAVG@ && @HAVE_SYS_LOADAVG_H@
5031 +# include <sys/loadavg.h>
5034 +/* The definition of GL_LINK_WARNING is copied here. */
5037 +/* Some systems do not define EXIT_*, despite otherwise supporting C89. */
5038 +#ifndef EXIT_SUCCESS
5039 +# define EXIT_SUCCESS 0
5041 +/* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
5042 + with proper operation of xargs. */
5043 +#ifndef EXIT_FAILURE
5044 +# define EXIT_FAILURE 1
5045 +#elif EXIT_FAILURE != 1
5046 +# undef EXIT_FAILURE
5047 +# define EXIT_FAILURE 1
5056 +#if @GNULIB_MALLOC_POSIX@
5057 +# if !@HAVE_MALLOC_POSIX@
5059 +# define malloc rpl_malloc
5060 +extern void * malloc (size_t size);
5062 +#elif defined GNULIB_POSIXCHECK
5064 +# define malloc(s) \
5065 + (GL_LINK_WARNING ("malloc is not POSIX compliant everywhere - " \
5066 + "use gnulib module malloc-posix for portability"), \
5071 +#if @GNULIB_REALLOC_POSIX@
5072 +# if !@HAVE_REALLOC_POSIX@
5074 +# define realloc rpl_realloc
5075 +extern void * realloc (void *ptr, size_t size);
5077 +#elif defined GNULIB_POSIXCHECK
5079 +# define realloc(p,s) \
5080 + (GL_LINK_WARNING ("realloc is not POSIX compliant everywhere - " \
5081 + "use gnulib module realloc-posix for portability"), \
5086 +#if @GNULIB_CALLOC_POSIX@
5087 +# if !@HAVE_CALLOC_POSIX@
5089 +# define calloc rpl_calloc
5090 +extern void * calloc (size_t nmemb, size_t size);
5092 +#elif defined GNULIB_POSIXCHECK
5094 +# define calloc(n,s) \
5095 + (GL_LINK_WARNING ("calloc is not POSIX compliant everywhere - " \
5096 + "use gnulib module calloc-posix for portability"), \
5103 +/* Parse a signed decimal integer.
5104 + Returns the value of the integer. Errors are not detected. */
5105 +extern long long atoll (const char *string);
5107 +#elif defined GNULIB_POSIXCHECK
5109 +# define atoll(s) \
5110 + (GL_LINK_WARNING ("atoll is unportable - " \
5111 + "use gnulib module atoll for portability"), \
5116 +#if @GNULIB_GETLOADAVG@
5117 +# if !@HAVE_DECL_GETLOADAVG@
5118 +/* Store max(NELEM,3) load average numbers in LOADAVG[].
5119 + The three numbers are the load average of the last 1 minute, the last 5
5120 + minutes, and the last 15 minutes, respectively.
5121 + LOADAVG is an array of NELEM numbers. */
5122 +extern int getloadavg (double loadavg[], int nelem);
5124 +#elif defined GNULIB_POSIXCHECK
5126 +# define getloadavg(l,n) \
5127 + (GL_LINK_WARNING ("getloadavg is not portable - " \
5128 + "use gnulib module getloadavg for portability"), \
5129 + getloadavg (l, n))
5133 +#if @GNULIB_GETSUBOPT@
5134 +/* Assuming *OPTIONP is a comma separated list of elements of the form
5135 + "token" or "token=value", getsubopt parses the first of these elements.
5136 + If the first element refers to a "token" that is member of the given
5137 + NULL-terminated array of tokens:
5138 + - It replaces the comma with a NUL byte, updates *OPTIONP to point past
5139 + the first option and the comma, sets *VALUEP to the value of the
5140 + element (or NULL if it doesn't contain an "=" sign),
5141 + - It returns the index of the "token" in the given array of tokens.
5142 + Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
5143 + For more details see the POSIX:2001 specification.
5144 + http://www.opengroup.org/susv3xsh/getsubopt.html */
5145 +# if !@HAVE_GETSUBOPT@
5146 +extern int getsubopt (char **optionp, char *const *tokens, char **valuep);
5148 +#elif defined GNULIB_POSIXCHECK
5150 +# define getsubopt(o,t,v) \
5151 + (GL_LINK_WARNING ("getsubopt is unportable - " \
5152 + "use gnulib module getsubopt for portability"), \
5153 + getsubopt (o, t, v))
5157 +#if @GNULIB_MKDTEMP@
5158 +# if !@HAVE_MKDTEMP@
5159 +/* Create a unique temporary directory from TEMPLATE.
5160 + The last six characters of TEMPLATE must be "XXXXXX";
5161 + they are replaced with a string that makes the directory name unique.
5162 + Returns TEMPLATE, or a null pointer if it cannot get a unique name.
5163 + The directory is created mode 700. */
5164 +extern char * mkdtemp (char * /*template*/);
5166 +#elif defined GNULIB_POSIXCHECK
5168 +# define mkdtemp(t) \
5169 + (GL_LINK_WARNING ("mkdtemp is unportable - " \
5170 + "use gnulib module mkdtemp for portability"), \
5175 +#if @GNULIB_MKSTEMP@
5176 +# if @REPLACE_MKSTEMP@
5177 +/* Create a unique temporary file from TEMPLATE.
5178 + The last six characters of TEMPLATE must be "XXXXXX";
5179 + they are replaced with a string that makes the file name unique.
5180 + The file is then created, ensuring it didn't exist before.
5181 + The file is created read-write (mask at least 0600 & ~umask), but it may be
5182 + world-readable and world-writable (mask 0666 & ~umask), depending on the
5184 + Returns the open file descriptor if successful, otherwise -1 and errno
5186 +# define mkstemp rpl_mkstemp
5187 +extern int mkstemp (char * /*template*/);
5189 +/* On MacOS X 10.3, only <unistd.h> declares mkstemp. */
5190 +# include <unistd.h>
5192 +#elif defined GNULIB_POSIXCHECK
5194 +# define mkstemp(t) \
5195 + (GL_LINK_WARNING ("mkstemp is unportable - " \
5196 + "use gnulib module mkstemp for portability"), \
5201 +#if @GNULIB_PUTENV@
5202 +# if @REPLACE_PUTENV@
5204 +# define putenv rpl_putenv
5205 +extern int putenv (char *string);
5210 +#if @GNULIB_RAND48@
5211 +# if !@HAVE_RAND48@
5213 +struct drand48_data
5215 + unsigned short int __x[3]; /* Current state. */
5216 + unsigned short int __old_x[3]; /* Old state. */
5217 + unsigned short int __c; /* Additive const. in congruential formula. */
5218 + unsigned short int __init; /* Flag for initializing. */
5219 + unsigned long long int __a; /* Factor in congruential formula. */
5222 +double drand48 (void);
5223 +int drand48_r (struct drand48_data *buffer, double *result);
5224 +double erand48 ( unsigned short int xsubi[3]);
5225 +int erand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, double *result);
5226 +long int jrand48 (unsigned short int xsubi[3]);
5227 +int jrand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, long int *result);
5228 +void lcong48 (unsigned short int param[7]);
5229 +int lcong48_r (unsigned short int param[7], struct drand48_data *buffer);
5230 +long int lrand48 ();
5231 +int lrand48_r (struct drand48_data *buffer, long int *result);
5232 +long int mrand48 ();
5233 +int mrand48_r (struct drand48_data *buffer, long int *result);
5234 +long int nrand48 (unsigned short int xsubi[3]);
5235 +int nrand48_r (unsigned short int xsubi[3], struct drand48_data *buffer, long int *result);
5236 +unsigned short int *seed48 (unsigned short int seed16v[3]);
5237 +int seed48_r (unsigned short int seed16v[3], struct drand48_data *buffer);
5238 +void srand48 (long seedval);
5239 +int srand48_r (long int seedval, struct drand48_data *buffer);
5242 +#elif defined GNULIB_POSIXCHECK
5244 +# define drand48() \
5245 + (GL_LINK_WARNING ("drand48 is unportable - " \
5246 + "use gnulib module rand48 for portability"), \
5249 +# define drand48_r(b,r) \
5250 + (GL_LINK_WARNING ("drand48_r is unportable - " \
5251 + "use gnulib module rand48 for portability"), \
5254 +# define erand48(a) \
5255 + (GL_LINK_WARNING ("erand48 is unportable - " \
5256 + "use gnulib module rand48 for portability"), \
5259 +# define erand48_r(a,b,r) \
5260 + (GL_LINK_WARNING ("erand48_r is unportable - " \
5261 + "use gnulib module rand48 for portability"), \
5262 + erand48_r (a,b,r))
5264 +# define jrand48(a) \
5265 + (GL_LINK_WARNING ("jrand48 is unportable - " \
5266 + "use gnulib module rand48 for portability"), \
5269 +# define jrand48_r(a,b,r) \
5270 + (GL_LINK_WARNING ("drand48 is unportable - " \
5271 + "use gnulib module rand48 for portability"), \
5272 + jrand48_r (a,b,r))
5274 +# define lcong48(p) \
5275 + (GL_LINK_WARNING ("lcong48 is unportable - " \
5276 + "use gnulib module rand48 for portability"), \
5279 +# define lcong48_r(p,b) \
5280 + (GL_LINK_WARNING ("lcong48_r is unportable - " \
5281 + "use gnulib module rand48 for portability"), \
5284 +# define lrand48() \
5285 + (GL_LINK_WARNING ("lrand48 is unportable - " \
5286 + "use gnulib module rand48 for portability"), \
5289 +# define lrand48_r(b,r) \
5290 + (GL_LINK_WARNING ("lrand48_r is unportable - " \
5291 + "use gnulib module rand48 for portability"), \
5294 +# define mrand48() \
5295 + (GL_LINK_WARNING ("mrand48 is unportable - " \
5296 + "use gnulib module rand48 for portability"), \
5299 +# define mrand48_r(b,r) \
5300 + (GL_LINK_WARNING ("mrand48_r is unportable - " \
5301 + "use gnulib module rand48 for portability"), \
5304 +# define nrand48(a) \
5305 + (GL_LINK_WARNING ("nrand48 is unportable - " \
5306 + "use gnulib module rand48 for portability"), \
5309 +# define nrand48_r(a,b,r) \
5310 + (GL_LINK_WARNING ("nrand48_r is unportable - " \
5311 + "use gnulib module rand48 for portability"), \
5312 + nrand48_r (a,b,r))
5314 +# define seed48(s) \
5315 + (GL_LINK_WARNING ("seed48 is unportable - " \
5316 + "use gnulib module rand48 for portability"), \
5319 +# define seed48_r(s,b) \
5320 + (GL_LINK_WARNING ("seed48_r is unportable - " \
5321 + "use gnulib module rand48 for portability"), \
5324 +# define srand48(s) \
5325 + (GL_LINK_WARNING ("srand48 is unportable - " \
5326 + "use gnulib module rand48 for portability"), \
5329 +# define srand48_r(s,b) \
5330 + (GL_LINK_WARNING ("srand48_r is unportable - " \
5331 + "use gnulib module rand48 for portability"), \
5336 +#if @GNULIB_RANDOM_R@
5337 +# if !@HAVE_RANDOM_R@
5340 +# define RAND_MAX 2147483647
5343 +int srandom_r (unsigned int seed, struct random_data *rand_state);
5344 +int initstate_r (unsigned int seed, char *buf, size_t buf_size,
5345 + struct random_data *rand_state);
5346 +int setstate_r (char *arg_state, struct random_data *rand_state);
5347 +int random_r (struct random_data *buf, int32_t *result);
5349 +#elif defined GNULIB_POSIXCHECK
5351 +# define random_r(b,r) \
5352 + (GL_LINK_WARNING ("random_r is unportable - " \
5353 + "use gnulib module random_r for portability"), \
5355 +# undef initstate_r
5356 +# define initstate_r(s,b,sz,r) \
5357 + (GL_LINK_WARNING ("initstate_r is unportable - " \
5358 + "use gnulib module random_r for portability"), \
5359 + initstate_r (s,b,sz,r))
5361 +# define srandom_r(s,r) \
5362 + (GL_LINK_WARNING ("srandom_r is unportable - " \
5363 + "use gnulib module random_r for portability"), \
5366 +# define setstate_r(a,r) \
5367 + (GL_LINK_WARNING ("setstate_r is unportable - " \
5368 + "use gnulib module random_r for portability"), \
5373 +#if @GNULIB_RPMATCH@
5374 +# if !@HAVE_RPMATCH@
5375 +/* Test a user response to a question.
5376 + Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */
5377 +extern int rpmatch (const char *response);
5379 +#elif defined GNULIB_POSIXCHECK
5381 +# define rpmatch(r) \
5382 + (GL_LINK_WARNING ("rpmatch is unportable - " \
5383 + "use gnulib module rpmatch for portability"), \
5388 +#if @GNULIB_SETENV@
5389 +# if !@HAVE_SETENV@
5390 +/* Set NAME to VALUE in the environment.
5391 + If REPLACE is nonzero, overwrite an existing value. */
5392 +extern int setenv (const char *name, const char *value, int replace);
5397 +#if @GNULIB_UNSETENV@
5398 +# if @HAVE_UNSETENV@
5399 +# if @VOID_UNSETENV@
5400 +/* On some systems, unsetenv() returns void.
5401 + This is the case for MacOS X 10.3, FreeBSD 4.8, NetBSD 1.6, OpenBSD 3.4. */
5402 +# define unsetenv(name) ((unsetenv)(name), 0)
5405 +/* Remove the variable NAME from the environment. */
5406 +extern int unsetenv (const char *name);
5411 +#if @GNULIB_STRTOD@
5412 +# if @REPLACE_STRTOD@
5413 +# define strtod rpl_strtod
5415 +# if !@HAVE_STRTOD@ || @REPLACE_STRTOD@
5416 + /* Parse a double from STRING, updating ENDP if appropriate. */
5417 +extern double strtod (const char *str, char **endp);
5419 +#elif defined GNULIB_POSIXCHECK
5421 +# define strtod(s, e) \
5422 + (GL_LINK_WARNING ("strtod is unportable - " \
5423 + "use gnulib module strtod for portability"), \
5428 +#if @GNULIB_STRTOLL@
5429 +# if !@HAVE_STRTOLL@
5430 +/* Parse a signed integer whose textual representation starts at STRING.
5431 + The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
5432 + it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
5434 + If ENDPTR is not NULL, the address of the first byte after the integer is
5435 + stored in *ENDPTR.
5436 + Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
5438 +extern long long strtoll (const char *string, char **endptr, int base);
5440 +#elif defined GNULIB_POSIXCHECK
5442 +# define strtoll(s,e,b) \
5443 + (GL_LINK_WARNING ("strtoll is unportable - " \
5444 + "use gnulib module strtoll for portability"), \
5445 + strtoll (s, e, b))
5449 +#if @GNULIB_STRTOULL@
5450 +# if !@HAVE_STRTOULL@
5451 +/* Parse an unsigned integer whose textual representation starts at STRING.
5452 + The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
5453 + it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
5455 + If ENDPTR is not NULL, the address of the first byte after the integer is
5456 + stored in *ENDPTR.
5457 + Upon overflow, the return value is ULLONG_MAX, and errno is set to
5459 +extern unsigned long long strtoull (const char *string, char **endptr, int base);
5461 +#elif defined GNULIB_POSIXCHECK
5463 +# define strtoull(s,e,b) \
5464 + (GL_LINK_WARNING ("strtoull is unportable - " \
5465 + "use gnulib module strtoull for portability"), \
5466 + strtoull (s, e, b))
5474 +#endif /* _GL_STDLIB_H */
5475 +#endif /* _GL_STDLIB_H */
5477 diff -urN popt-for-windows/lib/strdup.c popt-for-windows-gnulib/lib/strdup.c
5478 --- popt-for-windows/lib/strdup.c 1970-01-01 01:00:00.000000000 +0100
5479 +++ popt-for-windows-gnulib/lib/strdup.c 2008-10-25 15:17:05.000000000 +0100
5481 +/* Copyright (C) 1991, 1996, 1997, 1998, 2002, 2003, 2004, 2006, 2007 Free
5482 + Software Foundation, Inc.
5484 + This file is part of the GNU C Library.
5486 + This program is free software; you can redistribute it and/or modify
5487 + it under the terms of the GNU General Public License as published by
5488 + the Free Software Foundation; either version 3, or (at your option)
5489 + any later version.
5491 + This program is distributed in the hope that it will be useful,
5492 + but WITHOUT ANY WARRANTY; without even the implied warranty of
5493 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5494 + GNU General Public License for more details.
5496 + You should have received a copy of the GNU General Public License along
5497 + with this program; if not, write to the Free Software Foundation,
5498 + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
5501 +# include <config.h>
5504 +/* Get specification. */
5505 +#include <string.h>
5507 +#include <stdlib.h>
5515 +# define __strdup strdup
5518 +/* Duplicate S, returning an identical malloc'd string. */
5520 +__strdup (const char *s)
5522 + size_t len = strlen (s) + 1;
5523 + void *new = malloc (len);
5528 + return (char *) memcpy (new, s, len);
5530 +#ifdef libc_hidden_def
5531 +libc_hidden_def (__strdup)
5534 +weak_alias (__strdup, strdup)
5536 diff -urN popt-for-windows/lib/string.in.h popt-for-windows-gnulib/lib/string.in.h
5537 --- popt-for-windows/lib/string.in.h 1970-01-01 01:00:00.000000000 +0100
5538 +++ popt-for-windows-gnulib/lib/string.in.h 2008-10-25 15:17:05.000000000 +0100
5540 +/* A GNU-like <string.h>.
5542 + Copyright (C) 1995-1996, 2001-2008 Free Software Foundation, Inc.
5544 + This program is free software; you can redistribute it and/or modify
5545 + it under the terms of the GNU General Public License as published by
5546 + the Free Software Foundation; either version 3, or (at your option)
5547 + any later version.
5549 + This program is distributed in the hope that it will be useful,
5550 + but WITHOUT ANY WARRANTY; without even the implied warranty of
5551 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5552 + GNU General Public License for more details.
5554 + You should have received a copy of the GNU General Public License
5555 + along with this program; if not, write to the Free Software Foundation,
5556 + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
5558 +#ifndef _GL_STRING_H
5561 +@PRAGMA_SYSTEM_HEADER@
5564 +/* The include_next requires a split double-inclusion guard. */
5565 +#@INCLUDE_NEXT@ @NEXT_STRING_H@
5567 +#ifndef _GL_STRING_H
5568 +#define _GL_STRING_H
5571 +#ifndef __attribute__
5572 +/* This feature is available in gcc versions 2.5 and later. */
5573 +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
5574 +# define __attribute__(Spec) /* empty */
5576 +/* The attribute __pure__ was added in gcc 2.96. */
5577 +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
5578 +# define __pure__ /* empty */
5583 +/* The definition of GL_LINK_WARNING is copied here. */
5591 +/* Return the first occurrence of NEEDLE in HAYSTACK. */
5592 +#if @GNULIB_MEMMEM@
5593 +# if @REPLACE_MEMMEM@
5594 +# define memmem rpl_memmem
5596 +# if ! @HAVE_DECL_MEMMEM@ || @REPLACE_MEMMEM@
5597 +extern void *memmem (void const *__haystack, size_t __haystack_len,
5598 + void const *__needle, size_t __needle_len)
5599 + __attribute__ ((__pure__));
5601 +#elif defined GNULIB_POSIXCHECK
5603 +# define memmem(a,al,b,bl) \
5604 + (GL_LINK_WARNING ("memmem is unportable and often quadratic - " \
5605 + "use gnulib module memmem-simple for portability, " \
5606 + "and module memmem for speed" ), \
5607 + memmem (a, al, b, bl))
5610 +/* Copy N bytes of SRC to DEST, return pointer to bytes after the
5611 + last written byte. */
5612 +#if @GNULIB_MEMPCPY@
5613 +# if ! @HAVE_MEMPCPY@
5614 +extern void *mempcpy (void *restrict __dest, void const *restrict __src,
5617 +#elif defined GNULIB_POSIXCHECK
5619 +# define mempcpy(a,b,n) \
5620 + (GL_LINK_WARNING ("mempcpy is unportable - " \
5621 + "use gnulib module mempcpy for portability"), \
5622 + mempcpy (a, b, n))
5625 +/* Search backwards through a block for a byte (specified as an int). */
5626 +#if @GNULIB_MEMRCHR@
5627 +# if ! @HAVE_DECL_MEMRCHR@
5628 +extern void *memrchr (void const *, int, size_t)
5629 + __attribute__ ((__pure__));
5631 +#elif defined GNULIB_POSIXCHECK
5633 +# define memrchr(a,b,c) \
5634 + (GL_LINK_WARNING ("memrchr is unportable - " \
5635 + "use gnulib module memrchr for portability"), \
5636 + memrchr (a, b, c))
5639 +/* Find the first occurrence of C in S. More efficient than
5640 + memchr(S,C,N), at the expense of undefined behavior if C does not
5641 + occur within N bytes. */
5642 +#if @GNULIB_RAWMEMCHR@
5643 +# if ! @HAVE_RAWMEMCHR@
5644 +extern void *rawmemchr (void const *__s, int __c_in)
5645 + __attribute__ ((__pure__));
5647 +#elif defined GNULIB_POSIXCHECK
5649 +# define rawmemchr(a,b) \
5650 + (GL_LINK_WARNING ("rawmemchr is unportable - " \
5651 + "use gnulib module rawmemchr for portability"), \
5655 +/* Copy SRC to DST, returning the address of the terminating '\0' in DST. */
5656 +#if @GNULIB_STPCPY@
5657 +# if ! @HAVE_STPCPY@
5658 +extern char *stpcpy (char *restrict __dst, char const *restrict __src);
5660 +#elif defined GNULIB_POSIXCHECK
5662 +# define stpcpy(a,b) \
5663 + (GL_LINK_WARNING ("stpcpy is unportable - " \
5664 + "use gnulib module stpcpy for portability"), \
5668 +/* Copy no more than N bytes of SRC to DST, returning a pointer past the
5669 + last non-NUL byte written into DST. */
5670 +#if @GNULIB_STPNCPY@
5671 +# if ! @HAVE_STPNCPY@
5672 +# define stpncpy gnu_stpncpy
5673 +extern char *stpncpy (char *restrict __dst, char const *restrict __src,
5676 +#elif defined GNULIB_POSIXCHECK
5678 +# define stpncpy(a,b,n) \
5679 + (GL_LINK_WARNING ("stpncpy is unportable - " \
5680 + "use gnulib module stpncpy for portability"), \
5681 + stpncpy (a, b, n))
5684 +#if defined GNULIB_POSIXCHECK
5685 +/* strchr() does not work with multibyte strings if the locale encoding is
5686 + GB18030 and the character to be searched is a digit. */
5688 +# define strchr(s,c) \
5689 + (GL_LINK_WARNING ("strchr cannot work correctly on character strings " \
5690 + "in some multibyte locales - " \
5691 + "use mbschr if you care about internationalization"), \
5695 +/* Find the first occurrence of C in S or the final NUL byte. */
5696 +#if @GNULIB_STRCHRNUL@
5697 +# if ! @HAVE_STRCHRNUL@
5698 +extern char *strchrnul (char const *__s, int __c_in)
5699 + __attribute__ ((__pure__));
5701 +#elif defined GNULIB_POSIXCHECK
5703 +# define strchrnul(a,b) \
5704 + (GL_LINK_WARNING ("strchrnul is unportable - " \
5705 + "use gnulib module strchrnul for portability"), \
5709 +/* Duplicate S, returning an identical malloc'd string. */
5710 +#if @GNULIB_STRDUP@
5711 +# if @REPLACE_STRDUP@
5713 +# define strdup rpl_strdup
5715 +# if !(@HAVE_DECL_STRDUP@ || defined strdup) || @REPLACE_STRDUP@
5716 +extern char *strdup (char const *__s);
5718 +#elif defined GNULIB_POSIXCHECK
5720 +# define strdup(a) \
5721 + (GL_LINK_WARNING ("strdup is unportable - " \
5722 + "use gnulib module strdup for portability"), \
5726 +/* Return a newly allocated copy of at most N bytes of STRING. */
5727 +#if @GNULIB_STRNDUP@
5728 +# if ! @HAVE_STRNDUP@
5730 +# define strndup rpl_strndup
5732 +# if ! @HAVE_STRNDUP@ || ! @HAVE_DECL_STRNDUP@
5733 +extern char *strndup (char const *__string, size_t __n);
5735 +#elif defined GNULIB_POSIXCHECK
5737 +# define strndup(a,n) \
5738 + (GL_LINK_WARNING ("strndup is unportable - " \
5739 + "use gnulib module strndup for portability"), \
5743 +/* Find the length (number of bytes) of STRING, but scan at most
5744 + MAXLEN bytes. If no '\0' terminator is found in that many bytes,
5746 +#if @GNULIB_STRNLEN@
5747 +# if ! @HAVE_DECL_STRNLEN@
5748 +extern size_t strnlen (char const *__string, size_t __maxlen)
5749 + __attribute__ ((__pure__));
5751 +#elif defined GNULIB_POSIXCHECK
5753 +# define strnlen(a,n) \
5754 + (GL_LINK_WARNING ("strnlen is unportable - " \
5755 + "use gnulib module strnlen for portability"), \
5759 +#if defined GNULIB_POSIXCHECK
5760 +/* strcspn() assumes the second argument is a list of single-byte characters.
5761 + Even in this simple case, it does not work with multibyte strings if the
5762 + locale encoding is GB18030 and one of the characters to be searched is a
5765 +# define strcspn(s,a) \
5766 + (GL_LINK_WARNING ("strcspn cannot work correctly on character strings " \
5767 + "in multibyte locales - " \
5768 + "use mbscspn if you care about internationalization"), \
5772 +/* Find the first occurrence in S of any character in ACCEPT. */
5773 +#if @GNULIB_STRPBRK@
5774 +# if ! @HAVE_STRPBRK@
5775 +extern char *strpbrk (char const *__s, char const *__accept)
5776 + __attribute__ ((__pure__));
5778 +# if defined GNULIB_POSIXCHECK
5779 +/* strpbrk() assumes the second argument is a list of single-byte characters.
5780 + Even in this simple case, it does not work with multibyte strings if the
5781 + locale encoding is GB18030 and one of the characters to be searched is a
5784 +# define strpbrk(s,a) \
5785 + (GL_LINK_WARNING ("strpbrk cannot work correctly on character strings " \
5786 + "in multibyte locales - " \
5787 + "use mbspbrk if you care about internationalization"), \
5790 +#elif defined GNULIB_POSIXCHECK
5792 +# define strpbrk(s,a) \
5793 + (GL_LINK_WARNING ("strpbrk is unportable - " \
5794 + "use gnulib module strpbrk for portability"), \
5798 +#if defined GNULIB_POSIXCHECK
5799 +/* strspn() assumes the second argument is a list of single-byte characters.
5800 + Even in this simple case, it cannot work with multibyte strings. */
5802 +# define strspn(s,a) \
5803 + (GL_LINK_WARNING ("strspn cannot work correctly on character strings " \
5804 + "in multibyte locales - " \
5805 + "use mbsspn if you care about internationalization"), \
5809 +#if defined GNULIB_POSIXCHECK
5810 +/* strrchr() does not work with multibyte strings if the locale encoding is
5811 + GB18030 and the character to be searched is a digit. */
5813 +# define strrchr(s,c) \
5814 + (GL_LINK_WARNING ("strrchr cannot work correctly on character strings " \
5815 + "in some multibyte locales - " \
5816 + "use mbsrchr if you care about internationalization"), \
5820 +/* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
5821 + If one is found, overwrite it with a NUL, and advance *STRINGP
5822 + to point to the next char after it. Otherwise, set *STRINGP to NULL.
5823 + If *STRINGP was already NULL, nothing happens.
5824 + Return the old value of *STRINGP.
5826 + This is a variant of strtok() that is multithread-safe and supports
5829 + Caveat: It modifies the original string.
5830 + Caveat: These functions cannot be used on constant strings.
5831 + Caveat: The identity of the delimiting character is lost.
5832 + Caveat: It doesn't work with multibyte strings unless all of the delimiter
5833 + characters are ASCII characters < 0x30.
5835 + See also strtok_r(). */
5836 +#if @GNULIB_STRSEP@
5837 +# if ! @HAVE_STRSEP@
5838 +extern char *strsep (char **restrict __stringp, char const *restrict __delim);
5840 +# if defined GNULIB_POSIXCHECK
5842 +# define strsep(s,d) \
5843 + (GL_LINK_WARNING ("strsep cannot work correctly on character strings " \
5844 + "in multibyte locales - " \
5845 + "use mbssep if you care about internationalization"), \
5848 +#elif defined GNULIB_POSIXCHECK
5850 +# define strsep(s,d) \
5851 + (GL_LINK_WARNING ("strsep is unportable - " \
5852 + "use gnulib module strsep for portability"), \
5856 +#if @GNULIB_STRSTR@
5857 +# if @REPLACE_STRSTR@
5858 +# define strstr rpl_strstr
5859 +char *strstr (const char *haystack, const char *needle)
5860 + __attribute__ ((__pure__));
5862 +#elif defined GNULIB_POSIXCHECK
5863 +/* strstr() does not work with multibyte strings if the locale encoding is
5864 + different from UTF-8:
5865 + POSIX says that it operates on "strings", and "string" in POSIX is defined
5866 + as a sequence of bytes, not of characters. */
5868 +# define strstr(a,b) \
5869 + (GL_LINK_WARNING ("strstr is quadratic on many systems, and cannot " \
5870 + "work correctly on character strings in most " \
5871 + "multibyte locales - " \
5872 + "use mbsstr if you care about internationalization, " \
5873 + "or use strstr if you care about speed"), \
5877 +/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
5879 +#if @GNULIB_STRCASESTR@
5880 +# if @REPLACE_STRCASESTR@
5881 +# define strcasestr rpl_strcasestr
5883 +# if ! @HAVE_STRCASESTR@ || @REPLACE_STRCASESTR@
5884 +extern char *strcasestr (const char *haystack, const char *needle)
5885 + __attribute__ ((__pure__));
5887 +#elif defined GNULIB_POSIXCHECK
5888 +/* strcasestr() does not work with multibyte strings:
5889 + It is a glibc extension, and glibc implements it only for unibyte
5892 +# define strcasestr(a,b) \
5893 + (GL_LINK_WARNING ("strcasestr does work correctly on character strings " \
5894 + "in multibyte locales - " \
5895 + "use mbscasestr if you care about " \
5896 + "internationalization, or use c-strcasestr if you want " \
5897 + "a locale independent function"), \
5898 + strcasestr (a, b))
5901 +/* Parse S into tokens separated by characters in DELIM.
5902 + If S is NULL, the saved pointer in SAVE_PTR is used as
5903 + the next starting point. For example:
5904 + char s[] = "-abc-=-def";
5906 + x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def"
5907 + x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL
5908 + x = strtok_r(NULL, "=", &sp); // x = NULL
5909 + // s = "abc\0-def\0"
5911 + This is a variant of strtok() that is multithread-safe.
5913 + For the POSIX documentation for this function, see:
5914 + http://www.opengroup.org/susv3xsh/strtok.html
5916 + Caveat: It modifies the original string.
5917 + Caveat: These functions cannot be used on constant strings.
5918 + Caveat: The identity of the delimiting character is lost.
5919 + Caveat: It doesn't work with multibyte strings unless all of the delimiter
5920 + characters are ASCII characters < 0x30.
5922 + See also strsep(). */
5923 +#if @GNULIB_STRTOK_R@
5924 +# if ! @HAVE_DECL_STRTOK_R@
5925 +extern char *strtok_r (char *restrict s, char const *restrict delim,
5926 + char **restrict save_ptr);
5928 +# if defined GNULIB_POSIXCHECK
5930 +# define strtok_r(s,d,p) \
5931 + (GL_LINK_WARNING ("strtok_r cannot work correctly on character strings " \
5932 + "in multibyte locales - " \
5933 + "use mbstok_r if you care about internationalization"), \
5934 + strtok_r (s, d, p))
5936 +#elif defined GNULIB_POSIXCHECK
5938 +# define strtok_r(s,d,p) \
5939 + (GL_LINK_WARNING ("strtok_r is unportable - " \
5940 + "use gnulib module strtok_r for portability"), \
5941 + strtok_r (s, d, p))
5945 +/* The following functions are not specified by POSIX. They are gnulib
5948 +#if @GNULIB_MBSLEN@
5949 +/* Return the number of multibyte characters in the character string STRING.
5950 + This considers multibyte characters, unlike strlen, which counts bytes. */
5951 +extern size_t mbslen (const char *string);
5954 +#if @GNULIB_MBSNLEN@
5955 +/* Return the number of multibyte characters in the character string starting
5956 + at STRING and ending at STRING + LEN. */
5957 +extern size_t mbsnlen (const char *string, size_t len);
5960 +#if @GNULIB_MBSCHR@
5961 +/* Locate the first single-byte character C in the character string STRING,
5962 + and return a pointer to it. Return NULL if C is not found in STRING.
5963 + Unlike strchr(), this function works correctly in multibyte locales with
5964 + encodings such as GB18030. */
5965 +# define mbschr rpl_mbschr /* avoid collision with HP-UX function */
5966 +extern char * mbschr (const char *string, int c);
5969 +#if @GNULIB_MBSRCHR@
5970 +/* Locate the last single-byte character C in the character string STRING,
5971 + and return a pointer to it. Return NULL if C is not found in STRING.
5972 + Unlike strrchr(), this function works correctly in multibyte locales with
5973 + encodings such as GB18030. */
5974 +# define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */
5975 +extern char * mbsrchr (const char *string, int c);
5978 +#if @GNULIB_MBSSTR@
5979 +/* Find the first occurrence of the character string NEEDLE in the character
5980 + string HAYSTACK. Return NULL if NEEDLE is not found in HAYSTACK.
5981 + Unlike strstr(), this function works correctly in multibyte locales with
5982 + encodings different from UTF-8. */
5983 +extern char * mbsstr (const char *haystack, const char *needle);
5986 +#if @GNULIB_MBSCASECMP@
5987 +/* Compare the character strings S1 and S2, ignoring case, returning less than,
5988 + equal to or greater than zero if S1 is lexicographically less than, equal to
5989 + or greater than S2.
5990 + Note: This function may, in multibyte locales, return 0 for strings of
5991 + different lengths!
5992 + Unlike strcasecmp(), this function works correctly in multibyte locales. */
5993 +extern int mbscasecmp (const char *s1, const char *s2);
5996 +#if @GNULIB_MBSNCASECMP@
5997 +/* Compare the initial segment of the character string S1 consisting of at most
5998 + N characters with the initial segment of the character string S2 consisting
5999 + of at most N characters, ignoring case, returning less than, equal to or
6000 + greater than zero if the initial segment of S1 is lexicographically less
6001 + than, equal to or greater than the initial segment of S2.
6002 + Note: This function may, in multibyte locales, return 0 for initial segments
6003 + of different lengths!
6004 + Unlike strncasecmp(), this function works correctly in multibyte locales.
6005 + But beware that N is not a byte count but a character count! */
6006 +extern int mbsncasecmp (const char *s1, const char *s2, size_t n);
6009 +#if @GNULIB_MBSPCASECMP@
6010 +/* Compare the initial segment of the character string STRING consisting of
6011 + at most mbslen (PREFIX) characters with the character string PREFIX,
6012 + ignoring case, returning less than, equal to or greater than zero if this
6013 + initial segment is lexicographically less than, equal to or greater than
6015 + Note: This function may, in multibyte locales, return 0 if STRING is of
6016 + smaller length than PREFIX!
6017 + Unlike strncasecmp(), this function works correctly in multibyte
6019 +extern char * mbspcasecmp (const char *string, const char *prefix);
6022 +#if @GNULIB_MBSCASESTR@
6023 +/* Find the first occurrence of the character string NEEDLE in the character
6024 + string HAYSTACK, using case-insensitive comparison.
6025 + Note: This function may, in multibyte locales, return success even if
6026 + strlen (haystack) < strlen (needle) !
6027 + Unlike strcasestr(), this function works correctly in multibyte locales. */
6028 +extern char * mbscasestr (const char *haystack, const char *needle);
6031 +#if @GNULIB_MBSCSPN@
6032 +/* Find the first occurrence in the character string STRING of any character
6033 + in the character string ACCEPT. Return the number of bytes from the
6034 + beginning of the string to this occurrence, or to the end of the string
6036 + Unlike strcspn(), this function works correctly in multibyte locales. */
6037 +extern size_t mbscspn (const char *string, const char *accept);
6040 +#if @GNULIB_MBSPBRK@
6041 +/* Find the first occurrence in the character string STRING of any character
6042 + in the character string ACCEPT. Return the pointer to it, or NULL if none
6044 + Unlike strpbrk(), this function works correctly in multibyte locales. */
6045 +# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
6046 +extern char * mbspbrk (const char *string, const char *accept);
6049 +#if @GNULIB_MBSSPN@
6050 +/* Find the first occurrence in the character string STRING of any character
6051 + not in the character string REJECT. Return the number of bytes from the
6052 + beginning of the string to this occurrence, or to the end of the string
6054 + Unlike strspn(), this function works correctly in multibyte locales. */
6055 +extern size_t mbsspn (const char *string, const char *reject);
6058 +#if @GNULIB_MBSSEP@
6059 +/* Search the next delimiter (multibyte character listed in the character
6060 + string DELIM) starting at the character string *STRINGP.
6061 + If one is found, overwrite it with a NUL, and advance *STRINGP to point
6062 + to the next multibyte character after it. Otherwise, set *STRINGP to NULL.
6063 + If *STRINGP was already NULL, nothing happens.
6064 + Return the old value of *STRINGP.
6066 + This is a variant of mbstok_r() that supports empty fields.
6068 + Caveat: It modifies the original string.
6069 + Caveat: These functions cannot be used on constant strings.
6070 + Caveat: The identity of the delimiting character is lost.
6072 + See also mbstok_r(). */
6073 +extern char * mbssep (char **stringp, const char *delim);
6076 +#if @GNULIB_MBSTOK_R@
6077 +/* Parse the character string STRING into tokens separated by characters in
6078 + the character string DELIM.
6079 + If STRING is NULL, the saved pointer in SAVE_PTR is used as
6080 + the next starting point. For example:
6081 + char s[] = "-abc-=-def";
6083 + x = mbstok_r(s, "-", &sp); // x = "abc", sp = "=-def"
6084 + x = mbstok_r(NULL, "-=", &sp); // x = "def", sp = NULL
6085 + x = mbstok_r(NULL, "=", &sp); // x = NULL
6086 + // s = "abc\0-def\0"
6088 + Caveat: It modifies the original string.
6089 + Caveat: These functions cannot be used on constant strings.
6090 + Caveat: The identity of the delimiting character is lost.
6092 + See also mbssep(). */
6093 +extern char * mbstok_r (char *string, const char *delim, char **save_ptr);
6096 +/* Map any int, typically from errno, into an error message. */
6097 +#if @GNULIB_STRERROR@
6098 +# if @REPLACE_STRERROR@
6100 +# define strerror rpl_strerror
6101 +extern char *strerror (int);
6103 +#elif defined GNULIB_POSIXCHECK
6105 +# define strerror(e) \
6106 + (GL_LINK_WARNING ("strerror is unportable - " \
6107 + "use gnulib module strerror to guarantee non-NULL result"), \
6111 +#if @GNULIB_STRSIGNAL@
6112 +# if @REPLACE_STRSIGNAL@
6113 +# define strsignal rpl_strsignal
6115 +# if ! @HAVE_DECL_STRSIGNAL@ || @REPLACE_STRSIGNAL@
6116 +extern char *strsignal (int __sig);
6118 +#elif defined GNULIB_POSIXCHECK
6120 +# define strsignal(a) \
6121 + (GL_LINK_WARNING ("strsignal is unportable - " \
6122 + "use gnulib module strsignal for portability"), \
6126 +#if @GNULIB_STRVERSCMP@
6127 +# if !@HAVE_STRVERSCMP@
6128 +extern int strverscmp (const char *, const char *);
6130 +#elif defined GNULIB_POSIXCHECK
6132 +# define strverscmp(a, b) \
6133 + (GL_LINK_WARNING ("strverscmp is unportable - " \
6134 + "use gnulib module strverscmp for portability"), \
6135 + strverscmp (a, b))
6143 +#endif /* _GL_STRING_H */
6144 +#endif /* _GL_STRING_H */
6145 diff -urN popt-for-windows/lib/sys_stat.in.h popt-for-windows-gnulib/lib/sys_stat.in.h
6146 --- popt-for-windows/lib/sys_stat.in.h 1970-01-01 01:00:00.000000000 +0100
6147 +++ popt-for-windows-gnulib/lib/sys_stat.in.h 2008-10-25 15:17:05.000000000 +0100
6149 +/* Provide a more complete sys/stat header file.
6150 + Copyright (C) 2005-2008 Free Software Foundation, Inc.
6152 + This program is free software; you can redistribute it and/or modify
6153 + it under the terms of the GNU General Public License as published by
6154 + the Free Software Foundation; either version 3, or (at your option)
6155 + any later version.
6157 + This program is distributed in the hope that it will be useful,
6158 + but WITHOUT ANY WARRANTY; without even the implied warranty of
6159 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6160 + GNU General Public License for more details.
6162 + You should have received a copy of the GNU General Public License
6163 + along with this program; if not, write to the Free Software Foundation,
6164 + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
6166 +/* Written by Eric Blake, Paul Eggert, and Jim Meyering. */
6168 +/* This file is supposed to be used on platforms where <sys/stat.h> is
6169 + incomplete. It is intended to provide definitions and prototypes
6170 + needed by an application. Start with what the system provides. */
6173 +@PRAGMA_SYSTEM_HEADER@
6176 +#if defined __need_system_sys_stat_h
6177 +/* Special invocation convention. */
6179 +#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
6182 +/* Normal invocation convention. */
6184 +#ifndef _GL_SYS_STAT_H
6186 +/* The include_next requires a split double-inclusion guard. */
6187 +#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
6189 +#ifndef _GL_SYS_STAT_H
6190 +#define _GL_SYS_STAT_H
6192 +/* The definition of GL_LINK_WARNING is copied here. */
6194 +/* Before doing "#define mkdir rpl_mkdir" below, we need to include all
6195 + headers that may declare mkdir(). */
6196 +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
6201 +# define S_IFMT 0170000
6204 +#if STAT_MACROS_BROKEN
6220 +# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
6222 +# define S_ISBLK(m) 0
6228 +# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
6230 +# define S_ISCHR(m) 0
6236 +# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
6238 +# define S_ISDIR(m) 0
6242 +#ifndef S_ISDOOR /* Solaris 2.5 and up */
6243 +# define S_ISDOOR(m) 0
6248 +# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
6250 +# define S_ISFIFO(m) 0
6256 +# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
6258 +# define S_ISLNK(m) 0
6262 +#ifndef S_ISMPB /* V7 */
6264 +# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
6265 +# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
6267 +# define S_ISMPB(m) 0
6268 +# define S_ISMPC(m) 0
6272 +#ifndef S_ISNAM /* Xenix */
6274 +# define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
6276 +# define S_ISNAM(m) 0
6280 +#ifndef S_ISNWK /* HP/UX */
6282 +# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
6284 +# define S_ISNWK(m) 0
6288 +#ifndef S_ISPORT /* Solaris 10 and up */
6289 +# define S_ISPORT(m) 0
6294 +# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
6296 +# define S_ISREG(m) 0
6302 +# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
6304 +# define S_ISSOCK(m) 0
6310 +# define S_TYPEISMQ(p) 0
6313 +#ifndef S_TYPEISTMO
6314 +# define S_TYPEISTMO(p) 0
6318 +#ifndef S_TYPEISSEM
6320 +# define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
6322 +# define S_TYPEISSEM(p) 0
6326 +#ifndef S_TYPEISSHM
6328 +# define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
6330 +# define S_TYPEISSHM(p) 0
6334 +/* high performance ("contiguous data") */
6336 +# define S_ISCTG(p) 0
6339 +/* Cray DMF (data migration facility): off line, with data */
6341 +# define S_ISOFD(p) 0
6344 +/* Cray DMF (data migration facility): off line, with no data */
6346 +# define S_ISOFL(p) 0
6349 +/* 4.4BSD whiteout */
6351 +# define S_ISWHT(m) 0
6354 +/* If any of the following are undefined,
6355 + define them to their de facto standard values. */
6357 +# define S_ISUID 04000
6360 +# define S_ISGID 02000
6363 +/* S_ISVTX is a common extension to POSIX. */
6365 +# define S_ISVTX 01000
6368 +#if !S_IRUSR && S_IREAD
6369 +# define S_IRUSR S_IREAD
6372 +# define S_IRUSR 00400
6375 +# define S_IRGRP (S_IRUSR >> 3)
6378 +# define S_IROTH (S_IRUSR >> 6)
6381 +#if !S_IWUSR && S_IWRITE
6382 +# define S_IWUSR S_IWRITE
6385 +# define S_IWUSR 00200
6388 +# define S_IWGRP (S_IWUSR >> 3)
6391 +# define S_IWOTH (S_IWUSR >> 6)
6394 +#if !S_IXUSR && S_IEXEC
6395 +# define S_IXUSR S_IEXEC
6398 +# define S_IXUSR 00100
6401 +# define S_IXGRP (S_IXUSR >> 3)
6404 +# define S_IXOTH (S_IXUSR >> 6)
6408 +# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
6411 +# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
6414 +# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
6417 +/* S_IXUGO is a common extension to POSIX. */
6419 +# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
6423 +# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
6426 +/* mingw does not support symlinks, therefore it does not have lstat. But
6427 + without links, stat does just fine. */
6429 +# define lstat stat
6431 +#if @GNULIB_LSTAT@ && @REPLACE_LSTAT@
6433 +# define lstat rpl_lstat
6434 +extern int rpl_lstat (const char *name, struct stat *buf);
6438 +#if @REPLACE_MKDIR@
6440 +# define mkdir rpl_mkdir
6441 +extern int mkdir (char const *name, mode_t mode);
6443 +/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
6444 + Additionally, it declares _mkdir (and depending on compile flags, an
6445 + alias mkdir), only in the nonstandard <io.h>, which is included above. */
6446 +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
6449 +rpl_mkdir (char const *name, mode_t mode)
6451 + return _mkdir (name);
6454 +# define mkdir rpl_mkdir
6459 +/* Declare BSD extensions. */
6461 +#if @GNULIB_LCHMOD@
6462 +/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME
6463 + denotes a symbolic link. */
6464 +# if !@HAVE_LCHMOD@
6465 +/* The lchmod replacement follows symbolic links. Callers should take
6466 + this into account; lchmod should be applied only to arguments that
6467 + are known to not be symbolic links. On hosts that lack lchmod,
6468 + this can lead to race conditions between the check and the
6469 + invocation of lchmod, but we know of no workarounds that are
6470 + reliable in general. You might try requesting support for lchmod
6471 + from your operating system supplier. */
6472 +# define lchmod chmod
6474 +# if 0 /* assume already declared */
6475 +extern int lchmod (const char *filename, mode_t mode);
6477 +#elif defined GNULIB_POSIXCHECK
6479 +# define lchmod(f,m) \
6480 + (GL_LINK_WARNING ("lchmod is unportable - " \
6481 + "use gnulib module lchmod for portability"), \
6485 +#endif /* _GL_SYS_STAT_H */
6486 +#endif /* _GL_SYS_STAT_H */
6488 diff -urN popt-for-windows/lib/unistd.in.h popt-for-windows-gnulib/lib/unistd.in.h
6489 --- popt-for-windows/lib/unistd.in.h 1970-01-01 01:00:00.000000000 +0100
6490 +++ popt-for-windows-gnulib/lib/unistd.in.h 2008-10-25 15:17:05.000000000 +0100
6492 +/* Substitute for and wrapper around <unistd.h>.
6493 + Copyright (C) 2003-2008 Free Software Foundation, Inc.
6495 + This program is free software; you can redistribute it and/or modify
6496 + it under the terms of the GNU General Public License as published by
6497 + the Free Software Foundation; either version 3, or (at your option)
6498 + any later version.
6500 + This program is distributed in the hope that it will be useful,
6501 + but WITHOUT ANY WARRANTY; without even the implied warranty of
6502 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6503 + GNU General Public License for more details.
6505 + You should have received a copy of the GNU General Public License
6506 + along with this program; if not, write to the Free Software Foundation,
6507 + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
6509 +#ifndef _GL_UNISTD_H
6512 +@PRAGMA_SYSTEM_HEADER@
6515 +/* The include_next requires a split double-inclusion guard. */
6516 +#if @HAVE_UNISTD_H@
6517 +# @INCLUDE_NEXT@ @NEXT_UNISTD_H@
6520 +#ifndef _GL_UNISTD_H
6521 +#define _GL_UNISTD_H
6523 +/* mingw doesn't define the SEEK_* macros in <unistd.h>. */
6524 +#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET)
6525 +# include <stdio.h>
6528 +/* mingw fails to declare _exit in <unistd.h>. */
6529 +#include <stdlib.h>
6531 +#if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
6533 +# include <sys/types.h>
6536 +/* The definition of GL_LINK_WARNING is copied here. */
6539 +/* Declare overridden functions. */
6547 +# if @REPLACE_CHOWN@
6548 +# ifndef REPLACE_CHOWN
6549 +# define REPLACE_CHOWN 1
6552 +/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
6553 + to GID (if GID is not -1). Follow symbolic links.
6554 + Return 0 if successful, otherwise -1 and errno set.
6555 + See the POSIX:2001 specification
6556 + <http://www.opengroup.org/susv3xsh/chown.html>. */
6557 +# define chown rpl_chown
6558 +extern int chown (const char *file, uid_t uid, gid_t gid);
6561 +#elif defined GNULIB_POSIXCHECK
6563 +# define chown(f,u,g) \
6564 + (GL_LINK_WARNING ("chown fails to follow symlinks on some systems and " \
6565 + "doesn't treat a uid or gid of -1 on some systems - " \
6566 + "use gnulib module chown for portability"), \
6572 +# if @REPLACE_CLOSE@
6573 +/* Automatically included by modules that need a replacement for close. */
6575 +# define close rpl_close
6576 +extern int close (int);
6578 +#elif @UNISTD_H_HAVE_WINSOCK2_H@
6580 +# define close close_used_without_requesting_gnulib_module_close
6581 +#elif defined GNULIB_POSIXCHECK
6583 +# define close(f) \
6584 + (GL_LINK_WARNING ("close does not portably work on sockets - " \
6585 + "use gnulib module close for portability"), \
6592 +/* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
6593 + NEWFD = OLDFD, otherwise close NEWFD first if it is open.
6594 + Return 0 if successful, otherwise -1 and errno set.
6595 + See the POSIX:2001 specification
6596 + <http://www.opengroup.org/susv3xsh/dup2.html>. */
6597 +extern int dup2 (int oldfd, int newfd);
6599 +#elif defined GNULIB_POSIXCHECK
6601 +# define dup2(o,n) \
6602 + (GL_LINK_WARNING ("dup2 is unportable - " \
6603 + "use gnulib module dup2 for portability"), \
6608 +#if @GNULIB_ENVIRON@
6609 +# if !@HAVE_DECL_ENVIRON@
6610 +/* Set of environment variables and values. An array of strings of the form
6611 + "VARIABLE=VALUE", terminated with a NULL. */
6612 +# if defined __APPLE__ && defined __MACH__
6613 +# include <crt_externs.h>
6614 +# define environ (*_NSGetEnviron ())
6616 +extern char **environ;
6619 +#elif defined GNULIB_POSIXCHECK
6622 + (GL_LINK_WARNING ("environ is unportable - " \
6623 + "use gnulib module environ for portability"), \
6628 +#if @GNULIB_EUIDACCESS@
6629 +# if !@HAVE_EUIDACCESS@
6630 +/* Like access(), except that is uses the effective user id and group id of
6631 + the current process. */
6632 +extern int euidaccess (const char *filename, int mode);
6634 +#elif defined GNULIB_POSIXCHECK
6636 +# define euidaccess(f,m) \
6637 + (GL_LINK_WARNING ("euidaccess is unportable - " \
6638 + "use gnulib module euidaccess for portability"), \
6639 + euidaccess (f, m))
6643 +#if @GNULIB_FCHDIR@
6644 +# if @REPLACE_FCHDIR@
6646 +/* Change the process' current working directory to the directory on which
6647 + the given file descriptor is open.
6648 + Return 0 if successful, otherwise -1 and errno set.
6649 + See the POSIX:2001 specification
6650 + <http://www.opengroup.org/susv3xsh/fchdir.html>. */
6651 +extern int fchdir (int /*fd*/);
6653 +# define dup rpl_dup
6654 +extern int dup (int);
6655 +# define dup2 rpl_dup2
6656 +extern int dup2 (int, int);
6659 +#elif defined GNULIB_POSIXCHECK
6661 +# define fchdir(f) \
6662 + (GL_LINK_WARNING ("fchdir is unportable - " \
6663 + "use gnulib module fchdir for portability"), \
6669 +/* Synchronize changes to a file.
6670 + Return 0 if successful, otherwise -1 and errno set.
6671 + See POSIX:2001 specification
6672 + <http://www.opengroup.org/susv3xsh/fsync.html>. */
6674 +extern int fsync (int fd);
6676 +#elif defined GNULIB_POSIXCHECK
6678 +# define fsync(fd) \
6679 + (GL_LINK_WARNING ("fsync is unportable - " \
6680 + "use gnulib module fsync for portability"), \
6685 +#if @GNULIB_FTRUNCATE@
6686 +# if !@HAVE_FTRUNCATE@
6687 +/* Change the size of the file to which FD is opened to become equal to LENGTH.
6688 + Return 0 if successful, otherwise -1 and errno set.
6689 + See the POSIX:2001 specification
6690 + <http://www.opengroup.org/susv3xsh/ftruncate.html>. */
6691 +extern int ftruncate (int fd, off_t length);
6693 +#elif defined GNULIB_POSIXCHECK
6695 +# define ftruncate(f,l) \
6696 + (GL_LINK_WARNING ("ftruncate is unportable - " \
6697 + "use gnulib module ftruncate for portability"), \
6702 +#if @GNULIB_GETCWD@
6703 +/* Include the headers that might declare getcwd so that they will not
6704 + cause confusion if included after this file. */
6705 +# include <stdlib.h>
6706 +# if @REPLACE_GETCWD@
6707 +/* Get the name of the current working directory, and put it in SIZE bytes
6709 + Return BUF if successful, or NULL if the directory couldn't be determined
6710 + or SIZE was too small.
6711 + See the POSIX:2001 specification
6712 + <http://www.opengroup.org/susv3xsh/getcwd.html>.
6713 + Additionally, the gnulib module 'getcwd' guarantees the following GNU
6714 + extension: If BUF is NULL, an array is allocated with 'malloc'; the array
6715 + is SIZE bytes long, unless SIZE == 0, in which case it is as big as
6717 +# define getcwd rpl_getcwd
6718 +extern char * getcwd (char *buf, size_t size);
6720 +#elif defined GNULIB_POSIXCHECK
6722 +# define getcwd(b,s) \
6723 + (GL_LINK_WARNING ("getcwd is unportable - " \
6724 + "use gnulib module getcwd for portability"), \
6729 +#if @GNULIB_GETDOMAINNAME@
6730 +/* Return the NIS domain name of the machine.
6731 + WARNING! The NIS domain name is unrelated to the fully qualified host name
6732 + of the machine. It is also unrelated to email addresses.
6733 + WARNING! The NIS domain name is usually the empty string or "(none)" when
6736 + Put up to LEN bytes of the NIS domain name into NAME.
6737 + Null terminate it if the name is shorter than LEN.
6738 + If the NIS domain name is longer than LEN, set errno = EINVAL and return -1.
6739 + Return 0 if successful, otherwise set errno and return -1. */
6740 +# if !@HAVE_GETDOMAINNAME@
6741 +extern int getdomainname(char *name, size_t len);
6743 +#elif defined GNULIB_POSIXCHECK
6744 +# undef getdomainname
6745 +# define getdomainname(n,l) \
6746 + (GL_LINK_WARNING ("getdomainname is unportable - " \
6747 + "use gnulib module getdomainname for portability"), \
6748 + getdomainname (n, l))
6752 +#if @GNULIB_GETDTABLESIZE@
6753 +# if !@HAVE_GETDTABLESIZE@
6754 +/* Return the maximum number of file descriptors in the current process. */
6755 +extern int getdtablesize (void);
6757 +#elif defined GNULIB_POSIXCHECK
6758 +# undef getdtablesize
6759 +# define getdtablesize() \
6760 + (GL_LINK_WARNING ("getdtablesize is unportable - " \
6761 + "use gnulib module getdtablesize for portability"), \
6766 +#if @GNULIB_GETHOSTNAME@
6767 +/* Return the standard host name of the machine.
6768 + WARNING! The host name may or may not be fully qualified.
6770 + Put up to LEN bytes of the host name into NAME.
6771 + Null terminate it if the name is shorter than LEN.
6772 + If the host name is longer than LEN, set errno = EINVAL and return -1.
6773 + Return 0 if successful, otherwise set errno and return -1. */
6774 +# if !@HAVE_GETHOSTNAME@
6775 +extern int gethostname(char *name, size_t len);
6777 +#elif defined GNULIB_POSIXCHECK
6778 +# undef gethostname
6779 +# define gethostname(n,l) \
6780 + (GL_LINK_WARNING ("gethostname is unportable - " \
6781 + "use gnulib module gethostname for portability"), \
6782 + gethostname (n, l))
6786 +#if @GNULIB_GETLOGIN_R@
6787 +/* Copies the user's login name to NAME.
6788 + The array pointed to by NAME has room for SIZE bytes.
6790 + Returns 0 if successful. Upon error, an error number is returned, or -1 in
6791 + the case that the login name cannot be found but no specific error is
6792 + provided (this case is hopefully rare but is left open by the POSIX spec).
6794 + See <http://www.opengroup.org/susv3xsh/getlogin.html>.
6796 +# if !@HAVE_DECL_GETLOGIN_R@
6797 +# include <stddef.h>
6798 +extern int getlogin_r (char *name, size_t size);
6800 +#elif defined GNULIB_POSIXCHECK
6802 +# define getlogin_r(n,s) \
6803 + (GL_LINK_WARNING ("getlogin_r is unportable - " \
6804 + "use gnulib module getlogin_r for portability"), \
6805 + getlogin_r (n, s))
6809 +#if @GNULIB_GETPAGESIZE@
6810 +# if @REPLACE_GETPAGESIZE@
6811 +# define getpagesize rpl_getpagesize
6812 +extern int getpagesize (void);
6813 +# elif !@HAVE_GETPAGESIZE@
6814 +/* This is for POSIX systems. */
6815 +# if !defined getpagesize && defined _SC_PAGESIZE
6816 +# if ! (defined __VMS && __VMS_VER < 70000000)
6817 +# define getpagesize() sysconf (_SC_PAGESIZE)
6820 +/* This is for older VMS. */
6821 +# if !defined getpagesize && defined __VMS
6823 +# define getpagesize() 8192
6825 +# define getpagesize() 512
6828 +/* This is for BeOS. */
6829 +# if !defined getpagesize && @HAVE_OS_H@
6831 +# if defined B_PAGE_SIZE
6832 +# define getpagesize() B_PAGE_SIZE
6835 +/* This is for AmigaOS4.0. */
6836 +# if !defined getpagesize && defined __amigaos4__
6837 +# define getpagesize() 2048
6839 +/* This is for older Unix systems. */
6840 +# if !defined getpagesize && @HAVE_SYS_PARAM_H@
6841 +# include <sys/param.h>
6842 +# ifdef EXEC_PAGESIZE
6843 +# define getpagesize() EXEC_PAGESIZE
6849 +# define getpagesize() (NBPG * CLSIZE)
6852 +# define getpagesize() NBPC
6858 +#elif defined GNULIB_POSIXCHECK
6859 +# undef getpagesize
6860 +# define getpagesize() \
6861 + (GL_LINK_WARNING ("getpagesize is unportable - " \
6862 + "use gnulib module getpagesize for portability"), \
6867 +#if @GNULIB_GETUSERSHELL@
6868 +# if !@HAVE_GETUSERSHELL@
6869 +/* Return the next valid login shell on the system, or NULL when the end of
6870 + the list has been reached. */
6871 +extern char *getusershell (void);
6872 +/* Rewind to pointer that is advanced at each getusershell() call. */
6873 +extern void setusershell (void);
6874 +/* Free the pointer that is advanced at each getusershell() call and
6875 + associated resources. */
6876 +extern void endusershell (void);
6878 +#elif defined GNULIB_POSIXCHECK
6879 +# undef getusershell
6880 +# define getusershell() \
6881 + (GL_LINK_WARNING ("getusershell is unportable - " \
6882 + "use gnulib module getusershell for portability"), \
6884 +# undef setusershell
6885 +# define setusershell() \
6886 + (GL_LINK_WARNING ("setusershell is unportable - " \
6887 + "use gnulib module getusershell for portability"), \
6889 +# undef endusershell
6890 +# define endusershell() \
6891 + (GL_LINK_WARNING ("endusershell is unportable - " \
6892 + "use gnulib module getusershell for portability"), \
6897 +#if @GNULIB_LCHOWN@
6898 +# if @REPLACE_LCHOWN@
6899 +/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
6900 + to GID (if GID is not -1). Do not follow symbolic links.
6901 + Return 0 if successful, otherwise -1 and errno set.
6902 + See the POSIX:2001 specification
6903 + <http://www.opengroup.org/susv3xsh/lchown.html>. */
6904 +# define lchown rpl_lchown
6905 +extern int lchown (char const *file, uid_t owner, gid_t group);
6907 +#elif defined GNULIB_POSIXCHECK
6909 +# define lchown(f,u,g) \
6910 + (GL_LINK_WARNING ("lchown is unportable to pre-POSIX.1-2001 " \
6911 + "systems - use gnulib module lchown for portability"), \
6917 +# if @REPLACE_LSEEK@
6918 +/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
6919 + Return the new offset if successful, otherwise -1 and errno set.
6920 + See the POSIX:2001 specification
6921 + <http://www.opengroup.org/susv3xsh/lseek.html>. */
6922 +# define lseek rpl_lseek
6923 + extern off_t lseek (int fd, off_t offset, int whence);
6925 +#elif defined GNULIB_POSIXCHECK
6927 +# define lseek(f,o,w) \
6928 + (GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \
6929 + "systems - use gnulib module lseek for portability"), \
6934 +#if @GNULIB_READLINK@
6935 +/* Read the contents of the symbolic link FILE and place the first BUFSIZE
6936 + bytes of it into BUF. Return the number of bytes placed into BUF if
6937 + successful, otherwise -1 and errno set.
6938 + See the POSIX:2001 specification
6939 + <http://www.opengroup.org/susv3xsh/readlink.html>. */
6940 +# if !@HAVE_READLINK@
6941 +# include <stddef.h>
6942 +extern int readlink (const char *file, char *buf, size_t bufsize);
6944 +#elif defined GNULIB_POSIXCHECK
6946 +# define readlink(f,b,s) \
6947 + (GL_LINK_WARNING ("readlink is unportable - " \
6948 + "use gnulib module readlink for portability"), \
6949 + readlink (f, b, s))
6954 +/* Pause the execution of the current thread for N seconds.
6955 + Returns the number of seconds left to sleep.
6956 + See the POSIX:2001 specification
6957 + <http://www.opengroup.org/susv3xsh/sleep.html>. */
6959 +extern unsigned int sleep (unsigned int n);
6961 +#elif defined GNULIB_POSIXCHECK
6963 +# define sleep(n) \
6964 + (GL_LINK_WARNING ("sleep is unportable - " \
6965 + "use gnulib module sleep for portability"), \
6970 +#if @GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@
6971 +/* Write up to COUNT bytes starting at BUF to file descriptor FD.
6972 + See the POSIX:2001 specification
6973 + <http://www.opengroup.org/susv3xsh/write.html>. */
6975 +# define write rpl_write
6976 +extern ssize_t write (int fd, const void *buf, size_t count);
6980 +#ifdef FCHDIR_REPLACEMENT
6981 +/* gnulib internal function. */
6982 +extern void _gl_unregister_fd (int fd);
6991 +#endif /* _GL_UNISTD_H */
6992 +#endif /* _GL_UNISTD_H */
6993 diff -urN popt-for-windows/lib/wchar.in.h popt-for-windows-gnulib/lib/wchar.in.h
6994 --- popt-for-windows/lib/wchar.in.h 1970-01-01 01:00:00.000000000 +0100
6995 +++ popt-for-windows-gnulib/lib/wchar.in.h 2008-10-25 15:17:05.000000000 +0100
6997 +/* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
6999 + Copyright (C) 2007-2008 Free Software Foundation, Inc.
7001 + This program is free software; you can redistribute it and/or modify
7002 + it under the terms of the GNU General Public License as published by
7003 + the Free Software Foundation; either version 3, or (at your option)
7004 + any later version.
7006 + This program is distributed in the hope that it will be useful,
7007 + but WITHOUT ANY WARRANTY; without even the implied warranty of
7008 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7009 + GNU General Public License for more details.
7011 + You should have received a copy of the GNU General Public License
7012 + along with this program; if not, write to the Free Software Foundation,
7013 + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
7015 +/* Written by Eric Blake. */
7018 + * ISO C 99 <wchar.h> for platforms that have issues.
7019 + * <http://www.opengroup.org/susv3xbd/wchar.h.html>
7021 + * For now, this just ensures proper prerequisite inclusion order and
7022 + * the declaration of wcwidth().
7026 +@PRAGMA_SYSTEM_HEADER@
7029 +#ifdef __need_mbstate_t
7030 +/* Special invocation convention inside uClibc header files. */
7032 +#@INCLUDE_NEXT@ @NEXT_WCHAR_H@
7035 +/* Normal invocation convention. */
7037 +#ifndef _GL_WCHAR_H
7039 +/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
7041 + BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
7042 + included before <wchar.h>. */
7043 +#include <stddef.h>
7047 +/* Include the original <wchar.h> if it exists.
7048 + Some builds of uClibc lack it. */
7049 +/* The include_next requires a split double-inclusion guard. */
7051 +# @INCLUDE_NEXT@ @NEXT_WCHAR_H@
7054 +#ifndef _GL_WCHAR_H
7055 +#define _GL_WCHAR_H
7057 +/* The definition of GL_LINK_WARNING is copied here. */
7064 +/* Define wint_t. (Also done in wctype.in.h.) */
7065 +#if !@HAVE_WINT_T@ && !defined wint_t
7066 +# define wint_t int
7070 +/* Return the number of screen columns needed for WC. */
7071 +#if @GNULIB_WCWIDTH@
7072 +# if @REPLACE_WCWIDTH@
7074 +# define wcwidth rpl_wcwidth
7075 +extern int wcwidth (wchar_t);
7077 +# if !defined wcwidth && !@HAVE_DECL_WCWIDTH@
7078 +/* wcwidth exists but is not declared. */
7079 +extern int wcwidth (int /* actually wchar_t */);
7082 +#elif defined GNULIB_POSIXCHECK
7084 +# define wcwidth(w) \
7085 + (GL_LINK_WARNING ("wcwidth is unportable - " \
7086 + "use gnulib module wcwidth for portability"), \
7095 +#endif /* _GL_WCHAR_H */
7096 +#endif /* _GL_WCHAR_H */
7098 diff -urN popt-for-windows/lib/wctype.in.h popt-for-windows-gnulib/lib/wctype.in.h
7099 --- popt-for-windows/lib/wctype.in.h 1970-01-01 01:00:00.000000000 +0100
7100 +++ popt-for-windows-gnulib/lib/wctype.in.h 2008-10-25 15:17:05.000000000 +0100
7102 +/* A substitute for ISO C99 <wctype.h>, for platforms that lack it.
7104 + Copyright (C) 2006-2008 Free Software Foundation, Inc.
7106 + This program is free software; you can redistribute it and/or modify
7107 + it under the terms of the GNU General Public License as published by
7108 + the Free Software Foundation; either version 3, or (at your option)
7109 + any later version.
7111 + This program is distributed in the hope that it will be useful,
7112 + but WITHOUT ANY WARRANTY; without even the implied warranty of
7113 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7114 + GNU General Public License for more details.
7116 + You should have received a copy of the GNU General Public License
7117 + along with this program; if not, write to the Free Software Foundation,
7118 + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
7120 +/* Written by Bruno Haible and Paul Eggert. */
7123 + * ISO C 99 <wctype.h> for platforms that lack it.
7124 + * <http://www.opengroup.org/susv3xbd/wctype.h.html>
7126 + * iswctype, towctrans, towlower, towupper, wctrans, wctype,
7127 + * wctrans_t, and wctype_t are not yet implemented.
7130 +#ifndef _GL_WCTYPE_H
7133 +@PRAGMA_SYSTEM_HEADER@
7137 +/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.
7138 + Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
7140 + BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
7141 + included before <wchar.h>. */
7142 +# include <stddef.h>
7143 +# include <stdio.h>
7145 +# include <wchar.h>
7148 +/* Include the original <wctype.h> if it exists.
7149 + BeOS 5 has the functions but no <wctype.h>. */
7150 +/* The include_next requires a split double-inclusion guard. */
7151 +#if @HAVE_WCTYPE_H@
7152 +# @INCLUDE_NEXT@ @NEXT_WCTYPE_H@
7155 +#ifndef _GL_WCTYPE_H
7156 +#define _GL_WCTYPE_H
7158 +/* Define wint_t. (Also done in wchar.in.h.) */
7159 +#if !@HAVE_WINT_T@ && !defined wint_t
7160 +# define wint_t int
7163 +/* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
7164 + Linux libc5 has <wctype.h> and the functions but they are broken.
7165 + Assume all 12 functions are implemented the same way, or not at all. */
7166 +#if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@
7168 +/* IRIX 5.3 has macros but no functions, its isw* macros refer to an
7169 + undefined variable _ctmp_ and to <ctype.h> macros like _P, and they
7170 + refer to system functions like _iswctype that are not in the
7171 + standard C library. Rather than try to get ancient buggy
7172 + implementations like this to work, just disable them. */
7186 +/* Linux libc5 has <wctype.h> and the functions but they are broken. */
7187 +# if @REPLACE_ISWCNTRL@
7188 +# define iswalnum rpl_iswalnum
7189 +# define iswalpha rpl_iswalpha
7190 +# define iswblank rpl_iswblank
7191 +# define iswcntrl rpl_iswcntrl
7192 +# define iswdigit rpl_iswdigit
7193 +# define iswgraph rpl_iswgraph
7194 +# define iswlower rpl_iswlower
7195 +# define iswprint rpl_iswprint
7196 +# define iswpunct rpl_iswpunct
7197 +# define iswspace rpl_iswspace
7198 +# define iswupper rpl_iswupper
7199 +# define iswxdigit rpl_iswxdigit
7203 +iswalnum (wint_t wc)
7205 + return ((wc >= '0' && wc <= '9')
7206 + || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'));
7210 +iswalpha (wint_t wc)
7212 + return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
7216 +iswblank (wint_t wc)
7218 + return wc == ' ' || wc == '\t';
7222 +iswcntrl (wint_t wc)
7224 + return (wc & ~0x1f) == 0 || wc == 0x7f;
7228 +iswdigit (wint_t wc)
7230 + return wc >= '0' && wc <= '9';
7234 +iswgraph (wint_t wc)
7236 + return wc >= '!' && wc <= '~';
7240 +iswlower (wint_t wc)
7242 + return wc >= 'a' && wc <= 'z';
7246 +iswprint (wint_t wc)
7248 + return wc >= ' ' && wc <= '~';
7252 +iswpunct (wint_t wc)
7254 + return (wc >= '!' && wc <= '~'
7255 + && !((wc >= '0' && wc <= '9')
7256 + || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')));
7260 +iswspace (wint_t wc)
7262 + return (wc == ' ' || wc == '\t'
7263 + || wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r');
7267 +iswupper (wint_t wc)
7269 + return wc >= 'A' && wc <= 'Z';
7273 +iswxdigit (wint_t wc)
7275 + return ((wc >= '0' && wc <= '9')
7276 + || ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'));
7279 +# endif /* ! HAVE_ISWCNTRL */
7281 +#endif /* _GL_WCTYPE_H */
7282 +#endif /* _GL_WCTYPE_H */
7283 diff -urN popt-for-windows/link-warning.h popt-for-windows-gnulib/link-warning.h
7284 --- popt-for-windows/link-warning.h 1970-01-01 01:00:00.000000000 +0100
7285 +++ popt-for-windows-gnulib/link-warning.h 2008-10-25 15:17:05.000000000 +0100
7287 +/* GL_LINK_WARNING("literal string") arranges to emit the literal string as
7288 + a linker warning on most glibc systems.
7289 + We use a linker warning rather than a preprocessor warning, because
7290 + #warning cannot be used inside macros. */
7291 +#ifndef GL_LINK_WARNING
7292 + /* This works on platforms with GNU ld and ELF object format.
7293 + Testing __GLIBC__ is sufficient for asserting that GNU ld is in use.
7294 + Testing __ELF__ guarantees the ELF object format.
7295 + Testing __GNUC__ is necessary for the compound expression syntax. */
7296 +# if defined __GLIBC__ && defined __ELF__ && defined __GNUC__
7297 +# define GL_LINK_WARNING(message) \
7298 + GL_LINK_WARNING1 (__FILE__, __LINE__, message)
7299 +# define GL_LINK_WARNING1(file, line, message) \
7300 + GL_LINK_WARNING2 (file, line, message) /* macroexpand file and line */
7301 +# define GL_LINK_WARNING2(file, line, message) \
7302 + GL_LINK_WARNING3 (file ":" #line ": warning: " message)
7303 +# define GL_LINK_WARNING3(message) \
7304 + ({ static const char warning[sizeof (message)] \
7305 + __attribute__ ((__unused__, \
7306 + __section__ (".gnu.warning"), \
7307 + __aligned__ (1))) \
7312 +# define GL_LINK_WARNING(message) ((void) 0)
7315 diff -urN popt-for-windows/m4/alloca.m4 popt-for-windows-gnulib/m4/alloca.m4
7316 --- popt-for-windows/m4/alloca.m4 1970-01-01 01:00:00.000000000 +0100
7317 +++ popt-for-windows-gnulib/m4/alloca.m4 2008-10-25 15:17:05.000000000 +0100
7319 +# alloca.m4 serial 8
7320 +dnl Copyright (C) 2002-2004, 2006, 2007 Free Software Foundation, Inc.
7321 +dnl This file is free software; the Free Software Foundation
7322 +dnl gives unlimited permission to copy and/or distribute it,
7323 +dnl with or without modifications, as long as this notice is preserved.
7325 +AC_DEFUN([gl_FUNC_ALLOCA],
7327 + dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57.
7328 + AC_REQUIRE([AC_PROG_CPP])
7329 + AC_REQUIRE([AC_PROG_EGREP])
7331 + AC_REQUIRE([AC_FUNC_ALLOCA])
7332 + if test $ac_cv_func_alloca_works = no; then
7336 + # Define an additional variable used in the Makefile substitution.
7337 + if test $ac_cv_working_alloca_h = yes; then
7338 + AC_CACHE_CHECK([for alloca as a compiler built-in], [gl_cv_rpl_alloca], [
7339 + AC_EGREP_CPP([Need own alloca], [
7340 +#if defined __GNUC__ || defined _AIX || defined _MSC_VER
7343 + ], [gl_cv_rpl_alloca=yes], [gl_cv_rpl_alloca=no])
7345 + if test $gl_cv_rpl_alloca = yes; then
7346 + dnl OK, alloca can be implemented through a compiler built-in.
7347 + AC_DEFINE([HAVE_ALLOCA], 1,
7348 + [Define to 1 if you have 'alloca' after including <alloca.h>,
7349 + a header that may be supplied by this distribution.])
7352 + dnl alloca exists as a library function, i.e. it is slow and probably
7353 + dnl a memory leak. Don't define HAVE_ALLOCA in this case.
7359 + AC_SUBST([ALLOCA_H])
7362 +# Prerequisites of lib/alloca.c.
7363 +# STACK_DIRECTION is already handled by AC_FUNC_ALLOCA.
7364 +AC_DEFUN([gl_PREREQ_ALLOCA], [:])
7365 diff -urN popt-for-windows/m4/.cvsignore popt-for-windows-gnulib/m4/.cvsignore
7366 --- popt-for-windows/m4/.cvsignore 2008-02-11 17:06:13.000000000 +0000
7367 +++ popt-for-windows-gnulib/m4/.cvsignore 2008-10-25 15:17:06.000000000 +0100
7395 diff -urN popt-for-windows/m4/.cvsignore~ popt-for-windows-gnulib/m4/.cvsignore~
7396 --- popt-for-windows/m4/.cvsignore~ 1970-01-01 01:00:00.000000000 +0100
7397 +++ popt-for-windows-gnulib/m4/.cvsignore~ 2008-02-11 17:06:13.000000000 +0000
7400 diff -urN popt-for-windows/m4/dirent_h.m4 popt-for-windows-gnulib/m4/dirent_h.m4
7401 --- popt-for-windows/m4/dirent_h.m4 1970-01-01 01:00:00.000000000 +0100
7402 +++ popt-for-windows-gnulib/m4/dirent_h.m4 2008-10-25 15:17:05.000000000 +0100
7404 +# dirent_h.m4 serial 2
7405 +dnl Copyright (C) 2008 Free Software Foundation, Inc.
7406 +dnl This file is free software; the Free Software Foundation
7407 +dnl gives unlimited permission to copy and/or distribute it,
7408 +dnl with or without modifications, as long as this notice is preserved.
7410 +dnl Written by Bruno Haible.
7412 +AC_DEFUN([gl_DIRENT_H],
7414 + dnl Use AC_REQUIRE here, so that the default behavior below is expanded
7415 + dnl once only, before all statements that occur in other macros.
7416 + AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
7418 + gl_CHECK_NEXT_HEADERS([dirent.h])
7421 +dnl Unconditionally enables the replacement of <dirent.h>.
7422 +AC_DEFUN([gl_REPLACE_DIRENT_H],
7424 + AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
7425 + DIRENT_H='dirent.h'
7428 +AC_DEFUN([gl_DIRENT_MODULE_INDICATOR],
7430 + dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
7431 + AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
7432 + GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
7435 +AC_DEFUN([gl_DIRENT_H_DEFAULTS],
7437 + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR
7438 + GNULIB_DIRFD=0; AC_SUBST([GNULIB_DIRFD])
7439 + dnl Assume proper GNU behavior unless another module says otherwise.
7440 + HAVE_DECL_DIRFD=1; AC_SUBST([HAVE_DECL_DIRFD])
7441 + DIRENT_H=''; AC_SUBST([DIRENT_H])
7443 diff -urN popt-for-windows/m4/dirfd.m4 popt-for-windows-gnulib/m4/dirfd.m4
7444 --- popt-for-windows/m4/dirfd.m4 1970-01-01 01:00:00.000000000 +0100
7445 +++ popt-for-windows-gnulib/m4/dirfd.m4 2008-10-25 15:17:05.000000000 +0100
7447 +#serial 15 -*- Autoconf -*-
7449 +dnl Find out how to get the file descriptor associated with an open DIR*.
7451 +# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008 Free Software
7453 +# This file is free software; the Free Software Foundation
7454 +# gives unlimited permission to copy and/or distribute it,
7455 +# with or without modifications, as long as this notice is preserved.
7457 +dnl From Jim Meyering
7459 +AC_DEFUN([gl_FUNC_DIRFD],
7461 + AC_REQUIRE([gl_DIRENT_H_DEFAULTS])
7462 + gl_REPLACE_DIRENT_H
7464 + dnl Persuade glibc <dirent.h> to declare dirfd().
7465 + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
7467 + dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57.
7468 + AC_REQUIRE([AC_PROG_CPP])
7469 + AC_REQUIRE([AC_PROG_EGREP])
7471 + AC_CHECK_FUNCS(dirfd)
7472 + AC_CHECK_DECLS([dirfd], , ,
7473 + [#include <sys/types.h>
7474 + #include <dirent.h>])
7475 + if test $ac_cv_have_decl_dirfd = no; then
7479 + AC_CACHE_CHECK([whether dirfd is a macro],
7480 + gl_cv_func_dirfd_macro,
7481 + [AC_EGREP_CPP([dirent_header_defines_dirfd], [
7482 +#include <sys/types.h>
7483 +#include <dirent.h>
7485 + dirent_header_defines_dirfd
7487 + gl_cv_func_dirfd_macro=yes,
7488 + gl_cv_func_dirfd_macro=no)])
7490 + # Use the replacement only if we have no function, macro,
7491 + # or declaration with that name.
7492 + if test $ac_cv_func_dirfd,$ac_cv_have_decl_dirfd,$gl_cv_func_dirfd_macro \
7494 + AC_REPLACE_FUNCS([dirfd])
7496 + [how to get the file descriptor associated with an open DIR*],
7497 + gl_cv_sys_dir_fd_member_name,
7499 + dirfd_save_CFLAGS=$CFLAGS
7500 + for ac_expr in d_fd dd_fd; do
7502 + CFLAGS="$CFLAGS -DDIR_FD_MEMBER_NAME=$ac_expr"
7504 + [#include <sys/types.h>
7505 + #include <dirent.h>],
7506 + [DIR *dir_p = opendir("."); (void) dir_p->DIR_FD_MEMBER_NAME;],
7509 + CFLAGS=$dirfd_save_CFLAGS
7510 + test "$dir_fd_found" = yes && break
7512 + test "$dir_fd_found" = yes || ac_expr=no_such_member
7514 + gl_cv_sys_dir_fd_member_name=$ac_expr
7517 + if test $gl_cv_sys_dir_fd_member_name != no_such_member; then
7518 + AC_DEFINE_UNQUOTED(DIR_FD_MEMBER_NAME,
7519 + $gl_cv_sys_dir_fd_member_name,
7520 + [the name of the file descriptor member of DIR])
7522 + AH_VERBATIM(DIR_TO_FD,
7523 + [#ifdef DIR_FD_MEMBER_NAME
7524 +# define DIR_TO_FD(Dir_p) ((Dir_p)->DIR_FD_MEMBER_NAME)
7526 +# define DIR_TO_FD(Dir_p) -1
7531 diff -urN popt-for-windows/m4/d-type.m4 popt-for-windows-gnulib/m4/d-type.m4
7532 --- popt-for-windows/m4/d-type.m4 1970-01-01 01:00:00.000000000 +0100
7533 +++ popt-for-windows-gnulib/m4/d-type.m4 2008-10-25 15:17:05.000000000 +0100
7537 +dnl From Jim Meyering.
7539 +dnl Check whether struct dirent has a member named d_type.
7542 +# Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2006 Free Software
7545 +# This file is free software; the Free Software Foundation
7546 +# gives unlimited permission to copy and/or distribute it,
7547 +# with or without modifications, as long as this notice is preserved.
7549 +AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE],
7550 + [AC_CACHE_CHECK([for d_type member in directory struct],
7551 + gl_cv_struct_dirent_d_type,
7554 +#include <sys/types.h>
7555 +#include <dirent.h>
7557 + [struct dirent dp; dp.d_type = 0;],
7559 + gl_cv_struct_dirent_d_type=yes,
7560 + gl_cv_struct_dirent_d_type=no)
7563 + if test $gl_cv_struct_dirent_d_type = yes; then
7564 + AC_DEFINE(HAVE_STRUCT_DIRENT_D_TYPE, 1,
7565 + [Define if there is a member named d_type in the struct describing
7566 + directory headers.])
7570 diff -urN popt-for-windows/m4/extensions.m4 popt-for-windows-gnulib/m4/extensions.m4
7571 --- popt-for-windows/m4/extensions.m4 1970-01-01 01:00:00.000000000 +0100
7572 +++ popt-for-windows-gnulib/m4/extensions.m4 2008-10-25 15:17:05.000000000 +0100
7574 +# serial 5 -*- Autoconf -*-
7575 +# Enable extensions on systems that normally disable them.
7577 +# Copyright (C) 2003, 2006-2008 Free Software Foundation, Inc.
7578 +# This file is free software; the Free Software Foundation
7579 +# gives unlimited permission to copy and/or distribute it,
7580 +# with or without modifications, as long as this notice is preserved.
7582 +# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from CVS
7583 +# Autoconf. Perhaps we can remove this once we can assume Autoconf
7584 +# 2.62 or later everywhere, but since CVS Autoconf mutates rapidly
7585 +# enough in this area it's likely we'll need to redefine
7586 +# AC_USE_SYSTEM_EXTENSIONS for quite some time.
7588 +# AC_USE_SYSTEM_EXTENSIONS
7589 +# ------------------------
7590 +# Enable extensions on systems that normally disable them,
7591 +# typically due to standards-conformance issues.
7592 +# Remember that #undef in AH_VERBATIM gets replaced with #define by
7593 +# AC_DEFINE. The goal here is to define all known feature-enabling
7594 +# macros, then, if reports of conflicts are made, disable macros that
7595 +# cause problems on some platforms (such as __EXTENSIONS__).
7596 +AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
7597 +[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
7598 +AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
7600 + AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
7601 + if test "$MINIX" = yes; then
7602 + AC_DEFINE([_POSIX_SOURCE], [1],
7603 + [Define to 1 if you need to in order for `stat' and other
7605 + AC_DEFINE([_POSIX_1_SOURCE], [2],
7606 + [Define to 2 if the system does not provide POSIX.1 features
7607 + except with this defined.])
7608 + AC_DEFINE([_MINIX], [1],
7609 + [Define to 1 if on MINIX.])
7612 + AH_VERBATIM([__EXTENSIONS__],
7613 +[/* Enable extensions on AIX 3, Interix. */
7614 +#ifndef _ALL_SOURCE
7615 +# undef _ALL_SOURCE
7617 +/* Enable GNU extensions on systems that have them. */
7618 +#ifndef _GNU_SOURCE
7619 +# undef _GNU_SOURCE
7621 +/* Enable threading extensions on Solaris. */
7622 +#ifndef _POSIX_PTHREAD_SEMANTICS
7623 +# undef _POSIX_PTHREAD_SEMANTICS
7625 +/* Enable extensions on HP NonStop. */
7626 +#ifndef _TANDEM_SOURCE
7627 +# undef _TANDEM_SOURCE
7629 +/* Enable general extensions on Solaris. */
7630 +#ifndef __EXTENSIONS__
7631 +# undef __EXTENSIONS__
7634 + AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
7635 + [ac_cv_safe_to_define___extensions__],
7636 + [AC_COMPILE_IFELSE(
7637 + [AC_LANG_PROGRAM([[
7638 +# define __EXTENSIONS__ 1
7639 + ]AC_INCLUDES_DEFAULT])],
7640 + [ac_cv_safe_to_define___extensions__=yes],
7641 + [ac_cv_safe_to_define___extensions__=no])])
7642 + test $ac_cv_safe_to_define___extensions__ = yes &&
7643 + AC_DEFINE([__EXTENSIONS__])
7644 + AC_DEFINE([_ALL_SOURCE])
7645 + AC_DEFINE([_GNU_SOURCE])
7646 + AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
7647 + AC_DEFINE([_TANDEM_SOURCE])
7648 +])# AC_USE_SYSTEM_EXTENSIONS
7650 +# gl_USE_SYSTEM_EXTENSIONS
7651 +# ------------------------
7652 +# Enable extensions on systems that normally disable them,
7653 +# typically due to standards-conformance issues.
7654 +AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS],
7655 + [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])])
7656 diff -urN popt-for-windows/m4/fnmatch.m4 popt-for-windows-gnulib/m4/fnmatch.m4
7657 --- popt-for-windows/m4/fnmatch.m4 1970-01-01 01:00:00.000000000 +0100
7658 +++ popt-for-windows-gnulib/m4/fnmatch.m4 2008-10-25 15:17:05.000000000 +0100
7660 +# Check for fnmatch - serial 2.
7662 +# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software
7664 +# This file is free software; the Free Software Foundation
7665 +# gives unlimited permission to copy and/or distribute it,
7666 +# with or without modifications, as long as this notice is preserved.
7668 +# Autoconf defines AC_FUNC_FNMATCH, but that is obsolescent.
7669 +# New applications should use the macros below instead.
7671 +# _AC_FUNC_FNMATCH_IF(STANDARD = GNU | POSIX, CACHE_VAR, IF-TRUE, IF-FALSE)
7672 +# -------------------------------------------------------------------------
7673 +# If a STANDARD compliant fnmatch is found, run IF-TRUE, otherwise
7674 +# IF-FALSE. Use CACHE_VAR.
7675 +AC_DEFUN([_AC_FUNC_FNMATCH_IF],
7677 + [for working $1 fnmatch],
7679 + [dnl Some versions of Solaris, SCO, and the GNU C Library
7680 + dnl have a broken or incompatible fnmatch.
7681 + dnl So we run a test program. If we are cross-compiling, take no chance.
7682 + dnl Thanks to John Oleynick, François Pinard, and Paul Eggert for this test.
7685 + [[#include <fnmatch.h>
7687 + y (char const *pattern, char const *string, int flags)
7689 + return fnmatch (pattern, string, flags) == 0;
7692 + n (char const *pattern, char const *string, int flags)
7694 + return fnmatch (pattern, string, flags) == FNM_NOMATCH;
7697 + [[char const *Apat = 'A' < '\\\\' ? "[A-\\\\\\\\]" : "[\\\\\\\\-A]";
7698 + char const *apat = 'a' < '\\\\' ? "[a-\\\\\\\\]" : "[\\\\\\\\-a]";
7699 + static char const A_1[] = { 'A' - 1, 0 };
7700 + static char const A01[] = { 'A' + 1, 0 };
7701 + static char const a_1[] = { 'a' - 1, 0 };
7702 + static char const a01[] = { 'a' + 1, 0 };
7703 + static char const bs_1[] = { '\\\\' - 1, 0 };
7704 + static char const bs01[] = { '\\\\' + 1, 0 };
7707 + && y ("a*", "abc", 0)
7708 + && n ("d*/*1", "d/s/1", FNM_PATHNAME)
7709 + && y ("a\\\\bc", "abc", 0)
7710 + && n ("a\\\\bc", "abc", FNM_NOESCAPE)
7711 + && y ("*x", ".x", 0)
7712 + && n ("*x", ".x", FNM_PERIOD)
7713 + && y (Apat, "\\\\", 0) && y (Apat, "A", 0)
7714 + && y (apat, "\\\\", 0) && y (apat, "a", 0)
7715 + && n (Apat, A_1, 0) == ('A' < '\\\\')
7716 + && n (apat, a_1, 0) == ('a' < '\\\\')
7717 + && y (Apat, A01, 0) == ('A' < '\\\\')
7718 + && y (apat, a01, 0) == ('a' < '\\\\')
7719 + && y (Apat, bs_1, 0) == ('A' < '\\\\')
7720 + && y (apat, bs_1, 0) == ('a' < '\\\\')
7721 + && n (Apat, bs01, 0) == ('A' < '\\\\')
7722 + && n (apat, bs01, 0) == ('a' < '\\\\')
7723 + && ]m4_if([$1], [GNU],
7724 + [y ("xxXX", "xXxX", FNM_CASEFOLD)
7725 + && y ("a++(x|yy)b", "a+xyyyyxb", FNM_EXTMATCH)
7726 + && n ("d*/*1", "d/s/1", FNM_FILE_NAME)
7727 + && y ("*", "x", FNM_FILE_NAME | FNM_LEADING_DIR)
7728 + && y ("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR)
7729 + && y ("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR)],
7734 +AS_IF([test $$2 = yes], [$3], [$4])
7735 +])# _AC_FUNC_FNMATCH_IF
7738 +# _AC_LIBOBJ_FNMATCH
7739 +# ------------------
7740 +# Prepare the replacement of fnmatch.
7741 +AC_DEFUN([_AC_LIBOBJ_FNMATCH],
7742 +[AC_REQUIRE([AC_FUNC_ALLOCA])dnl
7743 +AC_REQUIRE([AC_TYPE_MBSTATE_T])dnl
7744 +AC_CHECK_DECLS([isblank], [], [], [#include <ctype.h>])
7745 +AC_CHECK_FUNCS_ONCE([btowc isblank iswctype mbsrtowcs mempcpy wmemchr wmemcpy wmempcpy])
7746 +AC_CHECK_HEADERS_ONCE([wctype.h])
7747 +AC_LIBOBJ([fnmatch])
7748 +FNMATCH_H=fnmatch.h
7749 +])# _AC_LIBOBJ_FNMATCH
7752 +AC_DEFUN([gl_FUNC_FNMATCH_POSIX],
7755 + _AC_FUNC_FNMATCH_IF([POSIX], [ac_cv_func_fnmatch_posix],
7756 + [rm -f lib/fnmatch.h],
7757 + [_AC_LIBOBJ_FNMATCH])
7758 + if test $ac_cv_func_fnmatch_posix != yes; then
7759 + dnl We must choose a different name for our function, since on ELF systems
7760 + dnl a broken fnmatch() in libc.so would override our fnmatch() if it is
7761 + dnl compiled into a shared library.
7762 + AC_DEFINE([fnmatch], [posix_fnmatch],
7763 + [Define to a replacement function name for fnmatch().])
7765 + AC_SUBST([FNMATCH_H])
7769 +AC_DEFUN([gl_FUNC_FNMATCH_GNU],
7771 + dnl Persuade glibc <fnmatch.h> to declare FNM_CASEFOLD etc.
7772 + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
7775 + _AC_FUNC_FNMATCH_IF([GNU], [ac_cv_func_fnmatch_gnu],
7776 + [rm -f lib/fnmatch.h],
7777 + [_AC_LIBOBJ_FNMATCH])
7778 + if test $ac_cv_func_fnmatch_gnu != yes; then
7779 + dnl We must choose a different name for our function, since on ELF systems
7780 + dnl a broken fnmatch() in libc.so would override our fnmatch() if it is
7781 + dnl compiled into a shared library.
7782 + AC_DEFINE([fnmatch], [gnu_fnmatch],
7783 + [Define to a replacement function name for fnmatch().])
7785 + AC_SUBST([FNMATCH_H])
7787 diff -urN popt-for-windows/m4/getlogin_r.m4 popt-for-windows-gnulib/m4/getlogin_r.m4
7788 --- popt-for-windows/m4/getlogin_r.m4 1970-01-01 01:00:00.000000000 +0100
7789 +++ popt-for-windows-gnulib/m4/getlogin_r.m4 2008-10-25 15:17:05.000000000 +0100
7793 +# Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
7795 +# This file is free software; the Free Software Foundation
7796 +# gives unlimited permission to copy and/or distribute it,
7797 +# with or without modifications, as long as this notice is preserved.
7799 +dnl From Derek Price
7801 +dnl Provide getlogin_r when the system lacks it.
7804 +AC_DEFUN([gl_GETLOGIN_R],
7806 + AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
7807 + AC_CHECK_FUNCS_ONCE([getlogin_r])
7808 + if test $ac_cv_func_getlogin_r = no; then
7809 + AC_LIBOBJ([getlogin_r])
7810 + gl_PREREQ_GETLOGIN_R
7811 + if test $ac_cv_have_decl_getlogin_r = yes; then
7812 + HAVE_DECL_GETLOGIN_R=1
7814 + HAVE_DECL_GETLOGIN_R=0
7819 +AC_DEFUN([gl_PREREQ_GETLOGIN_R],
7821 + AC_CHECK_DECLS_ONCE([getlogin])
7822 + AC_CHECK_DECLS_ONCE([getlogin_r])
7824 diff -urN popt-for-windows/m4/glob.m4 popt-for-windows-gnulib/m4/glob.m4
7825 --- popt-for-windows/m4/glob.m4 1970-01-01 01:00:00.000000000 +0100
7826 +++ popt-for-windows-gnulib/m4/glob.m4 2008-10-25 15:17:05.000000000 +0100
7828 +# glob.m4 serial 10
7829 +dnl Copyright (C) 2005-2007 Free Software Foundation, Inc.
7830 +dnl This file is free software; the Free Software Foundation
7831 +dnl gives unlimited permission to copy and/or distribute it,
7832 +dnl with or without modifications, as long as this notice is preserved.
7834 +# The glob module assumes you want GNU glob, with glob_pattern_p etc,
7835 +# rather than vanilla POSIX glob. This means your code should
7836 +# always include <glob.h> for the glob prototypes.
7838 +AC_DEFUN([gl_GLOB_SUBSTITUTE],
7844 + AC_SUBST([GLOB_H])
7847 +AC_DEFUN([gl_GLOB],
7849 + AC_CHECK_HEADERS([glob.h], [], [GLOB_H=glob.h])
7851 + if test -z "$GLOB_H"; then
7852 + AC_CACHE_CHECK([for GNU glob interface version 1],
7853 + [gl_cv_gnu_glob_interface_version_1],
7854 +[ AC_COMPILE_IFELSE(
7855 +[[#include <gnu-versions.h>
7856 +char a[_GNU_GLOB_INTERFACE_VERSION == 1 ? 1 : -1];]],
7857 + [gl_cv_gnu_glob_interface_version_1=yes],
7858 + [gl_cv_gnu_glob_interface_version_1=no])])
7860 + if test "$gl_cv_gnu_glob_interface_version_1" = "no"; then
7865 + if test -z "$GLOB_H"; then
7866 + AC_CACHE_CHECK([whether glob lists broken symlinks],
7867 + [gl_cv_glob_lists_symlinks],
7868 +[ if ln -s conf-doesntexist conf$$-globtest 2>/dev/null; then
7869 + gl_cv_glob_lists_symlinks=maybe
7871 + # If we can't make a symlink, then we cannot test this issue. Be
7872 + # pessimistic about this.
7873 + gl_cv_glob_lists_symlinks=no
7876 + if test $gl_cv_glob_lists_symlinks = maybe; then
7879 +[[#include <stddef.h>
7880 +#include <glob.h>]],
7882 +if (glob ("conf*-globtest", 0, NULL, &found) == GLOB_NOMATCH) return 1;]]),
7883 + [gl_cv_glob_lists_symlinks=yes],
7884 + [gl_cv_glob_lists_symlinks=no], [gl_cv_glob_lists_symlinks=no])
7887 + if test $gl_cv_glob_lists_symlinks = no; then
7892 + rm -f conf$$-globtest
7894 + if test -n "$GLOB_H"; then
7895 + gl_GLOB_SUBSTITUTE
7899 +# Prerequisites of lib/glob.*.
7900 +AC_DEFUN([gl_PREREQ_GLOB],
7902 + AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE])dnl
7903 + AC_REQUIRE([AC_C_RESTRICT])dnl
7904 + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])dnl
7905 + AC_CHECK_HEADERS_ONCE([sys/cdefs.h unistd.h])dnl
7906 + if test $ac_cv_header_sys_cdefs_h = yes; then
7907 + HAVE_SYS_CDEFS_H=1
7909 + HAVE_SYS_CDEFS_H=0
7911 + AC_SUBST([HAVE_SYS_CDEFS_H])
7912 + AC_CHECK_FUNCS_ONCE([fstatat getlogin_r getpwnam_r])dnl
7914 diff -urN popt-for-windows/m4/gnulib-common.m4 popt-for-windows-gnulib/m4/gnulib-common.m4
7915 --- popt-for-windows/m4/gnulib-common.m4 1970-01-01 01:00:00.000000000 +0100
7916 +++ popt-for-windows-gnulib/m4/gnulib-common.m4 2008-10-25 15:17:05.000000000 +0100
7918 +# gnulib-common.m4 serial 6
7919 +dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
7920 +dnl This file is free software; the Free Software Foundation
7921 +dnl gives unlimited permission to copy and/or distribute it,
7922 +dnl with or without modifications, as long as this notice is preserved.
7925 +# is expanded unconditionally through gnulib-tool magic.
7926 +AC_DEFUN([gl_COMMON], [
7927 + dnl Use AC_REQUIRE here, so that the code is expanded once only.
7928 + AC_REQUIRE([gl_COMMON_BODY])
7930 +AC_DEFUN([gl_COMMON_BODY], [
7931 + AH_VERBATIM([isoc99_inline],
7932 +[/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
7933 + the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of
7934 + earlier versions), but does not display it by setting __GNUC_STDC_INLINE__.
7935 + __APPLE__ && __MACH__ test for MacOS X.
7936 + __APPLE_CC__ tests for the Apple compiler and its version.
7937 + __STDC_VERSION__ tests for the C99 mode. */
7938 +#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
7939 +# define __GNUC_STDC_INLINE__ 1
7941 + AH_VERBATIM([unused_parameter],
7942 +[/* Define as a marker that can be attached to function parameter declarations
7943 + for parameters that are not used. This helps to reduce warnings, such as
7944 + from GCC -Wunused-parameter. */
7945 +#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
7946 +# define _UNUSED_PARAMETER_ __attribute__ ((__unused__))
7948 +# define _UNUSED_PARAMETER_
7953 +# gl_MODULE_INDICATOR([modulename])
7954 +# defines a C macro indicating the presence of the given module.
7955 +AC_DEFUN([gl_MODULE_INDICATOR],
7957 + AC_DEFINE([GNULIB_]translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1],
7958 + [Define to 1 when using the gnulib module ]$1[.])
7962 +# is a backport of autoconf-2.59c's m4_foreach_w.
7963 +# Remove this macro when we can assume autoconf >= 2.60.
7964 +m4_ifndef([m4_foreach_w],
7965 + [m4_define([m4_foreach_w],
7966 + [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
7969 +# is a backport of autoconf-2.60's AC_PROG_MKDIR_P.
7970 +# Remove this macro when we can assume autoconf >= 2.60.
7971 +m4_ifdef([AC_PROG_MKDIR_P], [], [
7972 + AC_DEFUN([AC_PROG_MKDIR_P],
7973 + [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
7974 + MKDIR_P='$(mkdir_p)'
7975 + AC_SUBST([MKDIR_P])])])
7978 +# This definition overrides the AC_C_RESTRICT macro from autoconf 2.60..2.61,
7979 +# so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++
7981 +# This definition can be removed once autoconf >= 2.62 can be assumed.
7982 +AC_DEFUN([AC_C_RESTRICT],
7983 +[AC_CACHE_CHECK([for C/C++ restrict keyword], ac_cv_c_restrict,
7984 + [ac_cv_c_restrict=no
7985 + # The order here caters to the fact that C++ does not require restrict.
7986 + for ac_kw in __restrict __restrict__ _Restrict restrict; do
7987 + AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
7988 + [[typedef int * int_ptr;
7989 + int foo (int_ptr $ac_kw ip) {
7993 + int * $ac_kw t = s;
7995 + return foo(t)]])],
7996 + [ac_cv_c_restrict=$ac_kw])
7997 + test "$ac_cv_c_restrict" != no && break
8000 + AH_VERBATIM([restrict],
8001 +[/* Define to the equivalent of the C99 'restrict' keyword, or to
8002 + nothing if this is not supported. Do not define if restrict is
8003 + supported directly. */
8005 +/* Work around a bug in Sun C++: it does not support _Restrict, even
8006 + though the corresponding Sun C compiler does, which causes
8007 + "#define restrict _Restrict" in the previous line. Perhaps some future
8008 + version of Sun C++ will work with _Restrict; if so, it'll probably
8009 + define __RESTRICT, just as Sun C does. */
8010 +#if defined __SUNPRO_CC && !defined __RESTRICT
8013 + case $ac_cv_c_restrict in
8015 + no) AC_DEFINE([restrict], []) ;;
8016 + *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
8019 diff -urN popt-for-windows/m4/gnulib-comp.m4 popt-for-windows-gnulib/m4/gnulib-comp.m4
8020 --- popt-for-windows/m4/gnulib-comp.m4 1970-01-01 01:00:00.000000000 +0100
8021 +++ popt-for-windows-gnulib/m4/gnulib-comp.m4 2008-10-25 15:17:05.000000000 +0100
8023 +# DO NOT EDIT! GENERATED AUTOMATICALLY!
8024 +# Copyright (C) 2002-2008 Free Software Foundation, Inc.
8026 +# This file is free software, distributed under the terms of the GNU
8027 +# General Public License. As a special exception to the GNU General
8028 +# Public License, this file may be distributed as part of a program
8029 +# that contains a configuration script generated by Autoconf, under
8030 +# the same distribution terms as the rest of that program.
8032 +# Generated by gnulib-tool.
8034 +# This file represents the compiled summary of the specification in
8035 +# gnulib-cache.m4. It lists the computed macro invocations that need
8036 +# to be invoked from configure.ac.
8037 +# In projects using CVS, this file can be treated like other built files.
8040 +# This macro should be invoked from ./configure.ac, in the section
8041 +# "Checks for programs", right after AC_PROG_CC, and certainly before
8042 +# any checks for libraries, header files, types and library functions.
8043 +AC_DEFUN([gl_EARLY],
8045 + m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace
8046 + m4_pattern_allow([^gl_ES$])dnl a valid locale name
8047 + m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
8048 + m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
8049 + AC_REQUIRE([AC_PROG_RANLIB])
8050 + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
8053 +# This macro should be invoked from ./configure.ac, in the section
8054 +# "Check for header files, types and library functions".
8055 +AC_DEFUN([gl_INIT],
8057 + AM_CONDITIONAL([GL_COND_LIBTOOL], [true])
8058 + gl_cond_libtool=true
8059 + m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ]))
8060 + m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS]))
8061 + m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES]))
8062 + m4_pushdef([gl_LIBSOURCES_LIST], [])
8063 + m4_pushdef([gl_LIBSOURCES_DIR], [])
8065 + gl_source_base='lib'
8067 +LTALLOCA=`echo "$ALLOCA" | sed 's/\.[^.]* /.lo /g;s/\.[^.]*$/.lo/'`
8068 +changequote([, ])dnl
8069 +AC_SUBST([LTALLOCA])
8071 + gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE
8074 + gl_DIRENT_MODULE_INDICATOR([dirfd])
8075 + # No macro. You should also use one of fnmatch-posix or fnmatch-gnu.
8077 + gl_UNISTD_MODULE_INDICATOR([getlogin_r])
8079 + gl_FUNC_MALLOC_POSIX
8080 + gl_STDLIB_MODULE_INDICATOR([malloc-posix])
8082 + gl_STRING_MODULE_INDICATOR([mempcpy])
8086 + gl_STRING_MODULE_INDICATOR([strdup])
8087 + gl_HEADER_STRING_H
8088 + gl_HEADER_SYS_STAT_H
8093 + m4_ifval(gl_LIBSOURCES_LIST, [
8094 + m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ ||
8095 + for gl_file in ]gl_LIBSOURCES_LIST[ ; do
8096 + if test ! -r ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file ; then
8097 + echo "missing file ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file" >&2
8101 + m4_if(m4_sysval, [0], [],
8102 + [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])
8104 + m4_popdef([gl_LIBSOURCES_DIR])
8105 + m4_popdef([gl_LIBSOURCES_LIST])
8106 + m4_popdef([AC_LIBSOURCES])
8107 + m4_popdef([AC_REPLACE_FUNCS])
8108 + m4_popdef([AC_LIBOBJ])
8109 + AC_CONFIG_COMMANDS_PRE([
8112 + if test -n "$gl_LIBOBJS"; then
8113 + # Remove the extension.
8114 + sed_drop_objext='s/\.o$//;s/\.obj$//'
8115 + for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do
8116 + gl_libobjs="$gl_libobjs $i.$ac_objext"
8117 + gl_ltlibobjs="$gl_ltlibobjs $i.lo"
8120 + AC_SUBST([gl_LIBOBJS], [$gl_libobjs])
8121 + AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs])
8124 + gltests_ltlibdeps=
8125 + m4_pushdef([AC_LIBOBJ], m4_defn([gltests_LIBOBJ]))
8126 + m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gltests_REPLACE_FUNCS]))
8127 + m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES]))
8128 + m4_pushdef([gltests_LIBSOURCES_LIST], [])
8129 + m4_pushdef([gltests_LIBSOURCES_DIR], [])
8131 + gl_source_base='tests'
8132 + m4_ifval(gltests_LIBSOURCES_LIST, [
8133 + m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ ||
8134 + for gl_file in ]gltests_LIBSOURCES_LIST[ ; do
8135 + if test ! -r ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file ; then
8136 + echo "missing file ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file" >&2
8140 + m4_if(m4_sysval, [0], [],
8141 + [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])])
8143 + m4_popdef([gltests_LIBSOURCES_DIR])
8144 + m4_popdef([gltests_LIBSOURCES_LIST])
8145 + m4_popdef([AC_LIBSOURCES])
8146 + m4_popdef([AC_REPLACE_FUNCS])
8147 + m4_popdef([AC_LIBOBJ])
8148 + AC_CONFIG_COMMANDS_PRE([
8150 + gltests_ltlibobjs=
8151 + if test -n "$gltests_LIBOBJS"; then
8152 + # Remove the extension.
8153 + sed_drop_objext='s/\.o$//;s/\.obj$//'
8154 + for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do
8155 + gltests_libobjs="$gltests_libobjs $i.$ac_objext"
8156 + gltests_ltlibobjs="$gltests_ltlibobjs $i.lo"
8159 + AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs])
8160 + AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs])
8164 +# Like AC_LIBOBJ, except that the module name goes
8165 +# into gl_LIBOBJS instead of into LIBOBJS.
8166 +AC_DEFUN([gl_LIBOBJ], [
8167 + AS_LITERAL_IF([$1], [gl_LIBSOURCES([$1.c])])dnl
8168 + gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext"
8171 +# Like AC_REPLACE_FUNCS, except that the module name goes
8172 +# into gl_LIBOBJS instead of into LIBOBJS.
8173 +AC_DEFUN([gl_REPLACE_FUNCS], [
8174 + m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl
8175 + AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)])
8178 +# Like AC_LIBSOURCES, except the directory where the source file is
8179 +# expected is derived from the gnulib-tool parameterization,
8180 +# and alloca is special cased (for the alloca-opt module).
8181 +# We could also entirely rely on EXTRA_lib..._SOURCES.
8182 +AC_DEFUN([gl_LIBSOURCES], [
8183 + m4_foreach([_gl_NAME], [$1], [
8184 + m4_if(_gl_NAME, [alloca.c], [], [
8185 + m4_define([gl_LIBSOURCES_DIR], [lib])
8186 + m4_append([gl_LIBSOURCES_LIST], _gl_NAME, [ ])
8191 +# Like AC_LIBOBJ, except that the module name goes
8192 +# into gltests_LIBOBJS instead of into LIBOBJS.
8193 +AC_DEFUN([gltests_LIBOBJ], [
8194 + AS_LITERAL_IF([$1], [gltests_LIBSOURCES([$1.c])])dnl
8195 + gltests_LIBOBJS="$gltests_LIBOBJS $1.$ac_objext"
8198 +# Like AC_REPLACE_FUNCS, except that the module name goes
8199 +# into gltests_LIBOBJS instead of into LIBOBJS.
8200 +AC_DEFUN([gltests_REPLACE_FUNCS], [
8201 + m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl
8202 + AC_CHECK_FUNCS([$1], , [gltests_LIBOBJ($ac_func)])
8205 +# Like AC_LIBSOURCES, except the directory where the source file is
8206 +# expected is derived from the gnulib-tool parameterization,
8207 +# and alloca is special cased (for the alloca-opt module).
8208 +# We could also entirely rely on EXTRA_lib..._SOURCES.
8209 +AC_DEFUN([gltests_LIBSOURCES], [
8210 + m4_foreach([_gl_NAME], [$1], [
8211 + m4_if(_gl_NAME, [alloca.c], [], [
8212 + m4_define([gltests_LIBSOURCES_DIR], [tests])
8213 + m4_append([gltests_LIBSOURCES_LIST], _gl_NAME, [ ])
8218 +# This macro records the list of files which have been installed by
8219 +# gnulib-tool and may be removed by future gnulib-tool invocations.
8220 +AC_DEFUN([gl_FILE_LIST], [
8221 + build-aux/link-warning.h
8229 + lib/fnmatch_loop.c
8252 + m4/gnulib-common.m4
8253 + m4/include_next.m4
8268 diff -urN popt-for-windows/m4/gnulib-tool.m4 popt-for-windows-gnulib/m4/gnulib-tool.m4
8269 --- popt-for-windows/m4/gnulib-tool.m4 1970-01-01 01:00:00.000000000 +0100
8270 +++ popt-for-windows-gnulib/m4/gnulib-tool.m4 2008-10-25 15:17:05.000000000 +0100
8272 +# gnulib-tool.m4 serial 2
8273 +dnl Copyright (C) 2004-2005 Free Software Foundation, Inc.
8274 +dnl This file is free software; the Free Software Foundation
8275 +dnl gives unlimited permission to copy and/or distribute it,
8276 +dnl with or without modifications, as long as this notice is preserved.
8278 +dnl The following macros need not be invoked explicitly.
8279 +dnl Invoking them does nothing except to declare default arguments
8280 +dnl for "gnulib-tool --import".
8282 +dnl Usage: gl_LOCAL_DIR([DIR])
8283 +AC_DEFUN([gl_LOCAL_DIR], [])
8285 +dnl Usage: gl_MODULES([module1 module2 ...])
8286 +AC_DEFUN([gl_MODULES], [])
8288 +dnl Usage: gl_AVOID([module1 module2 ...])
8289 +AC_DEFUN([gl_AVOID], [])
8291 +dnl Usage: gl_SOURCE_BASE([DIR])
8292 +AC_DEFUN([gl_SOURCE_BASE], [])
8294 +dnl Usage: gl_M4_BASE([DIR])
8295 +AC_DEFUN([gl_M4_BASE], [])
8297 +dnl Usage: gl_PO_BASE([DIR])
8298 +AC_DEFUN([gl_PO_BASE], [])
8300 +dnl Usage: gl_DOC_BASE([DIR])
8301 +AC_DEFUN([gl_DOC_BASE], [])
8303 +dnl Usage: gl_TESTS_BASE([DIR])
8304 +AC_DEFUN([gl_TESTS_BASE], [])
8306 +dnl Usage: gl_WITH_TESTS
8307 +AC_DEFUN([gl_WITH_TESTS], [])
8309 +dnl Usage: gl_LIB([LIBNAME])
8310 +AC_DEFUN([gl_LIB], [])
8312 +dnl Usage: gl_LGPL or gl_LGPL([VERSION])
8313 +AC_DEFUN([gl_LGPL], [])
8315 +dnl Usage: gl_MAKEFILE_NAME([FILENAME])
8316 +AC_DEFUN([gl_MAKEFILE_NAME], [])
8318 +dnl Usage: gl_LIBTOOL
8319 +AC_DEFUN([gl_LIBTOOL], [])
8321 +dnl Usage: gl_MACRO_PREFIX([PREFIX])
8322 +AC_DEFUN([gl_MACRO_PREFIX], [])
8324 +dnl Usage: gl_PO_DOMAIN([DOMAIN])
8325 +AC_DEFUN([gl_PO_DOMAIN], [])
8327 +dnl Usage: gl_VC_FILES([BOOLEAN])
8328 +AC_DEFUN([gl_VC_FILES], [])
8329 diff -urN popt-for-windows/m4/include_next.m4 popt-for-windows-gnulib/m4/include_next.m4
8330 --- popt-for-windows/m4/include_next.m4 1970-01-01 01:00:00.000000000 +0100
8331 +++ popt-for-windows-gnulib/m4/include_next.m4 2008-10-25 15:17:05.000000000 +0100
8333 +# include_next.m4 serial 8
8334 +dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
8335 +dnl This file is free software; the Free Software Foundation
8336 +dnl gives unlimited permission to copy and/or distribute it,
8337 +dnl with or without modifications, as long as this notice is preserved.
8339 +dnl From Paul Eggert and Derek Price.
8341 +dnl Sets INCLUDE_NEXT and PRAGMA_SYSTEM_HEADER.
8343 +dnl INCLUDE_NEXT expands to 'include_next' if the compiler supports it, or to
8344 +dnl 'include' otherwise.
8346 +dnl PRAGMA_SYSTEM_HEADER can be used in files that contain #include_next,
8347 +dnl so as to avoid GCC warnings when the gcc option -pedantic is used.
8348 +dnl '#pragma GCC system_header' has the same effect as if the file was found
8349 +dnl through the include search path specified with '-isystem' options (as
8350 +dnl opposed to the search path specified with '-I' options). Namely, gcc
8351 +dnl does not warn about some things, and on some systems (Solaris and Interix)
8352 +dnl __STDC__ evaluates to 0 instead of to 1. The latter is an undesired side
8353 +dnl effect; we are therefore careful to use 'defined __STDC__' or '1' instead
8354 +dnl of plain '__STDC__'.
8356 +AC_DEFUN([gl_INCLUDE_NEXT],
8358 + AC_LANG_PREPROC_REQUIRE()
8359 + AC_CACHE_CHECK([whether the preprocessor supports include_next],
8360 + [gl_cv_have_include_next],
8361 + [rm -rf conftestd1 conftestd2
8362 + mkdir conftestd1 conftestd2
8363 + dnl The include of <stdio.h> is because IBM C 9.0 on AIX 6.1 supports
8364 + dnl include_next when used as first preprocessor directive in a file,
8365 + dnl but not when preceded by another include directive.
8366 + cat <<EOF > conftestd1/conftest.h
8367 +#define DEFINED_IN_CONFTESTD1
8369 +#include_next <conftest.h>
8370 +#ifdef DEFINED_IN_CONFTESTD2
8373 +#error "include_next doesn't work"
8376 + cat <<EOF > conftestd2/conftest.h
8377 +#ifndef DEFINED_IN_CONFTESTD1
8378 +#error "include_next test doesn't work"
8380 +#define DEFINED_IN_CONFTESTD2
8382 + save_CPPFLAGS="$CPPFLAGS"
8383 + CPPFLAGS="$CPPFLAGS -Iconftestd1 -Iconftestd2"
8384 + AC_COMPILE_IFELSE([#include <conftest.h>],
8385 + [gl_cv_have_include_next=yes],
8386 + [gl_cv_have_include_next=no])
8387 + CPPFLAGS="$save_CPPFLAGS"
8388 + rm -rf conftestd1 conftestd2
8390 + PRAGMA_SYSTEM_HEADER=
8391 + if test $gl_cv_have_include_next = yes; then
8392 + INCLUDE_NEXT=include_next
8393 + if test -n "$GCC"; then
8394 + PRAGMA_SYSTEM_HEADER='#pragma GCC system_header'
8397 + INCLUDE_NEXT=include
8399 + AC_SUBST([INCLUDE_NEXT])
8400 + AC_SUBST([PRAGMA_SYSTEM_HEADER])
8403 +# gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...)
8404 +# ------------------------------------------
8405 +# For each arg foo.h, if #include_next works, define NEXT_FOO_H to be
8406 +# '<foo.h>'; otherwise define it to be
8407 +# '"///usr/include/foo.h"', or whatever other absolute file name is suitable.
8408 +# That way, a header file with the following line:
8409 +# #@INCLUDE_NEXT@ @NEXT_FOO_H@
8410 +# behaves (after sed substitution) as if it contained
8411 +# #include_next <foo.h>
8412 +# even if the compiler does not support include_next.
8413 +# The three "///" are to pacify Sun C 5.8, which otherwise would say
8414 +# "warning: #include of /usr/include/... may be non-portable".
8415 +# Use `""', not `<>', so that the /// cannot be confused with a C99 comment.
8416 +# Note: This macro assumes that the header file is not empty after
8417 +# preprocessing, i.e. it does not only define preprocessor macros but also
8418 +# provides some type/enum definitions or function/variable declarations.
8419 +AC_DEFUN([gl_CHECK_NEXT_HEADERS],
8421 + AC_REQUIRE([gl_INCLUDE_NEXT])
8422 + AC_CHECK_HEADERS_ONCE([$1])
8424 + m4_foreach_w([gl_HEADER_NAME], [$1],
8425 + [AS_VAR_PUSHDEF([gl_next_header],
8426 + [gl_cv_next_]m4_quote(m4_defn([gl_HEADER_NAME])))
8427 + if test $gl_cv_have_include_next = yes; then
8428 + AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
8431 + [absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>],
8432 + m4_quote(m4_defn([gl_next_header])),
8433 + [AS_VAR_PUSHDEF([gl_header_exists],
8434 + [ac_cv_header_]m4_quote(m4_defn([gl_HEADER_NAME])))
8435 + if test AS_VAR_GET(gl_header_exists) = yes; then
8438 + [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]]
8440 + dnl eval is necessary to expand ac_cpp.
8441 + dnl Ultrix and Pyramid sh refuse to redirect output of eval,
8442 + dnl so use subshell.
8443 + AS_VAR_SET([gl_next_header],
8444 + ['"'`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
8445 + sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{
8446 + s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1#
8452 + AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>'])
8454 + AS_VAR_POPDEF([gl_header_exists])])
8457 + AS_TR_CPP([NEXT_]m4_quote(m4_defn([gl_HEADER_NAME]))),
8458 + [AS_VAR_GET([gl_next_header])])
8459 + AS_VAR_POPDEF([gl_next_header])])
8461 diff -urN popt-for-windows/m4/malloc.m4 popt-for-windows-gnulib/m4/malloc.m4
8462 --- popt-for-windows/m4/malloc.m4 1970-01-01 01:00:00.000000000 +0100
8463 +++ popt-for-windows-gnulib/m4/malloc.m4 2008-10-25 15:17:05.000000000 +0100
8465 +# malloc.m4 serial 8
8466 +dnl Copyright (C) 2007 Free Software Foundation, Inc.
8467 +dnl This file is free software; the Free Software Foundation
8468 +dnl gives unlimited permission to copy and/or distribute it,
8469 +dnl with or without modifications, as long as this notice is preserved.
8471 +# gl_FUNC_MALLOC_POSIX
8472 +# --------------------
8473 +# Test whether 'malloc' is POSIX compliant (sets errno to ENOMEM when it
8474 +# fails), and replace malloc if it is not.
8475 +AC_DEFUN([gl_FUNC_MALLOC_POSIX],
8477 + AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
8478 + if test $gl_cv_func_malloc_posix = yes; then
8479 + HAVE_MALLOC_POSIX=1
8480 + AC_DEFINE([HAVE_MALLOC_POSIX], 1,
8481 + [Define if the 'malloc' function is POSIX compliant.])
8483 + AC_LIBOBJ([malloc])
8484 + HAVE_MALLOC_POSIX=0
8486 + AC_SUBST([HAVE_MALLOC_POSIX])
8489 +# Test whether malloc, realloc, calloc are POSIX compliant,
8490 +# Set gl_cv_func_malloc_posix to yes or no accordingly.
8491 +AC_DEFUN([gl_CHECK_MALLOC_POSIX],
8493 + AC_CACHE_CHECK([whether malloc, realloc, calloc are POSIX compliant],
8494 + [gl_cv_func_malloc_posix],
8496 + dnl It is too dangerous to try to allocate a large amount of memory:
8497 + dnl some systems go to their knees when you do that. So assume that
8498 + dnl all Unix implementations of the function are POSIX compliant.
8499 + AC_TRY_COMPILE([],
8500 + [#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
8503 + ], [gl_cv_func_malloc_posix=yes], [gl_cv_func_malloc_posix=no])
8506 diff -urN popt-for-windows/m4/mbstate_t.m4 popt-for-windows-gnulib/m4/mbstate_t.m4
8507 --- popt-for-windows/m4/mbstate_t.m4 1970-01-01 01:00:00.000000000 +0100
8508 +++ popt-for-windows-gnulib/m4/mbstate_t.m4 2008-10-25 15:17:05.000000000 +0100
8510 +# mbstate_t.m4 serial 10
8511 +dnl Copyright (C) 2000-2002, 2008 Free Software Foundation, Inc.
8512 +dnl This file is free software; the Free Software Foundation
8513 +dnl gives unlimited permission to copy and/or distribute it,
8514 +dnl with or without modifications, as long as this notice is preserved.
8516 +# From Paul Eggert.
8518 +# BeOS 5 has <wchar.h> but does not define mbstate_t,
8519 +# so you can't declare an object of that type.
8520 +# Check for this incompatibility with Standard C.
8522 +# AC_TYPE_MBSTATE_T
8523 +# -----------------
8524 +AC_DEFUN([AC_TYPE_MBSTATE_T],
8525 + [AC_CACHE_CHECK([for mbstate_t], ac_cv_type_mbstate_t,
8526 + [AC_COMPILE_IFELSE(
8528 + [AC_INCLUDES_DEFAULT[
8529 +# include <wchar.h>]],
8530 + [[mbstate_t x; return sizeof x;]])],
8531 + [ac_cv_type_mbstate_t=yes],
8532 + [ac_cv_type_mbstate_t=no])])
8533 + if test $ac_cv_type_mbstate_t = yes; then
8534 + AC_DEFINE([HAVE_MBSTATE_T], 1,
8535 + [Define to 1 if <wchar.h> declares mbstate_t.])
8537 + AC_DEFINE([mbstate_t], int,
8538 + [Define to a type if <wchar.h> does not define.])
8540 diff -urN popt-for-windows/m4/mempcpy.m4 popt-for-windows-gnulib/m4/mempcpy.m4
8541 --- popt-for-windows/m4/mempcpy.m4 1970-01-01 01:00:00.000000000 +0100
8542 +++ popt-for-windows-gnulib/m4/mempcpy.m4 2008-10-25 15:17:05.000000000 +0100
8544 +# mempcpy.m4 serial 9
8545 +dnl Copyright (C) 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
8546 +dnl This file is free software; the Free Software Foundation
8547 +dnl gives unlimited permission to copy and/or distribute it,
8548 +dnl with or without modifications, as long as this notice is preserved.
8550 +AC_DEFUN([gl_FUNC_MEMPCPY],
8552 + dnl Persuade glibc <string.h> to declare mempcpy().
8553 + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
8555 + dnl The mempcpy() declaration in lib/string.in.h uses 'restrict'.
8556 + AC_REQUIRE([AC_C_RESTRICT])
8558 + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
8559 + AC_REPLACE_FUNCS(mempcpy)
8560 + if test $ac_cv_func_mempcpy = no; then
8566 +# Prerequisites of lib/mempcpy.c.
8567 +AC_DEFUN([gl_PREREQ_MEMPCPY], [
8570 diff -urN popt-for-windows/m4/onceonly.m4 popt-for-windows-gnulib/m4/onceonly.m4
8571 --- popt-for-windows/m4/onceonly.m4 1970-01-01 01:00:00.000000000 +0100
8572 +++ popt-for-windows-gnulib/m4/onceonly.m4 2008-10-25 15:17:05.000000000 +0100
8574 +# onceonly.m4 serial 6
8575 +dnl Copyright (C) 2002-2003, 2005-2006, 2008 Free Software Foundation, Inc.
8576 +dnl This file is free software, distributed under the terms of the GNU
8577 +dnl General Public License. As a special exception to the GNU General
8578 +dnl Public License, this file may be distributed as part of a program
8579 +dnl that contains a configuration script generated by Autoconf, under
8580 +dnl the same distribution terms as the rest of that program.
8582 +dnl This file defines some "once only" variants of standard autoconf macros.
8583 +dnl AC_CHECK_HEADERS_ONCE like AC_CHECK_HEADERS
8584 +dnl AC_CHECK_FUNCS_ONCE like AC_CHECK_FUNCS
8585 +dnl AC_CHECK_DECLS_ONCE like AC_CHECK_DECLS
8586 +dnl AC_REQUIRE([AC_FUNC_STRCOLL]) like AC_FUNC_STRCOLL
8587 +dnl The advantage is that the check for each of the headers/functions/decls
8588 +dnl will be put only once into the 'configure' file. It keeps the size of
8589 +dnl the 'configure' file down, and avoids redundant output when 'configure'
8591 +dnl The drawback is that the checks cannot be conditionalized. If you write
8592 +dnl if some_condition; then gl_CHECK_HEADERS(stdlib.h); fi
8593 +dnl inside an AC_DEFUNed function, the gl_CHECK_HEADERS macro call expands to
8594 +dnl empty, and the check will be inserted before the body of the AC_DEFUNed
8597 +dnl The original code implemented AC_CHECK_HEADERS_ONCE and AC_CHECK_FUNCS_ONCE
8598 +dnl in terms of AC_DEFUN and AC_REQUIRE. This implementation uses diversions to
8599 +dnl named sections DEFAULTS and INIT_PREPARE in order to check all requested
8600 +dnl headers at once, thus reducing the size of 'configure'. It is known to work
8601 +dnl with autoconf 2.57..2.62 at least . The size reduction is ca. 9%.
8603 +dnl Autoconf version 2.59 plus gnulib is required; this file is not needed
8604 +dnl with Autoconf 2.60 or greater. But note that autoconf's implementation of
8605 +dnl AC_CHECK_DECLS_ONCE expects a comma-separated list of symbols as first
8609 +# AC_CHECK_HEADERS_ONCE(HEADER1 HEADER2 ...) is a once-only variant of
8610 +# AC_CHECK_HEADERS(HEADER1 HEADER2 ...).
8611 +AC_DEFUN([AC_CHECK_HEADERS_ONCE], [
8613 + m4_foreach_w([gl_HEADER_NAME], [$1], [
8614 + AC_DEFUN([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
8616 + m4_divert_text([INIT_PREPARE],
8617 + [gl_header_list="$gl_header_list gl_HEADER_NAME"])
8618 + gl_HEADERS_EXPANSION
8619 + AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_HEADER_NAME])),
8620 + [Define to 1 if you have the <]m4_defn([gl_HEADER_NAME])[> header file.])
8622 + AC_REQUIRE([gl_CHECK_HEADER_]m4_quote(translit(gl_HEADER_NAME,
8626 +m4_define([gl_HEADERS_EXPANSION], [
8627 + m4_divert_text([DEFAULTS], [gl_header_list=])
8628 + AC_CHECK_HEADERS([$gl_header_list])
8629 + m4_define([gl_HEADERS_EXPANSION], [])
8632 +# AC_CHECK_FUNCS_ONCE(FUNC1 FUNC2 ...) is a once-only variant of
8633 +# AC_CHECK_FUNCS(FUNC1 FUNC2 ...).
8634 +AC_DEFUN([AC_CHECK_FUNCS_ONCE], [
8636 + m4_foreach_w([gl_FUNC_NAME], [$1], [
8637 + AC_DEFUN([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]), [
8638 + m4_divert_text([INIT_PREPARE],
8639 + [gl_func_list="$gl_func_list gl_FUNC_NAME"])
8640 + gl_FUNCS_EXPANSION
8641 + AH_TEMPLATE(AS_TR_CPP([HAVE_]m4_defn([gl_FUNC_NAME])),
8642 + [Define to 1 if you have the `]m4_defn([gl_FUNC_NAME])[' function.])
8644 + AC_REQUIRE([gl_CHECK_FUNC_]m4_defn([gl_FUNC_NAME]))
8647 +m4_define([gl_FUNCS_EXPANSION], [
8648 + m4_divert_text([DEFAULTS], [gl_func_list=])
8649 + AC_CHECK_FUNCS([$gl_func_list])
8650 + m4_define([gl_FUNCS_EXPANSION], [])
8653 +# AC_CHECK_DECLS_ONCE(DECL1 DECL2 ...) is a once-only variant of
8654 +# AC_CHECK_DECLS(DECL1, DECL2, ...).
8655 +AC_DEFUN([AC_CHECK_DECLS_ONCE], [
8657 + m4_foreach_w([gl_DECL_NAME], [$1], [
8658 + AC_DEFUN([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]), [
8659 + AC_CHECK_DECLS(m4_defn([gl_DECL_NAME]))
8661 + AC_REQUIRE([gl_CHECK_DECL_]m4_defn([gl_DECL_NAME]))
8664 diff -urN popt-for-windows/m4/stdbool.m4 popt-for-windows-gnulib/m4/stdbool.m4
8665 --- popt-for-windows/m4/stdbool.m4 1970-01-01 01:00:00.000000000 +0100
8666 +++ popt-for-windows-gnulib/m4/stdbool.m4 2008-10-25 15:17:05.000000000 +0100
8668 +# Check for stdbool.h that conforms to C99.
8670 +dnl Copyright (C) 2002-2006 Free Software Foundation, Inc.
8671 +dnl This file is free software; the Free Software Foundation
8672 +dnl gives unlimited permission to copy and/or distribute it,
8673 +dnl with or without modifications, as long as this notice is preserved.
8675 +# Prepare for substituting <stdbool.h> if it is not supported.
8677 +AC_DEFUN([AM_STDBOOL_H],
8679 + AC_REQUIRE([AC_HEADER_STDBOOL])
8681 + # Define two additional variables used in the Makefile substitution.
8683 + if test "$ac_cv_header_stdbool_h" = yes; then
8686 + STDBOOL_H='stdbool.h'
8688 + AC_SUBST([STDBOOL_H])
8690 + if test "$ac_cv_type__Bool" = yes; then
8695 + AC_SUBST([HAVE__BOOL])
8698 +# AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future.
8699 +AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H])
8701 +# This macro is only needed in autoconf <= 2.59. Newer versions of autoconf
8702 +# have this macro built-in.
8704 +AC_DEFUN([AC_HEADER_STDBOOL],
8705 + [AC_CACHE_CHECK([for stdbool.h that conforms to C99],
8706 + [ac_cv_header_stdbool_h],
8709 + #include <stdbool.h>
8711 + "error: bool is not defined"
8714 + "error: false is not defined"
8717 + "error: false is not 0"
8720 + "error: true is not defined"
8723 + "error: true is not 1"
8725 + #ifndef __bool_true_false_are_defined
8726 + "error: __bool_true_false_are_defined is not defined"
8729 + struct s { _Bool s: 1; _Bool t; } s;
8731 + char a[true == 1 ? 1 : -1];
8732 + char b[false == 0 ? 1 : -1];
8733 + char c[__bool_true_false_are_defined == 1 ? 1 : -1];
8734 + char d[(bool) 0.5 == true ? 1 : -1];
8736 + char f[(_Bool) 0.0 == false ? 1 : -1];
8738 + char h[sizeof (_Bool)];
8739 + char i[sizeof s.t];
8740 + enum { j = false, k = true, l = false * true, m = true * 256 };
8742 + char o[sizeof n == m * sizeof n[0] ? 1 : -1];
8743 + char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
8744 + #if defined __xlc__ || defined __GNUC__
8745 + /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
8746 + reported by James Lemley on 2005-10-05; see
8747 + http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
8748 + This test is not quite right, since xlc is allowed to
8749 + reject this program, as the initializer for xlcbug is
8750 + not one of the forms that C requires support for.
8751 + However, doing the test right would require a run-time
8752 + test, and that would make cross-compilation harder.
8753 + Let us hope that IBM fixes the xlc bug, and also adds
8754 + support for this kind of constant expression. In the
8755 + meantime, this test will reject xlc, which is OK, since
8756 + our stdbool.h substitute should suffice. We also test
8757 + this with GCC, where it should work, to detect more
8758 + quickly whether someone messes up the test in the
8760 + char digs[] = "0123456789";
8761 + int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
8763 + /* Catch a bug in an HP-UX C compiler. See
8764 + http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
8765 + http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
8773 + /* Refer to every declared value, to avoid compiler optimizations. */
8774 + return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
8775 + + !m + !n + !o + !p + !q + !pq);
8777 + [ac_cv_header_stdbool_h=yes],
8778 + [ac_cv_header_stdbool_h=no])])
8779 + AC_CHECK_TYPES([_Bool])
8780 + if test $ac_cv_header_stdbool_h = yes; then
8781 + AC_DEFINE(HAVE_STDBOOL_H, 1, [Define to 1 if stdbool.h conforms to C99.])
8783 diff -urN popt-for-windows/m4/stdlib_h.m4 popt-for-windows-gnulib/m4/stdlib_h.m4
8784 --- popt-for-windows/m4/stdlib_h.m4 1970-01-01 01:00:00.000000000 +0100
8785 +++ popt-for-windows-gnulib/m4/stdlib_h.m4 2008-10-25 15:17:05.000000000 +0100
8787 +# stdlib_h.m4 serial 11
8788 +dnl Copyright (C) 2007, 2008 Free Software Foundation, Inc.
8789 +dnl This file is free software; the Free Software Foundation
8790 +dnl gives unlimited permission to copy and/or distribute it,
8791 +dnl with or without modifications, as long as this notice is preserved.
8793 +AC_DEFUN([gl_STDLIB_H],
8795 + AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
8796 + gl_CHECK_NEXT_HEADERS([stdlib.h])
8799 +AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
8801 + dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
8802 + AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
8803 + GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
8806 +AC_DEFUN([gl_STDLIB_H_DEFAULTS],
8808 + GNULIB_MALLOC_POSIX=0; AC_SUBST([GNULIB_MALLOC_POSIX])
8809 + GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX])
8810 + GNULIB_CALLOC_POSIX=0; AC_SUBST([GNULIB_CALLOC_POSIX])
8811 + GNULIB_ATOLL=0; AC_SUBST([GNULIB_ATOLL])
8812 + GNULIB_GETLOADAVG=0; AC_SUBST([GNULIB_GETLOADAVG])
8813 + GNULIB_GETSUBOPT=0; AC_SUBST([GNULIB_GETSUBOPT])
8814 + GNULIB_MKDTEMP=0; AC_SUBST([GNULIB_MKDTEMP])
8815 + GNULIB_MKSTEMP=0; AC_SUBST([GNULIB_MKSTEMP])
8816 + GNULIB_PUTENV=0; AC_SUBST([GNULIB_PUTENV])
8817 + GNULIB_RAND48=0; AC_SUBST([GNULIB_RAND48])
8818 + GNULIB_RANDOM_R=0; AC_SUBST([GNULIB_RANDOM_R])
8819 + GNULIB_RPMATCH=0; AC_SUBST([GNULIB_RPMATCH])
8820 + GNULIB_SETENV=0; AC_SUBST([GNULIB_SETENV])
8821 + GNULIB_STRTOD=0; AC_SUBST([GNULIB_STRTOD])
8822 + GNULIB_STRTOLL=0; AC_SUBST([GNULIB_STRTOLL])
8823 + GNULIB_STRTOULL=0; AC_SUBST([GNULIB_STRTOULL])
8824 + GNULIB_UNSETENV=0; AC_SUBST([GNULIB_UNSETENV])
8825 + dnl Assume proper GNU behavior unless another module says otherwise.
8826 + HAVE_ATOLL=1; AC_SUBST([HAVE_ATOLL])
8827 + HAVE_CALLOC_POSIX=1; AC_SUBST([HAVE_CALLOC_POSIX])
8828 + HAVE_GETSUBOPT=1; AC_SUBST([HAVE_GETSUBOPT])
8829 + HAVE_MALLOC_POSIX=1; AC_SUBST([HAVE_MALLOC_POSIX])
8830 + HAVE_MKDTEMP=1; AC_SUBST([HAVE_MKDTEMP])
8831 + HAVE_REALLOC_POSIX=1; AC_SUBST([HAVE_REALLOC_POSIX])
8832 + HAVE_RAND48=1; AC_SUBST([HAVE_RAND48])
8833 + HAVE_RANDOM_R=1; AC_SUBST([HAVE_RANDOM_R])
8834 + HAVE_RPMATCH=1; AC_SUBST([HAVE_RPMATCH])
8835 + HAVE_SETENV=1; AC_SUBST([HAVE_SETENV])
8836 + HAVE_STRTOD=1; AC_SUBST([HAVE_STRTOD])
8837 + HAVE_STRTOLL=1; AC_SUBST([HAVE_STRTOLL])
8838 + HAVE_STRTOULL=1; AC_SUBST([HAVE_STRTOULL])
8839 + HAVE_SYS_LOADAVG_H=0; AC_SUBST([HAVE_SYS_LOADAVG_H])
8840 + HAVE_UNSETENV=1; AC_SUBST([HAVE_UNSETENV])
8841 + HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG])
8842 + REPLACE_MKSTEMP=0; AC_SUBST([REPLACE_MKSTEMP])
8843 + REPLACE_PUTENV=0; AC_SUBST([REPLACE_PUTENV])
8844 + REPLACE_STRTOD=0; AC_SUBST([REPLACE_STRTOD])
8845 + VOID_UNSETENV=0; AC_SUBST([VOID_UNSETENV])
8847 diff -urN popt-for-windows/m4/strdup.m4 popt-for-windows-gnulib/m4/strdup.m4
8848 --- popt-for-windows/m4/strdup.m4 1970-01-01 01:00:00.000000000 +0100
8849 +++ popt-for-windows-gnulib/m4/strdup.m4 2008-10-25 15:17:05.000000000 +0100
8851 +# strdup.m4 serial 10
8853 +dnl Copyright (C) 2002-2008 Free Software Foundation, Inc.
8855 +dnl This file is free software; the Free Software Foundation
8856 +dnl gives unlimited permission to copy and/or distribute it,
8857 +dnl with or without modifications, as long as this notice is preserved.
8859 +AC_DEFUN([gl_FUNC_STRDUP],
8861 + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
8862 + AC_REPLACE_FUNCS(strdup)
8863 + AC_CHECK_DECLS_ONCE(strdup)
8864 + if test $ac_cv_have_decl_strdup = no; then
8865 + HAVE_DECL_STRDUP=0
8870 +AC_DEFUN([gl_FUNC_STRDUP_POSIX],
8872 + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
8873 + AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
8874 + if test $gl_cv_func_malloc_posix != yes; then
8876 + AC_LIBOBJ([strdup])
8878 + AC_REPLACE_FUNCS(strdup)
8880 + AC_CHECK_DECLS_ONCE(strdup)
8881 + if test $ac_cv_have_decl_strdup = no; then
8882 + HAVE_DECL_STRDUP=0
8887 +# Prerequisites of lib/strdup.c.
8888 +AC_DEFUN([gl_PREREQ_STRDUP], [:])
8889 diff -urN popt-for-windows/m4/string_h.m4 popt-for-windows-gnulib/m4/string_h.m4
8890 --- popt-for-windows/m4/string_h.m4 1970-01-01 01:00:00.000000000 +0100
8891 +++ popt-for-windows-gnulib/m4/string_h.m4 2008-10-25 15:17:05.000000000 +0100
8893 +# Configure a GNU-like replacement for <string.h>.
8895 +# Copyright (C) 2007, 2008 Free Software Foundation, Inc.
8896 +# This file is free software; the Free Software Foundation
8897 +# gives unlimited permission to copy and/or distribute it,
8898 +# with or without modifications, as long as this notice is preserved.
8902 +# Written by Paul Eggert.
8904 +AC_DEFUN([gl_HEADER_STRING_H],
8906 + dnl Use AC_REQUIRE here, so that the default behavior below is expanded
8907 + dnl once only, before all statements that occur in other macros.
8908 + AC_REQUIRE([gl_HEADER_STRING_H_BODY])
8911 +AC_DEFUN([gl_HEADER_STRING_H_BODY],
8913 + AC_REQUIRE([AC_C_RESTRICT])
8914 + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
8915 + gl_CHECK_NEXT_HEADERS([string.h])
8918 +AC_DEFUN([gl_STRING_MODULE_INDICATOR],
8920 + dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
8921 + AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
8922 + GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
8925 +AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
8927 + GNULIB_MEMMEM=0; AC_SUBST([GNULIB_MEMMEM])
8928 + GNULIB_MEMPCPY=0; AC_SUBST([GNULIB_MEMPCPY])
8929 + GNULIB_MEMRCHR=0; AC_SUBST([GNULIB_MEMRCHR])
8930 + GNULIB_RAWMEMCHR=0; AC_SUBST([GNULIB_RAWMEMCHR])
8931 + GNULIB_STPCPY=0; AC_SUBST([GNULIB_STPCPY])
8932 + GNULIB_STPNCPY=0; AC_SUBST([GNULIB_STPNCPY])
8933 + GNULIB_STRCHRNUL=0; AC_SUBST([GNULIB_STRCHRNUL])
8934 + GNULIB_STRDUP=0; AC_SUBST([GNULIB_STRDUP])
8935 + GNULIB_STRNDUP=0; AC_SUBST([GNULIB_STRNDUP])
8936 + GNULIB_STRNLEN=0; AC_SUBST([GNULIB_STRNLEN])
8937 + GNULIB_STRPBRK=0; AC_SUBST([GNULIB_STRPBRK])
8938 + GNULIB_STRSEP=0; AC_SUBST([GNULIB_STRSEP])
8939 + GNULIB_STRSTR=0; AC_SUBST([GNULIB_STRSTR])
8940 + GNULIB_STRCASESTR=0; AC_SUBST([GNULIB_STRCASESTR])
8941 + GNULIB_STRTOK_R=0; AC_SUBST([GNULIB_STRTOK_R])
8942 + GNULIB_MBSLEN=0; AC_SUBST([GNULIB_MBSLEN])
8943 + GNULIB_MBSNLEN=0; AC_SUBST([GNULIB_MBSNLEN])
8944 + GNULIB_MBSCHR=0; AC_SUBST([GNULIB_MBSCHR])
8945 + GNULIB_MBSRCHR=0; AC_SUBST([GNULIB_MBSRCHR])
8946 + GNULIB_MBSSTR=0; AC_SUBST([GNULIB_MBSSTR])
8947 + GNULIB_MBSCASECMP=0; AC_SUBST([GNULIB_MBSCASECMP])
8948 + GNULIB_MBSNCASECMP=0; AC_SUBST([GNULIB_MBSNCASECMP])
8949 + GNULIB_MBSPCASECMP=0; AC_SUBST([GNULIB_MBSPCASECMP])
8950 + GNULIB_MBSCASESTR=0; AC_SUBST([GNULIB_MBSCASESTR])
8951 + GNULIB_MBSCSPN=0; AC_SUBST([GNULIB_MBSCSPN])
8952 + GNULIB_MBSPBRK=0; AC_SUBST([GNULIB_MBSPBRK])
8953 + GNULIB_MBSSPN=0; AC_SUBST([GNULIB_MBSSPN])
8954 + GNULIB_MBSSEP=0; AC_SUBST([GNULIB_MBSSEP])
8955 + GNULIB_MBSTOK_R=0; AC_SUBST([GNULIB_MBSTOK_R])
8956 + GNULIB_STRERROR=0; AC_SUBST([GNULIB_STRERROR])
8957 + GNULIB_STRSIGNAL=0; AC_SUBST([GNULIB_STRSIGNAL])
8958 + GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP])
8959 + dnl Assume proper GNU behavior unless another module says otherwise.
8960 + HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM])
8961 + HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY])
8962 + HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR])
8963 + HAVE_RAWMEMCHR=1; AC_SUBST([HAVE_RAWMEMCHR])
8964 + HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY])
8965 + HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY])
8966 + HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL])
8967 + HAVE_DECL_STRDUP=1; AC_SUBST([HAVE_DECL_STRDUP])
8968 + HAVE_STRNDUP=1; AC_SUBST([HAVE_STRNDUP])
8969 + HAVE_DECL_STRNDUP=1; AC_SUBST([HAVE_DECL_STRNDUP])
8970 + HAVE_DECL_STRNLEN=1; AC_SUBST([HAVE_DECL_STRNLEN])
8971 + HAVE_STRPBRK=1; AC_SUBST([HAVE_STRPBRK])
8972 + HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP])
8973 + HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR])
8974 + HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R])
8975 + HAVE_DECL_STRERROR=1; AC_SUBST([HAVE_DECL_STRERROR])
8976 + HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL])
8977 + HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP])
8978 + REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM])
8979 + REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP])
8980 + REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR])
8981 + REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR])
8982 + REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR])
8983 + REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL])
8985 diff -urN popt-for-windows/m4/sys_stat_h.m4 popt-for-windows-gnulib/m4/sys_stat_h.m4
8986 --- popt-for-windows/m4/sys_stat_h.m4 1970-01-01 01:00:00.000000000 +0100
8987 +++ popt-for-windows-gnulib/m4/sys_stat_h.m4 2008-10-25 15:17:05.000000000 +0100
8989 +# sys_stat_h.m4 serial 10 -*- Autoconf -*-
8990 +dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
8991 +dnl This file is free software; the Free Software Foundation
8992 +dnl gives unlimited permission to copy and/or distribute it,
8993 +dnl with or without modifications, as long as this notice is preserved.
8995 +dnl From Eric Blake.
8996 +dnl Test whether <sys/stat.h> contains lstat and mkdir or must be substituted.
8998 +AC_DEFUN([gl_HEADER_SYS_STAT_H],
9000 + AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
9002 + dnl Check for lstat. Systems that lack it (mingw) also lack symlinks, so
9003 + dnl stat is a good replacement.
9004 + AC_CHECK_FUNCS_ONCE([lstat])
9005 + if test $ac_cv_func_lstat = yes; then
9010 + AC_SUBST([HAVE_LSTAT])
9012 + dnl For the mkdir substitute.
9013 + AC_REQUIRE([AC_C_INLINE])
9015 + dnl Check for broken stat macros.
9016 + AC_REQUIRE([AC_HEADER_STAT])
9018 + gl_CHECK_NEXT_HEADERS([sys/stat.h])
9019 + SYS_STAT_H='sys/stat.h'
9020 + AC_SUBST([SYS_STAT_H])
9022 + dnl Define types that are supposed to be defined in <sys/types.h> or
9024 + AC_CHECK_TYPE([nlink_t], [],
9025 + [AC_DEFINE([nlink_t], [int],
9026 + [Define to the type of st_nlink in struct stat, or a supertype.])],
9027 + [#include <sys/types.h>
9028 + #include <sys/stat.h>])
9030 +]) # gl_HEADER_SYS_STAT_H
9032 +AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
9034 + dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
9035 + AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
9036 + GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
9039 +AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
9041 + GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD])
9042 + GNULIB_LSTAT=0; AC_SUBST([GNULIB_LSTAT])
9043 + dnl Assume proper GNU behavior unless another module says otherwise.
9044 + HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD])
9045 + REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT])
9046 + REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR])
9048 diff -urN popt-for-windows/m4/unistd_h.m4 popt-for-windows-gnulib/m4/unistd_h.m4
9049 --- popt-for-windows/m4/unistd_h.m4 1970-01-01 01:00:00.000000000 +0100
9050 +++ popt-for-windows-gnulib/m4/unistd_h.m4 2008-10-25 15:17:05.000000000 +0100
9052 +# unistd_h.m4 serial 16
9053 +dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
9054 +dnl This file is free software; the Free Software Foundation
9055 +dnl gives unlimited permission to copy and/or distribute it,
9056 +dnl with or without modifications, as long as this notice is preserved.
9058 +dnl Written by Simon Josefsson, Bruno Haible.
9060 +AC_DEFUN([gl_UNISTD_H],
9062 + dnl Use AC_REQUIRE here, so that the default behavior below is expanded
9063 + dnl once only, before all statements that occur in other macros.
9064 + AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
9066 + gl_CHECK_NEXT_HEADERS([unistd.h])
9068 + AC_CHECK_HEADERS_ONCE([unistd.h])
9069 + if test $ac_cv_header_unistd_h = yes; then
9074 + AC_SUBST([HAVE_UNISTD_H])
9077 +AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
9079 + dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
9080 + AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
9081 + GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
9084 +AC_DEFUN([gl_UNISTD_H_DEFAULTS],
9086 + GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN])
9087 + GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE])
9088 + GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2])
9089 + GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON])
9090 + GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS])
9091 + GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR])
9092 + GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC])
9093 + GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE])
9094 + GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD])
9095 + GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME])
9096 + GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE])
9097 + GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME])
9098 + GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R])
9099 + GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE])
9100 + GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL])
9101 + GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN])
9102 + GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK])
9103 + GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK])
9104 + GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP])
9105 + GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE])
9106 + GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE])
9107 + dnl Assume proper GNU behavior unless another module says otherwise.
9108 + HAVE_DUP2=1; AC_SUBST([HAVE_DUP2])
9109 + HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS])
9110 + HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC])
9111 + HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE])
9112 + HAVE_GETDOMAINNAME=1; AC_SUBST([HAVE_GETDOMAINNAME])
9113 + HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE])
9114 + HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME])
9115 + HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE])
9116 + HAVE_GETUSERSHELL=1; AC_SUBST([HAVE_GETUSERSHELL])
9117 + HAVE_READLINK=1; AC_SUBST([HAVE_READLINK])
9118 + HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP])
9119 + HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON])
9120 + HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R])
9121 + HAVE_OS_H=0; AC_SUBST([HAVE_OS_H])
9122 + HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H])
9123 + REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN])
9124 + REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE])
9125 + REPLACE_FCHDIR=0; AC_SUBST([REPLACE_FCHDIR])
9126 + REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD])
9127 + REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE])
9128 + REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN])
9129 + REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK])
9130 + REPLACE_WRITE=0; AC_SUBST([REPLACE_WRITE])
9131 + UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H])
9133 diff -urN popt-for-windows/m4/wchar.m4 popt-for-windows-gnulib/m4/wchar.m4
9134 --- popt-for-windows/m4/wchar.m4 1970-01-01 01:00:00.000000000 +0100
9135 +++ popt-for-windows-gnulib/m4/wchar.m4 2008-10-25 15:17:05.000000000 +0100
9137 +dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
9139 +dnl Copyright (C) 2007-2008 Free Software Foundation, Inc.
9140 +dnl This file is free software; the Free Software Foundation
9141 +dnl gives unlimited permission to copy and/or distribute it,
9142 +dnl with or without modifications, as long as this notice is preserved.
9144 +dnl Written by Eric Blake.
9146 +# wchar.m4 serial 6
9148 +AC_DEFUN([gl_WCHAR_H],
9150 + AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
9151 + AC_CACHE_CHECK([whether <wchar.h> is standalone],
9152 + [gl_cv_header_wchar_h_standalone],
9153 + [AC_COMPILE_IFELSE([[#include <wchar.h>
9155 + [gl_cv_header_wchar_h_standalone=yes],
9156 + [gl_cv_header_wchar_h_standalone=no])])
9158 + AC_REQUIRE([gt_TYPE_WINT_T])
9159 + if test $gt_cv_c_wint_t = yes; then
9164 + AC_SUBST([HAVE_WINT_T])
9166 + if test $gl_cv_header_wchar_h_standalone != yes || test $gt_cv_c_wint_t != yes; then
9170 + dnl Prepare for creating substitute <wchar.h>.
9171 + dnl Do it always: WCHAR_H may be empty here but can be set later.
9172 + dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
9173 + dnl character support).
9174 + AC_CHECK_HEADERS_ONCE([wchar.h])
9175 + if test $ac_cv_header_wchar_h = yes; then
9180 + AC_SUBST([HAVE_WCHAR_H])
9181 + gl_CHECK_NEXT_HEADERS([wchar.h])
9184 +dnl Unconditionally enables the replacement of <wchar.h>.
9185 +AC_DEFUN([gl_REPLACE_WCHAR_H],
9187 + AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
9191 +AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
9193 + dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
9194 + AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
9195 + GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
9198 +AC_DEFUN([gl_WCHAR_H_DEFAULTS],
9200 + GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH])
9201 + dnl Assume proper GNU behavior unless another module says otherwise.
9202 + HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH])
9203 + REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH])
9204 + WCHAR_H=''; AC_SUBST([WCHAR_H])
9206 diff -urN popt-for-windows/m4/wctype.m4 popt-for-windows-gnulib/m4/wctype.m4
9207 --- popt-for-windows/m4/wctype.m4 1970-01-01 01:00:00.000000000 +0100
9208 +++ popt-for-windows-gnulib/m4/wctype.m4 2008-10-25 15:17:05.000000000 +0100
9210 +# wctype.m4 serial 2
9212 +dnl A placeholder for ISO C99 <wctype.h>, for platforms that lack it.
9214 +dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
9215 +dnl This file is free software; the Free Software Foundation
9216 +dnl gives unlimited permission to copy and/or distribute it,
9217 +dnl with or without modifications, as long as this notice is preserved.
9219 +dnl Written by Paul Eggert.
9221 +AC_DEFUN([gl_WCTYPE_H],
9223 + AC_REQUIRE([AC_PROG_CC])
9224 + AC_CHECK_FUNCS_ONCE([iswcntrl])
9225 + if test $ac_cv_func_iswcntrl = yes; then
9230 + AC_SUBST([HAVE_ISWCNTRL])
9231 + AC_CHECK_HEADERS_ONCE([wctype.h])
9232 + AC_REQUIRE([AC_C_INLINE])
9234 + AC_REQUIRE([gt_TYPE_WINT_T])
9235 + if test $gt_cv_c_wint_t = yes; then
9240 + AC_SUBST([HAVE_WINT_T])
9243 + if test $ac_cv_header_wctype_h = yes; then
9244 + if test $ac_cv_func_iswcntrl = yes; then
9245 + dnl Linux libc5 has an iswprint function that returns 0 for all arguments.
9246 + dnl The other functions are likely broken in the same way.
9247 + AC_CACHE_CHECK([whether iswcntrl works], [gl_cv_func_iswcntrl_works],
9249 + AC_TRY_RUN([#include <stddef.h>
9250 + #include <stdio.h>
9252 + #include <wchar.h>
9253 + #include <wctype.h>
9254 + int main () { return iswprint ('x') == 0; }],
9255 + [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no],
9256 + [AC_TRY_COMPILE([#include <stdlib.h>
9257 + #if __GNU_LIBRARY__ == 1
9258 + Linux libc5 i18n is broken.
9260 + [gl_cv_func_iswcntrl_works=yes], [gl_cv_func_iswcntrl_works=no])
9263 + if test $gl_cv_func_iswcntrl_works = yes; then
9267 + dnl Compute NEXT_WCTYPE_H even if WCTYPE_H is empty,
9268 + dnl for the benefit of builds from non-distclean directories.
9269 + gl_CHECK_NEXT_HEADERS([wctype.h])
9274 + AC_SUBST([HAVE_WCTYPE_H])
9275 + AC_SUBST([WCTYPE_H])
9277 + if test "$gl_cv_func_iswcntrl_works" = no; then
9278 + REPLACE_ISWCNTRL=1
9280 + REPLACE_ISWCNTRL=0
9282 + AC_SUBST([REPLACE_ISWCNTRL])
9284 diff -urN popt-for-windows/m4/wint_t.m4 popt-for-windows-gnulib/m4/wint_t.m4
9285 --- popt-for-windows/m4/wint_t.m4 1970-01-01 01:00:00.000000000 +0100
9286 +++ popt-for-windows-gnulib/m4/wint_t.m4 2008-10-25 15:17:05.000000000 +0100
9288 +# wint_t.m4 serial 2 (gettext-0.17)
9289 +dnl Copyright (C) 2003, 2007 Free Software Foundation, Inc.
9290 +dnl This file is free software; the Free Software Foundation
9291 +dnl gives unlimited permission to copy and/or distribute it,
9292 +dnl with or without modifications, as long as this notice is preserved.
9294 +dnl From Bruno Haible.
9295 +dnl Test whether <wchar.h> has the 'wint_t' type.
9296 +dnl Prerequisite: AC_PROG_CC
9298 +AC_DEFUN([gt_TYPE_WINT_T],
9300 + AC_CACHE_CHECK([for wint_t], gt_cv_c_wint_t,
9302 +/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
9304 + BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
9305 + before <wchar.h>. */
9306 +#include <stddef.h>
9310 + wint_t foo = (wchar_t)'\0';], ,
9311 + gt_cv_c_wint_t=yes, gt_cv_c_wint_t=no)])
9312 + if test $gt_cv_c_wint_t = yes; then
9313 + AC_DEFINE(HAVE_WINT_T, 1, [Define if you have the 'wint_t' type.])