summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-core
diff options
context:
space:
mode:
authorKoen Kooi <koen@dominion.thruhere.net>2011-05-27 08:12:25 +0200
committerKoen Kooi <koen@dominion.thruhere.net>2011-05-27 08:12:25 +0200
commit6f67d69d41ec496248d0122f8ecd3a015f8d6a83 (patch)
tree90f6c32d817732b4fef97cac30e377892737eea1 /meta-oe/recipes-core
parentd98d1f8b11c8cba8664032cb900918a545382a1e (diff)
downloadmeta-openembedded-6f67d69d41ec496248d0122f8ecd3a015f8d6a83.tar.gz
uclibc: moved into OE-core, delete from meta-oe
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Diffstat (limited to 'meta-oe/recipes-core')
-rw-r--r--meta-oe/recipes-core/uclibc/site_config/funcs474
-rw-r--r--meta-oe/recipes-core/uclibc/site_config/headers156
-rw-r--r--meta-oe/recipes-core/uclibc/site_config/types21
-rw-r--r--meta-oe/recipes-core/uclibc/uClibc.distro157
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-config.inc116
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/argp-headers.patch581
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/argp-support.patch5189
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/arm/uClibc.machine69
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/armeb/uClibc.machine53
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/armv5te/uClibc.machine76
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/detect-bx-availibility.patch75
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/efika/uClibc.machine45
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/i386/uClibc.machine59
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/i486/uClibc.machine62
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/i586/uClibc.machine62
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/i686/uClibc.machine59
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/include-arm-asm.h.patch65
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/ldso_use_arm_dl_linux_resolve_in_thumb_mode.patch21
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/mips64/uClibc.machine63
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/mipsel/uClibc.machine63
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/nslu2be/uClibc.machine73
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/powerpc/uClibc.machine46
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/powerpc_copysignl.patch107
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/qemuarm/uClibc.machine76
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/qemumips/uClibc.machine63
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/qemux86/uClibc.machine59
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/remove-eabi-oabi-selection.patch91
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/remove-sub-arch-variants.patch215
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/remove_attribute_optimize_Os.patch186
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/reorder-use-BX.patch72
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/select-force-thumb.patch172
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/sh4/uClibc.machine48
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/transform-eabi-oabi-choice.patch71
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/uClibc.config0
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/uClibc.distro160
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/uclibc-arm-ftruncate64.patch13
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/uclibc_enable_log2_test.patch30
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-git/x86_64/uClibc.machine42
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc-initial_git.bb39
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc.inc215
-rw-r--r--meta-oe/recipes-core/uclibc/uclibc_git.bb31
41 files changed, 0 insertions, 9275 deletions
diff --git a/meta-oe/recipes-core/uclibc/site_config/funcs b/meta-oe/recipes-core/uclibc/site_config/funcs
deleted file mode 100644
index ccc85392d..000000000
--- a/meta-oe/recipes-core/uclibc/site_config/funcs
+++ /dev/null
@@ -1,474 +0,0 @@
1a64l
2abs
3access
4__adjtimex
5alarm
6alphasort
7argz_append
8__argz_count
9argz_create_sep
10argz_insert
11__argz_next
12argz_next
13__argz_stringify
14argz_stringify
15asprintf
16atexit
17atof
18atoi
19bcmp
20bcopy
21bindresvport
22bind_textdomain_codeset
23btowc
24bzero
25calloc
26canonicalize_file_name
27catgets
28cfgetospeed
29cfsetispeed
30cfsetspeed
31chmod
32chown
33chroot
34clock
35close
36closedir
37closelog
38confstr
39connect
40daemon
41dcgettext
42difftime
43dirfd
44dirname
45dngettext
46dup2
47ecvt
48endgrent
49endmntent
50endpwent
51endutent
52endutxent
53epoll_ctl
54err
55ether_hostton
56ether_ntohost
57euidaccess
58execv
59fchdir
60fchmod
61fchmodat
62fchown
63fchownat
64fcntl
65fcvt
66fdatasync
67fdopendir
68feof_unlocked
69fgets_unlocked
70fgetxattr
71finite
72flistxattr
73flock
74flockfile
75fnmatch
76fork
77fpathconf
78__fpending
79fprintf
80free
81freeaddrinfo
82freeifaddrs
83fseeko
84__fsetlocking
85fsetxattr
86fstat64
87fstat
88fstatfs
89fsync
90ftello
91ftime
92ftruncate
93funlockfile
94futimes
95futimesat
96gai_strerror
97gcvt
98getaddrinfo
99getc_unlocked
100getcwd
101getdelim
102getdomainname
103getdtablesize
104getegid
105getenv
106geteuid
107getgid
108getgrent
109getgrent_r
110getgrgid_r
111getgrnam
112getgrnam_r
113getgrouplist
114getgroups
115gethostbyaddr_r
116gethostbyname2
117gethostbyname
118gethostbyname_r
119gethostent
120gethostid
121gethostname
122getifaddrs
123getline
124getloadavg
125getmntent
126getmsg
127getnameinfo
128getnetbyaddr_r
129getnetgrent_r
130getopt
131getopt_long
132getopt_long_only
133getpagesize
134getpass
135getpeername
136getpgrp
137getpid
138getppid
139getprotoent_r
140getpwent
141getpwent_r
142getpwnam
143getpwnam_r
144getpwuid
145getpwuid_r
146getresuid
147getrlimit
148getrusage
149getservbyname
150getservbyname_r
151getservbyport_r
152getservent
153getservent_r
154getspnam
155getspnam_r
156gettimeofday
157getttyent
158getttynam
159getuid
160getusershell
161getutent
162getutid
163getutline
164getutmp
165getutmpx
166getutxent
167getutxid
168getutxline
169getwd
170getxattr
171glob
172gmtime
173gmtime_r
174grantpt
175group_member
176herror
177hstrerror
178iconv
179iconv_open
180if_freenameindex
181if_indextoname
182if_nameindex
183if_nametoindex
184index
185inet_addr
186inet_aton
187inet_ntoa
188inet_ntop
189inet_pton
190initgroups
191innetgr
192iruserok
193isascii
194isatty
195isblank
196isgraph
197isinf
198isnan
199isprint
200isspace
201iswalnum
202iswcntrl
203iswctype
204iswprint
205iswspace
206iswupper
207isxdigit
208kill
209killpg
210lchown
211lckpwdf
212lgetxattr
213link
214listxattr
215llistxattr
216localtime
217localtime_r
218lockf
219lrand48
220lsearch
221lseek64
222lsetxattr
223lstat
224mallinfo
225malloc
226mblen
227mbrlen
228mbrtowc
229mbsinit
230mbsrtowcs
231mbtowc
232memalign
233memchr
234memcmp
235memcpy
236memmove
237mempcpy
238memrchr
239memset
240mkdir
241mkdirat
242mkdtemp
243mkfifo
244mknod
245mkstemp64
246mkstemp
247mktime
248mlock
249mmap
250mtrace
251munlock
252munmap
253nanosleep
254nice
255nl_langinfo
256ntp_adjtime
257ntp_gettime
258_obstack_free
259on_exit
260open64
261open
262openat
263opendir
264openlog
265pathconf
266pipe
267poll
268popen
269posix_memalign
270prctl
271pread
272printf
273__progname
274pselect
275pthread_mutex_lock
276ptsname
277putenv
278putgrent
279putpwent
280putspent
281pututline
282pututxline
283putwc
284pwrite
285qsort
286raise
287rand
288random
289rand_r
290read
291readdir
292readdir_r
293readlink
294realloc
295realpath
296re_comp
297recvmsg
298re_exec
299regcomp
300regexec
301remove
302rename
303re_search
304rmdir
305rpmatch
306rresvport_af
307ruserok
308ruserok_af
309sbrk
310scandir
311sched_setscheduler
312sched_yield
313__secure_getenv
314select
315semctl
316semget
317sendmsg
318setbuf
319setbuffer
320setegid
321setenv
322seteuid
323setgid
324setgroups
325sethostname
326setitimer
327_setjmp
328setjmp
329setlinebuf
330setlocale
331setmntent
332setpgid
333setpgrp
334setpriority
335setregid
336setresgid
337setresuid
338setreuid
339setrlimit
340setsid
341setsockopt
342settimeofday
343setuid
344setutent
345setutxent
346setvbuf
347setxattr
348sgetspent
349shmat
350shmctl
351shmdt
352shmget
353shutdown
354sigaction
355sigaddset
356sigaltstack
357sigblock
358sigemptyset
359sighold
360siginterrupt
361signal
362sigprocmask
363sigset
364sigsetmask
365sigstack
366sigsuspend
367sigvec
368snprintf
369socket
370socketpair
371sprintf
372srand48
373srand
374srandom
375sscanf
376stat
377statfs
378statvfs
379stime
380stpcpy
381strcasecmp
382strcasestr
383strchr
384strchrnul
385strcmp
386strcspn
387strdup
388strerror
389strerror_r
390strftime
391strlen
392strncasecmp
393strncmp
394strndup
395strnlen
396strpbrk
397strptime
398strrchr
399strsep
400strsignal
401strspn
402strstr
403strtod
404strtoimax
405strtok_r
406strtol
407strtoll
408strtoul
409strtoull
410strtoumax
411strverscmp
412strxfrm
413symlink
414sync
415sysconf
416sysctl
417sysinfo
418syslog
419_sys_siglist
420sys_siglist
421system
422tcgetattr
423tcgetpgrp
424tcsetattr
425tcsetpgrp
426time
427timegm
428times
429timezone
430tmpnam
431towlower
432towupper
433truncate
434tsearch
435ttyname
436tzset
437ulimit
438umask
439uname
440unlink
441unsetenv
442unshare
443updwtmp
444updwtmpx
445usleep
446ustat
447utime
448utimes
449utmpname
450utmpxname
451valloc
452vasprintf
453verrx
454vfork
455vfprintf
456vfscanf
457vhangup
458vprintf
459vsnprintf
460vsprintf
461wait3
462wait4
463waitpid
464wcrtomb
465wcscoll
466wcsdup
467wcslen
468wctob
469wctomb
470wctype
471wcwidth
472wmemchr
473wmemcpy
474wmempcpy
diff --git a/meta-oe/recipes-core/uclibc/site_config/headers b/meta-oe/recipes-core/uclibc/site_config/headers
deleted file mode 100644
index 609ab5379..000000000
--- a/meta-oe/recipes-core/uclibc/site_config/headers
+++ /dev/null
@@ -1,156 +0,0 @@
1aio.h
2alloca.h
3argz.h
4arpa/inet.h
5arpa/nameser.h
6asm/byteorder.h
7asm/ioctls.h
8asm/page.h
9asm/types.h
10assert.h
11byteswap.h
12crypt.h
13ctype.h
14dirent.h
15dlfcn.h
16elf.h
17endian.h
18err.h
19errno.h
20execinfo.h
21fcntl.h
22features.h
23float.h
24fstab.h
25ftw.h
26getopt.h
27glob.h
28grp.h
29iconv.h
30ifaddrs.h
31inttypes.h
32langinfo.h
33lastlog.h
34libgen.h
35libintl.h
36limits.h
37linux/capability.h
38linux/fd.h
39linux/fs.h
40linux/hayesesp.h
41linux/hdreg.h
42linux/icmp.h
43linux/in6.h
44linux/joystick.h
45linux/ptrace.h
46linux/serial.h
47linux/sonypi.h
48linux/unistd.h
49linux/utsname.h
50linux/version.h
51locale.h
52malloc.h
53math.h
54mcheck.h
55memory.h
56mntent.h
57mqueue.h
58netdb.h
59net/if.h
60netinet/ether.h
61netinet/in.h
62netinet/ip6.h
63netinet/ip.h
64netinet/tcp.h
65netinet/udp.h
66netipx/ipx.h
67net/route.h
68paths.h
69poll.h
70pthread.h
71pty.h
72pwd.h
73regex.h
74resolv.h
75rpc/rpc.h
76rpc/types.h
77sched.h
78scsi/scsi.h
79search.h
80semaphore.h
81setjmp.h
82sgtty.h
83shadow.h
84signal.h
85stdarg.h
86stdbool.h
87stdc
88stddef.h
89stdint.h
90stdio.h
91stdlib.h
92string.h
93strings.h
94stropts.h
95sys/bitypes.h
96sys/cdefs.h
97sys/dir.h
98sys/epoll.h
99sysexits.h
100sys/fcntl.h
101sys/file.h
102sys/fsuid.h
103sys/ioctl.h
104sys/ipc.h
105syslog.h
106sys/mman.h
107sys/mount.h
108sys/mtio.h
109sys/param.h
110sys/poll.h
111sys/prctl.h
112sys/ptrace.h
113sys/queue.h
114sys/reg.h
115sys/resource.h
116sys/select.h
117sys/sem.h
118sys/shm.h
119sys/signal.h
120sys/socket.h
121sys/socketvar.h
122sys/soundcard.h
123sys/statfs.h
124sys/stat.h
125sys/statvfs.h
126sys/stropts.h
127sys/swap.h
128sys/sysctl.h
129sys/sysinfo.h
130sys/sysmacros.h
131sys/termios.h
132sys/timeb.h
133sys/time.h
134sys/times.h
135sys/timex.h
136sys/types.h
137sys/uio.h
138sys/un.h
139sys/unistd.h
140sys/user.h
141sys/utsname.h
142sys/vfs.h
143sys/wait.h
144termio.h
145termios.h
146time.h
147ttyent.h
148ulimit.h
149unistd.h
150ustat.h
151utime.h
152utmp.h
153utmpx.h
154values.h
155wchar.h
156wctype.h
diff --git a/meta-oe/recipes-core/uclibc/site_config/types b/meta-oe/recipes-core/uclibc/site_config/types
deleted file mode 100644
index 178bd85a0..000000000
--- a/meta-oe/recipes-core/uclibc/site_config/types
+++ /dev/null
@@ -1,21 +0,0 @@
1char
2char *
3double
4float
5int
6long
7long double
8long int
9long long
10long long int
11short
12short int
13signed char
14unsigned char
15unsigned int
16unsigned long
17unsigned long int
18unsigned long long int
19unsigned short
20unsigned short int
21void *
diff --git a/meta-oe/recipes-core/uclibc/uClibc.distro b/meta-oe/recipes-core/uclibc/uClibc.distro
deleted file mode 100644
index e25324d3d..000000000
--- a/meta-oe/recipes-core/uclibc/uClibc.distro
+++ /dev/null
@@ -1,157 +0,0 @@
1#
2# General Library Settings
3#
4# HAVE_NO_PIC is not set
5# DOPIC is not set
6# HAVE_NO_SHARED is not set
7# ARCH_HAS_NO_LDSO is not set
8HAVE_SHARED=y
9# FORCE_SHAREABLE_TEXT_SEGMENTS is not set
10LDSO_LDD_SUPPORT=y
11LDSO_CACHE_SUPPORT=y
12# LDSO_PRELOAD_FILE_SUPPORT is not set
13LDSO_BASE_FILENAME="ld.so"
14# UCLIBC_STATIC_LDCONFIG is not set
15LDSO_RUNPATH=y
16UCLIBC_CTOR_DTOR=y
17LDSO_GNU_HASH_SUPPORT=y
18# HAS_NO_THREADS is not set
19UCLIBC_HAS_THREADS=y
20UCLIBC_HAS_THREADS_NATIVE=y
21PTHREADS_DEBUG_SUPPORT=y
22# LINUXTHREADS_OLD is not set
23UCLIBC_HAS_LFS=y
24# MALLOC is not set
25# MALLOC_SIMPLE is not set
26MALLOC_STANDARD=y
27MALLOC_GLIBC_COMPAT=y
28UCLIBC_DYNAMIC_ATEXIT=y
29COMPAT_ATEXIT=y
30UCLIBC_SUSV3_LEGACY=y
31UCLIBC_SUSV3_LEGACY_MACROS=y
32UCLIBC_SUSV4_LEGACY=y
33UCLIBC_HAS_SHADOW=y
34UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y
35UCLIBC_HAS___PROGNAME=y
36UNIX98PTY_ONLY=y
37ASSUME_DEVPTS=y
38UCLIBC_HAS_LIBUTIL=y
39UCLIBC_HAS_TM_EXTENSIONS=y
40UCLIBC_HAS_TZ_CACHING=y
41UCLIBC_HAS_TZ_FILE=y
42UCLIBC_HAS_TZ_FILE_READ_MANY=y
43UCLIBC_TZ_FILE_PATH="/etc/TZ"
44
45#
46# Advanced Library Settings
47#
48UCLIBC_PWD_BUFFER_SIZE=256
49UCLIBC_GRP_BUFFER_SIZE=256
50
51#
52# Networking Support
53#
54UCLIBC_HAS_IPV6=y
55UCLIBC_HAS_RPC=y
56UCLIBC_HAS_FULL_RPC=y
57# UCLIBC_HAS_REENTRANT_RPC is not set
58UCLIBC_USE_NETLINK=y
59UCLIBC_SUPPORT_AI_ADDRCONFIG=y
60
61UCLIBC_HAS_BSD_RES_CLOSE=y
62UCLIBC_HAS_LIBRESOLV_STUB=y
63UCLIBC_HAS_LIBNSL_STUB=y
64
65#
66# String and Stdio Support
67#
68UCLIBC_HAS_STRING_GENERIC_OPT=y
69UCLIBC_HAS_STRING_ARCH_OPT=y
70UCLIBC_HAS_CTYPE_TABLES=y
71UCLIBC_HAS_CTYPE_SIGNED=y
72# UCLIBC_HAS_CTYPE_UNSAFE is not set
73UCLIBC_HAS_CTYPE_CHECKED=y
74# UCLIBC_HAS_CTYPE_ENFORCED is not set
75UCLIBC_HAS_WCHAR=y
76# UCLIBC_HAS_LOCALE is not set
77UCLIBC_HAS_HEXADECIMAL_FLOATS=y
78UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y
79UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9
80UCLIBC_HAS_SCANF_GLIBC_A_FLAG=y
81# UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set
82UCLIBC_HAS_STDIO_BUFSIZ_256=y
83# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set
84# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set
85# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set
86# UCLIBC_HAS_STDIO_BUFSIZ_4096 is not set
87# UCLIBC_HAS_STDIO_BUFSIZ_8192 is not set
88UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y
89# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set
90# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set
91# UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT is not set
92UCLIBC_HAS_STDIO_GETC_MACRO=y
93UCLIBC_HAS_STDIO_PUTC_MACRO=y
94UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y
95# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set
96UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y
97UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
98UCLIBC_HAS_PRINTF_M_SPEC=y
99UCLIBC_HAS_ERRNO_MESSAGES=y
100# UCLIBC_HAS_SYS_ERRLIST is not set
101UCLIBC_HAS_SIGNUM_MESSAGES=y
102# UCLIBC_HAS_SYS_SIGLIST is not set
103UCLIBC_HAS_GNU_GETOPT=y
104UCLIBC_HAS_GNU_GETSUBOPT=y
105
106#
107# Big and Tall
108#
109UCLIBC_HAS_REGEX=y
110# UCLIBC_HAS_REGEX_OLD is not set
111UCLIBC_HAS_FNMATCH=y
112# UCLIBC_HAS_FNMATCH_OLD is not set
113UCLIBC_HAS_WORDEXP=y
114UCLIBC_HAS_NFTW=y
115UCLIBC_HAS_FTW=y
116UCLIBC_HAS_FTS=y
117UCLIBC_HAS_GLOB=y
118UCLIBC_HAS_GNU_GLOB=y
119
120#
121# Library Installation Options
122#
123SHARED_LIB_LOADER_PREFIX="/lib"
124RUNTIME_PREFIX="/"
125DEVEL_PREFIX="//usr"
126
127#
128# Security options
129#
130# UCLIBC_BUILD_PIE is not set
131# UCLIBC_HAS_ARC4RANDOM is not set
132# HAVE_NO_SSP is not set
133# UCLIBC_HAS_SSP is not set
134UCLIBC_BUILD_RELRO=y
135UCLIBC_BUILD_NOW=y
136UCLIBC_BUILD_NOEXECSTACK=y
137
138#
139# uClibc development/debugging options
140#
141CROSS_COMPILER_PREFIX=""
142UCLIBC_EXTRA_CFLAGS=""
143# DODEBUG is not set
144# DODEBUG_PT is not set
145# DOSTRIP is not set
146# DOASSERTS is not set
147# SUPPORT_LD_DEBUG is not set
148# SUPPORT_LD_DEBUG_EARLY is not set
149# UCLIBC_MALLOC_DEBUGGING is not set
150WARNINGS="-Wall"
151# EXTRA_WARNINGS is not set
152# DOMULTI is not set
153# UCLIBC_MJN3_ONLY is not set
154
155# math stuff for perl
156DO_C99_MATH=y
157UCLIBC_HAS_LONG_DOUBLE_MATH=y
diff --git a/meta-oe/recipes-core/uclibc/uclibc-config.inc b/meta-oe/recipes-core/uclibc/uclibc-config.inc
deleted file mode 100644
index 3679c104c..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-config.inc
+++ /dev/null
@@ -1,116 +0,0 @@
1#
2# Set the ARCH environment variable for uClibc compilation.
3# Return value must match one of the architectures known to uClibc:
4# libc/sysdeps/*/*
5#
6
7valid_archs = "\
8alpha \
9arm \
10avr32 \
11bfin \
12cris \
13e1 \
14frv \
15h8300 \
16hppa \
17i386 \
18i960 \
19ia64 \
20m68k \
21microblaze \
22mips \
23nios \
24nios2 \
25powerpc \
26sh \
27sh64 \
28sparc \
29v850 \
30vax \
31x86_64 \
32xtensa \
33"
34def map_uclibc_arch(a, d):
35 """Return the uClibc architecture for the given TARGET_ARCH."""
36 import re
37
38 valid_archs = bb.data.getVar('valid_archs', d, 1).split()
39
40 if re.match('^(arm|sa110).*', a): return 'arm'
41 elif re.match('^(i.86|athlon)$', a): return 'i386'
42 elif re.match('^mips.*', a): return 'mips'
43 elif re.match('^parisc.*', a): return 'hppa'
44 elif re.match('^ppc.*', a): return 'powerpc'
45 elif re.match('^s390.*', a): return 's390'
46 elif re.match('^sh.*', a): return 'sh'
47 elif re.match('^(sun|sparc).*', a): return 'sparc'
48 elif re.match('^xtensa.*', a): return 'xtensa'
49 elif a in valid_archs: return a
50 else:
51 bb.error("cannot map '%s' to a uClibc architecture" % a)
52
53export UCLIBC_ARCH = "${@map_uclibc_arch(bb.data.getVar('TARGET_ARCH', d, 1), d)}"
54
55def map_uclibc_abi(o, d):
56 """Return the uClibc ABI for the given TARGET_OS."""
57 import re
58
59 arch = bb.data.getVar('TARGET_ARCH', d, 1)
60 if map_uclibc_arch(bb.data.getVar('TARGET_ARCH', d, 1), d) == "arm":
61 if re.match('.*eabi$', o): return 'ARM_EABI'
62 else: return 'ARM_OABI'
63 # FIXME: This is inaccurate! Handle o32, n32, n64
64 elif re.match('^mips.*64$', arch): return 'MIPS_N64_ABI'
65 elif re.match('^mips.*', arch): return 'MIPS_O32_ABI'
66 return ""
67
68export UCLIBC_ABI = "${@map_uclibc_abi(bb.data.getVar('TARGET_OS', d, 1), d)}"
69
70def map_uclibc_endian(a, d):
71 """Return the uClibc endianess for the given TARGET_ARCH."""
72 import re
73
74 # Always BE
75 if re.match('^(avr32|e1|frv|(parisc|hppa)|m68k|microblaze|powerpc.*|(sparc|sun).*)$', a):
76 return 'BIG'
77 # Possibly BE
78 elif re.match('^((arm|sa110|arm.*eb)|h8300.*eb|(parisc|hppa).*eb|mips|sh.*eb|xtensa.*eb)$', a):
79 return 'BIG'
80 return 'LITTLE'
81
82export UCLIBC_ENDIAN = "${@map_uclibc_endian(bb.data.getVar('TARGET_ARCH', d, 1), d)}"
83
84# internal helper
85def uclibc_cfg(feature, features, tokens, cnf, rem):
86 if type(tokens) == type(""):
87 tokens = [tokens]
88 rem.extend(['/^[# ]*' + token + '[ =]/d' for token in tokens])
89 if type(features) == type([]) and feature in features:
90 cnf.extend([token + '=y' for token in tokens])
91 else:
92 cnf.extend(['# ' + token + ' is not set' for token in tokens])
93
94# Map distro and machine features to config settings
95def features_to_uclibc_settings(d):
96 cnf, rem = ([], [])
97 distro_features = bb.data.getVar('DISTRO_FEATURES', d, True).split()
98 machine_features = bb.data.getVar('MACHINE_FEATURES', d, True).split()
99 uclibc_cfg('ipv4', distro_features, 'UCLIBC_HAS_IPV4', cnf, rem)
100 uclibc_cfg('ipv6', distro_features, 'UCLIBC_HAS_IPV6', cnf, rem)
101 uclibc_cfg('largefile', distro_features, 'UCLIBC_HAS_LFS', cnf, rem)
102 uclibc_cfg('nls', distro_features, 'UCLIBC_HAS_LOCALE', cnf, rem)
103 uclibc_cfg('thumb-interwork', distro_features,'USE_BX', cnf, rem)
104 uclibc_cfg('xattr', distro_features, 'UCLIBC_HAS_XATTR', cnf, rem)
105 uclibc_cfg('ssp', distro_features, 'UCLIBC_HAS_SSP', cnf, rem)
106 uclibc_cfg('argp', distro_features, 'UCLIBC_HAS_ARGP', cnf, rem)
107 uclibc_cfg('kernel24', machine_features,'UCLIBC_LINUX_MODULE_24', cnf, rem)
108 return "\n".join(cnf), "\n".join(rem)
109# X, Y = ${@features_to_uclibc_settings(d)}
110# unfortunately doesn't seem to work with bitbake, workaround:
111def features_to_uclibc_conf(d):
112 cnf, rem = features_to_uclibc_settings(d)
113 return cnf
114def features_to_uclibc_del(d):
115 cnf, rem = features_to_uclibc_settings(d)
116 return rem
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/argp-headers.patch b/meta-oe/recipes-core/uclibc/uclibc-git/argp-headers.patch
deleted file mode 100644
index 7fd148fed..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/argp-headers.patch
+++ /dev/null
@@ -1,581 +0,0 @@
1Added headers file needed by argp sources.
2
3Signed-off-by: Salvatore Cro <salvatore.cro at st.com>
4---
5 include/argp.h | 566 ++++++++++++++++++++++++++++++++++++++++++++
6 libc/argp/argp-fmtstream.h | 314 ++++++++++++++++++++++++
7 2 files changed, 880 insertions(+), 0 deletions(-)
8 create mode 100644 include/argp.h
9 create mode 100644 libc/argp/argp-fmtstream.h
10
11Index: git/include/argp.h
12===================================================================
13--- /dev/null
14+++ git/include/argp.h
15@@ -0,0 +1,566 @@
16+/* Hierarchial argument parsing, layered over getopt.
17+ Copyright (C) 1995-1999, 2003, 2004, 2005, 2006, 2007, 2009
18+ Free Software Foundation, Inc.
19+ This file is part of the GNU C Library.
20+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
21+
22+ The GNU C Library is free software; you can redistribute it and/or
23+ modify it under the terms of the GNU Lesser General Public
24+ License as published by the Free Software Foundation; either
25+ version 2.1 of the License, or (at your option) any later version.
26+
27+ The GNU C Library is distributed in the hope that it will be useful,
28+ but WITHOUT ANY WARRANTY; without even the implied warranty of
29+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
30+ Lesser General Public License for more details.
31+
32+ You should have received a copy of the GNU Lesser General Public
33+ License along with the GNU C Library; if not, write to the Free
34+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
35+ 02111-1307 USA.
36+
37+ Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com>
38+*/
39+
40+#ifndef _ARGP_H
41+#define _ARGP_H
42+
43+#include <stdio.h>
44+#include <ctype.h>
45+#include <limits.h>
46+
47+#define __need_error_t
48+#include <errno.h>
49+
50+#ifndef __const
51+# define __const const
52+#endif
53+
54+#ifndef __THROW
55+# define __THROW
56+#endif
57+#ifndef __NTH
58+# define __NTH(fct) fct __THROW
59+#endif
60+
61+#ifndef __attribute__
62+/* This feature is available in gcc versions 2.5 and later. */
63+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || defined(__STRICT_ANSI__)
64+# define __attribute__(Spec) /* empty */
65+# endif
66+/* The __-protected variants of `format' and `printf' attributes
67+ are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
68+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || defined(__STRICT_ANSI__)
69+# define __format__ format
70+# define __printf__ printf
71+# endif
72+#endif
73+
74+/* GCC 2.95 and later have "__restrict"; C99 compilers have
75+ "restrict", and "configure" may have defined "restrict". */
76+#ifndef __restrict
77+# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__))
78+# if defined restrict || 199901L <= __STDC_VERSION__
79+# define __restrict restrict
80+# else
81+# define __restrict
82+# endif
83+# endif
84+#endif
85+
86+#ifndef __error_t_defined
87+typedef int error_t;
88+# define __error_t_defined
89+#endif
90+
91+#ifdef __cplusplus
92+extern "C" {
93+#endif
94+
95+/* A description of a particular option. A pointer to an array of
96+ these is passed in the OPTIONS field of an argp structure. Each option
97+ entry can correspond to one long option and/or one short option; more
98+ names for the same option can be added by following an entry in an option
99+ array with options having the OPTION_ALIAS flag set. */
100+struct argp_option
101+{
102+ /* The long option name. For more than one name for the same option, you
103+ can use following options with the OPTION_ALIAS flag set. */
104+ __const char *name;
105+
106+ /* What key is returned for this option. If > 0 and printable, then it's
107+ also accepted as a short option. */
108+ int key;
109+
110+ /* If non-NULL, this is the name of the argument associated with this
111+ option, which is required unless the OPTION_ARG_OPTIONAL flag is set. */
112+ __const char *arg;
113+
114+ /* OPTION_ flags. */
115+ int flags;
116+
117+ /* The doc string for this option. If both NAME and KEY are 0, This string
118+ will be printed outdented from the normal option column, making it
119+ useful as a group header (it will be the first thing printed in its
120+ group); in this usage, it's conventional to end the string with a `:'. */
121+ __const char *doc;
122+
123+ /* The group this option is in. In a long help message, options are sorted
124+ alphabetically within each group, and the groups presented in the order
125+ 0, 1, 2, ..., n, -m, ..., -2, -1. Every entry in an options array with
126+ if this field 0 will inherit the group number of the previous entry, or
127+ zero if it's the first one, unless its a group header (NAME and KEY both
128+ 0), in which case, the previous entry + 1 is the default. Automagic
129+ options such as --help are put into group -1. */
130+ int group;
131+};
132+
133+/* The argument associated with this option is optional. */
134+#define OPTION_ARG_OPTIONAL 0x1
135+
136+/* This option isn't displayed in any help messages. */
137+#define OPTION_HIDDEN 0x2
138+
139+/* This option is an alias for the closest previous non-alias option. This
140+ means that it will be displayed in the same help entry, and will inherit
141+ fields other than NAME and KEY from the aliased option. */
142+#define OPTION_ALIAS 0x4
143+
144+/* This option isn't actually an option (and so should be ignored by the
145+ actual option parser), but rather an arbitrary piece of documentation that
146+ should be displayed in much the same manner as the options. If this flag
147+ is set, then the option NAME field is displayed unmodified (e.g., no `--'
148+ prefix is added) at the left-margin (where a *short* option would normally
149+ be displayed), and the documentation string in the normal place. For
150+ purposes of sorting, any leading whitespace and punctuation is ignored,
151+ except that if the first non-whitespace character is not `-', this entry
152+ is displayed after all options (and OPTION_DOC entries with a leading `-')
153+ in the same group. */
154+#define OPTION_DOC 0x8
155+
156+/* This option shouldn't be included in `long' usage messages (but is still
157+ included in help messages). This is mainly intended for options that are
158+ completely documented in an argp's ARGS_DOC field, in which case including
159+ the option in the generic usage list would be redundant. For instance,
160+ if ARGS_DOC is "FOO BAR\n-x BLAH", and the `-x' option's purpose is to
161+ distinguish these two cases, -x should probably be marked
162+ OPTION_NO_USAGE. */
163+#define OPTION_NO_USAGE 0x10
164+
165+struct argp; /* fwd declare this type */
166+struct argp_state; /* " */
167+struct argp_child; /* " */
168+
169+/* The type of a pointer to an argp parsing function. */
170+typedef error_t (*argp_parser_t) (int __key, char *__arg,
171+ struct argp_state *__state);
172+
173+/* What to return for unrecognized keys. For special ARGP_KEY_ keys, such
174+ returns will simply be ignored. For user keys, this error will be turned
175+ into EINVAL (if the call to argp_parse is such that errors are propagated
176+ back to the user instead of exiting); returning EINVAL itself would result
177+ in an immediate stop to parsing in *all* cases. */
178+#define ARGP_ERR_UNKNOWN E2BIG /* Hurd should never need E2BIG. XXX */
179+
180+/* Special values for the KEY argument to an argument parsing function.
181+ ARGP_ERR_UNKNOWN should be returned if they aren't understood.
182+
183+ The sequence of keys to a parsing function is either (where each
184+ uppercased word should be prefixed by `ARGP_KEY_' and opt is a user key):
185+
186+ INIT opt... NO_ARGS END SUCCESS -- No non-option arguments at all
187+ or INIT (opt | ARG)... END SUCCESS -- All non-option args parsed
188+ or INIT (opt | ARG)... SUCCESS -- Some non-option arg unrecognized
189+
190+ The third case is where every parser returned ARGP_KEY_UNKNOWN for an
191+ argument, in which case parsing stops at that argument (returning the
192+ unparsed arguments to the caller of argp_parse if requested, or stopping
193+ with an error message if not).
194+
195+ If an error occurs (either detected by argp, or because the parsing
196+ function returned an error value), then the parser is called with
197+ ARGP_KEY_ERROR, and no further calls are made. */
198+
199+/* This is not an option at all, but rather a command line argument. If a
200+ parser receiving this key returns success, the fact is recorded, and the
201+ ARGP_KEY_NO_ARGS case won't be used. HOWEVER, if while processing the
202+ argument, a parser function decrements the NEXT field of the state it's
203+ passed, the option won't be considered processed; this is to allow you to
204+ actually modify the argument (perhaps into an option), and have it
205+ processed again. */
206+#define ARGP_KEY_ARG 0
207+/* There are remaining arguments not parsed by any parser, which may be found
208+ starting at (STATE->argv + STATE->next). If success is returned, but
209+ STATE->next left untouched, it's assumed that all arguments were consume,
210+ otherwise, the parser should adjust STATE->next to reflect any arguments
211+ consumed. */
212+#define ARGP_KEY_ARGS 0x1000006
213+/* There are no more command line arguments at all. */
214+#define ARGP_KEY_END 0x1000001
215+/* Because it's common to want to do some special processing if there aren't
216+ any non-option args, user parsers are called with this key if they didn't
217+ successfully process any non-option arguments. Called just before
218+ ARGP_KEY_END (where more general validity checks on previously parsed
219+ arguments can take place). */
220+#define ARGP_KEY_NO_ARGS 0x1000002
221+/* Passed in before any parsing is done. Afterwards, the values of each
222+ element of the CHILD_INPUT field, if any, in the state structure is
223+ copied to each child's state to be the initial value of the INPUT field. */
224+#define ARGP_KEY_INIT 0x1000003
225+/* Use after all other keys, including SUCCESS & END. */
226+#define ARGP_KEY_FINI 0x1000007
227+/* Passed in when parsing has successfully been completed (even if there are
228+ still arguments remaining). */
229+#define ARGP_KEY_SUCCESS 0x1000004
230+/* Passed in if an error occurs. */
231+#define ARGP_KEY_ERROR 0x1000005
232+
233+/* An argp structure contains a set of options declarations, a function to
234+ deal with parsing one, documentation string, a possible vector of child
235+ argp's, and perhaps a function to filter help output. When actually
236+ parsing options, getopt is called with the union of all the argp
237+ structures chained together through their CHILD pointers, with conflicts
238+ being resolved in favor of the first occurrence in the chain. */
239+struct argp
240+{
241+ /* An array of argp_option structures, terminated by an entry with both
242+ NAME and KEY having a value of 0. */
243+ __const struct argp_option *options;
244+
245+ /* What to do with an option from this structure. KEY is the key
246+ associated with the option, and ARG is any associated argument (NULL if
247+ none was supplied). If KEY isn't understood, ARGP_ERR_UNKNOWN should be
248+ returned. If a non-zero, non-ARGP_ERR_UNKNOWN value is returned, then
249+ parsing is stopped immediately, and that value is returned from
250+ argp_parse(). For special (non-user-supplied) values of KEY, see the
251+ ARGP_KEY_ definitions below. */
252+ argp_parser_t parser;
253+
254+ /* A string describing what other arguments are wanted by this program. It
255+ is only used by argp_usage to print the `Usage:' message. If it
256+ contains newlines, the strings separated by them are considered
257+ alternative usage patterns, and printed on separate lines (lines after
258+ the first are prefix by ` or: ' instead of `Usage:'). */
259+ __const char *args_doc;
260+
261+ /* If non-NULL, a string containing extra text to be printed before and
262+ after the options in a long help message (separated by a vertical tab
263+ `\v' character). */
264+ __const char *doc;
265+
266+ /* A vector of argp_children structures, terminated by a member with a 0
267+ argp field, pointing to child argps should be parsed with this one. Any
268+ conflicts are resolved in favor of this argp, or early argps in the
269+ CHILDREN list. This field is useful if you use libraries that supply
270+ their own argp structure, which you want to use in conjunction with your
271+ own. */
272+ __const struct argp_child *children;
273+
274+ /* If non-zero, this should be a function to filter the output of help
275+ messages. KEY is either a key from an option, in which case TEXT is
276+ that option's help text, or a special key from the ARGP_KEY_HELP_
277+ defines, below, describing which other help text TEXT is. The function
278+ should return either TEXT, if it should be used as-is, a replacement
279+ string, which should be malloced, and will be freed by argp, or NULL,
280+ meaning `print nothing'. The value for TEXT is *after* any translation
281+ has been done, so if any of the replacement text also needs translation,
282+ that should be done by the filter function. INPUT is either the input
283+ supplied to argp_parse, or NULL, if argp_help was called directly. */
284+ char *(*help_filter) (int __key, __const char *__text, void *__input);
285+
286+ /* If non-zero the strings used in the argp library are translated using
287+ the domain described by this string. Otherwise the currently installed
288+ default domain is used. */
289+ const char *argp_domain;
290+};
291+
292+/* Possible KEY arguments to a help filter function. */
293+#define ARGP_KEY_HELP_PRE_DOC 0x2000001 /* Help text preceeding options. */
294+#define ARGP_KEY_HELP_POST_DOC 0x2000002 /* Help text following options. */
295+#define ARGP_KEY_HELP_HEADER 0x2000003 /* Option header string. */
296+#define ARGP_KEY_HELP_EXTRA 0x2000004 /* After all other documentation;
297+ TEXT is NULL for this key. */
298+/* Explanatory note emitted when duplicate option arguments have been
299+ suppressed. */
300+#define ARGP_KEY_HELP_DUP_ARGS_NOTE 0x2000005
301+#define ARGP_KEY_HELP_ARGS_DOC 0x2000006 /* Argument doc string. */
302+
303+/* When an argp has a non-zero CHILDREN field, it should point to a vector of
304+ argp_child structures, each of which describes a subsidiary argp. */
305+struct argp_child
306+{
307+ /* The child parser. */
308+ __const struct argp *argp;
309+
310+ /* Flags for this child. */
311+ int flags;
312+
313+ /* If non-zero, an optional header to be printed in help output before the
314+ child options. As a side-effect, a non-zero value forces the child
315+ options to be grouped together; to achieve this effect without actually
316+ printing a header string, use a value of "". */
317+ __const char *header;
318+
319+ /* Where to group the child options relative to the other (`consolidated')
320+ options in the parent argp; the values are the same as the GROUP field
321+ in argp_option structs, but all child-groupings follow parent options at
322+ a particular group level. If both this field and HEADER are zero, then
323+ they aren't grouped at all, but rather merged with the parent options
324+ (merging the child's grouping levels with the parents). */
325+ int group;
326+};
327+
328+/* Parsing state. This is provided to parsing functions called by argp,
329+ which may examine and, as noted, modify fields. */
330+struct argp_state
331+{
332+ /* The top level ARGP being parsed. */
333+ __const struct argp *root_argp;
334+
335+ /* The argument vector being parsed. May be modified. */
336+ int argc;
337+ char **argv;
338+
339+ /* The index in ARGV of the next arg that to be parsed. May be modified. */
340+ int next;
341+
342+ /* The flags supplied to argp_parse. May be modified. */
343+ unsigned flags;
344+
345+ /* While calling a parsing function with a key of ARGP_KEY_ARG, this is the
346+ number of the current arg, starting at zero, and incremented after each
347+ such call returns. At all other times, this is the number of such
348+ arguments that have been processed. */
349+ unsigned arg_num;
350+
351+ /* If non-zero, the index in ARGV of the first argument following a special
352+ `--' argument (which prevents anything following being interpreted as an
353+ option). Only set once argument parsing has proceeded past this point. */
354+ int quoted;
355+
356+ /* An arbitrary pointer passed in from the user. */
357+ void *input;
358+ /* Values to pass to child parsers. This vector will be the same length as
359+ the number of children for the current parser. */
360+ void **child_inputs;
361+
362+ /* For the parser's use. Initialized to 0. */
363+ void *hook;
364+
365+ /* The name used when printing messages. This is initialized to ARGV[0],
366+ or PROGRAM_INVOCATION_NAME if that is unavailable. */
367+ char *name;
368+
369+ /* Streams used when argp prints something. */
370+ FILE *err_stream; /* For errors; initialized to stderr. */
371+ FILE *out_stream; /* For information; initialized to stdout. */
372+
373+ void *pstate; /* Private, for use by argp. */
374+};
375+
376+/* Flags for argp_parse (note that the defaults are those that are
377+ convenient for program command line parsing): */
378+
379+/* Don't ignore the first element of ARGV. Normally (and always unless
380+ ARGP_NO_ERRS is set) the first element of the argument vector is
381+ skipped for option parsing purposes, as it corresponds to the program name
382+ in a command line. */
383+#define ARGP_PARSE_ARGV0 0x01
384+
385+/* Don't print error messages for unknown options to stderr; unless this flag
386+ is set, ARGP_PARSE_ARGV0 is ignored, as ARGV[0] is used as the program
387+ name in the error messages. This flag implies ARGP_NO_EXIT (on the
388+ assumption that silent exiting upon errors is bad behaviour). */
389+#define ARGP_NO_ERRS 0x02
390+
391+/* Don't parse any non-option args. Normally non-option args are parsed by
392+ calling the parse functions with a key of ARGP_KEY_ARG, and the actual arg
393+ as the value. Since it's impossible to know which parse function wants to
394+ handle it, each one is called in turn, until one returns 0 or an error
395+ other than ARGP_ERR_UNKNOWN; if an argument is handled by no one, the
396+ argp_parse returns prematurely (but with a return value of 0). If all
397+ args have been parsed without error, all parsing functions are called one
398+ last time with a key of ARGP_KEY_END. This flag needn't normally be set,
399+ as the normal behavior is to stop parsing as soon as some argument can't
400+ be handled. */
401+#define ARGP_NO_ARGS 0x04
402+
403+/* Parse options and arguments in the same order they occur on the command
404+ line -- normally they're rearranged so that all options come first. */
405+#define ARGP_IN_ORDER 0x08
406+
407+/* Don't provide the standard long option --help, which causes usage and
408+ option help information to be output to stdout, and exit (0) called. */
409+#define ARGP_NO_HELP 0x10
410+
411+/* Don't exit on errors (they may still result in error messages). */
412+#define ARGP_NO_EXIT 0x20
413+
414+/* Use the gnu getopt `long-only' rules for parsing arguments. */
415+#define ARGP_LONG_ONLY 0x40
416+
417+/* Turns off any message-printing/exiting options. */
418+#define ARGP_SILENT (ARGP_NO_EXIT | ARGP_NO_ERRS | ARGP_NO_HELP)
419+
420+/* Parse the options strings in ARGC & ARGV according to the options in ARGP.
421+ FLAGS is one of the ARGP_ flags above. If ARG_INDEX is non-NULL, the
422+ index in ARGV of the first unparsed option is returned in it. If an
423+ unknown option is present, ARGP_ERR_UNKNOWN is returned; if some parser
424+ routine returned a non-zero value, it is returned; otherwise 0 is
425+ returned. This function may also call exit unless the ARGP_NO_HELP flag
426+ is set. INPUT is a pointer to a value to be passed in to the parser. */
427+extern error_t argp_parse (__const struct argp *__restrict __argp,
428+ int __argc, char **__restrict __argv,
429+ unsigned __flags, int *__restrict __arg_index,
430+ void *__restrict __input);
431+
432+/* Global variables. */
433+
434+/* If defined or set by the user program to a non-zero value, then a default
435+ option --version is added (unless the ARGP_NO_HELP flag is used), which
436+ will print this string followed by a newline and exit (unless the
437+ ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */
438+extern __const char *argp_program_version;
439+
440+/* If defined or set by the user program to a non-zero value, then a default
441+ option --version is added (unless the ARGP_NO_HELP flag is used), which
442+ calls this function with a stream to print the version to and a pointer to
443+ the current parsing state, and then exits (unless the ARGP_NO_EXIT flag is
444+ used). This variable takes precedent over ARGP_PROGRAM_VERSION. */
445+extern void (*argp_program_version_hook) (FILE *__restrict __stream,
446+ struct argp_state *__restrict
447+ __state);
448+
449+/* If defined or set by the user program, it should point to string that is
450+ the bug-reporting address for the program. It will be printed by
451+ argp_help if the ARGP_HELP_BUG_ADDR flag is set (as it is by various
452+ standard help messages), embedded in a sentence that says something like
453+ `Report bugs to ADDR.'. */
454+extern __const char *argp_program_bug_address;
455+
456+/* The exit status that argp will use when exiting due to a parsing error.
457+ If not defined or set by the user program, this defaults to EX_USAGE from
458+ <sysexits.h>. */
459+extern error_t argp_err_exit_status;
460+
461+/* Flags for argp_help. */
462+#define ARGP_HELP_USAGE 0x01 /* a Usage: message. */
463+#define ARGP_HELP_SHORT_USAGE 0x02 /* " but don't actually print options. */
464+#define ARGP_HELP_SEE 0x04 /* a `Try ... for more help' message. */
465+#define ARGP_HELP_LONG 0x08 /* a long help message. */
466+#define ARGP_HELP_PRE_DOC 0x10 /* doc string preceding long help. */
467+#define ARGP_HELP_POST_DOC 0x20 /* doc string following long help. */
468+#define ARGP_HELP_DOC (ARGP_HELP_PRE_DOC | ARGP_HELP_POST_DOC)
469+#define ARGP_HELP_BUG_ADDR 0x40 /* bug report address */
470+#define ARGP_HELP_LONG_ONLY 0x80 /* modify output appropriately to
471+ reflect ARGP_LONG_ONLY mode. */
472+
473+/* These ARGP_HELP flags are only understood by argp_state_help. */
474+#define ARGP_HELP_EXIT_ERR 0x100 /* Call exit(1) instead of returning. */
475+#define ARGP_HELP_EXIT_OK 0x200 /* Call exit(0) instead of returning. */
476+
477+/* The standard thing to do after a program command line parsing error, if an
478+ error message has already been printed. */
479+#define ARGP_HELP_STD_ERR \
480+ (ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR)
481+/* The standard thing to do after a program command line parsing error, if no
482+ more specific error message has been printed. */
483+#define ARGP_HELP_STD_USAGE \
484+ (ARGP_HELP_SHORT_USAGE | ARGP_HELP_SEE | ARGP_HELP_EXIT_ERR)
485+/* The standard thing to do in response to a --help option. */
486+#define ARGP_HELP_STD_HELP \
487+ (ARGP_HELP_SHORT_USAGE | ARGP_HELP_LONG | ARGP_HELP_EXIT_OK \
488+ | ARGP_HELP_DOC | ARGP_HELP_BUG_ADDR)
489+
490+/* Output a usage message for ARGP to STREAM. FLAGS are from the set
491+ ARGP_HELP_*. */
492+extern void argp_help (__const struct argp *__restrict __argp,
493+ FILE *__restrict __stream,
494+ unsigned __flags, char *__restrict __name);
495+
496+/* The following routines are intended to be called from within an argp
497+ parsing routine (thus taking an argp_state structure as the first
498+ argument). They may or may not print an error message and exit, depending
499+ on the flags in STATE -- in any case, the caller should be prepared for
500+ them *not* to exit, and should return an appropiate error after calling
501+ them. [argp_usage & argp_error should probably be called argp_state_...,
502+ but they're used often enough that they should be short] */
503+
504+/* Output, if appropriate, a usage message for STATE to STREAM. FLAGS are
505+ from the set ARGP_HELP_*. */
506+extern void argp_state_help (__const struct argp_state *__restrict __state,
507+ FILE *__restrict __stream,
508+ unsigned int __flags);
509+/* Possibly output the standard usage message for ARGP to stderr and exit. */
510+extern void argp_usage (__const struct argp_state *__state);
511+
512+/* If appropriate, print the printf string FMT and following args, preceded
513+ by the program name and `:', to stderr, and followed by a `Try ... --help'
514+ message, then exit (1). */
515+extern void argp_error (__const struct argp_state *__restrict __state,
516+ __const char *__restrict __fmt, ...)
517+ __attribute__ ((__format__ (__printf__, 2, 3)));
518+/* Similar to the standard gnu error-reporting function error(), but will
519+ respect the ARGP_NO_EXIT and ARGP_NO_ERRS flags in STATE, and will print
520+ to STATE->err_stream. This is useful for argument parsing code that is
521+ shared between program startup (when exiting is desired) and runtime
522+ option parsing (when typically an error code is returned instead). The
523+ difference between this function and argp_error is that the latter is for
524+ *parsing errors*, and the former is for other problems that occur during
525+ parsing but don't reflect a (syntactic) problem with the input. */
526+extern void argp_failure (__const struct argp_state *__restrict __state,
527+ int __status, int __errnum,
528+ __const char *__restrict __fmt, ...)
529+ __attribute__ ((__format__ (__printf__, 4, 5)));
530+/* Returns true if the option OPT is a valid short option. */
531+extern int _option_is_short (__const struct argp_option *__opt) __THROW;
532+extern int __option_is_short (__const struct argp_option *__opt) __THROW;
533+
534+/* Returns true if the option OPT is in fact the last (unused) entry in an
535+ options array. */
536+extern int _option_is_end (__const struct argp_option *__opt) __THROW;
537+extern int __option_is_end (__const struct argp_option *__opt) __THROW;
538+
539+/* Return the input field for ARGP in the parser corresponding to STATE; used
540+ by the help routines. */
541+/* We think this should not be exported */
542+extern void *__argp_input (__const struct argp *__restrict __argp,
543+ __const struct argp_state *__restrict __state)
544+ __THROW;
545+
546+#ifdef __USE_EXTERN_INLINES
547+
548+# ifndef ARGP_EI
549+# define ARGP_EI __extern_inline
550+# endif
551+
552+ARGP_EI void
553+argp_usage (__const struct argp_state *__state)
554+{
555+ argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE);
556+}
557+
558+ARGP_EI int
559+__NTH (__option_is_short (__const struct argp_option *__opt))
560+{
561+ if (__opt->flags & OPTION_DOC)
562+ return 0;
563+ else
564+ {
565+ int __key = __opt->key;
566+ return __key > 0 && __key <= UCHAR_MAX && isprint (__key);
567+ }
568+}
569+
570+ARGP_EI int
571+__NTH (__option_is_end (__const struct argp_option *__opt))
572+{
573+ return !__opt->key && !__opt->name && !__opt->doc && !__opt->group;
574+}
575+#endif /* Use extern inlines. */
576+
577+#ifdef __cplusplus
578+}
579+#endif
580+
581+#endif /* argp.h */
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/argp-support.patch b/meta-oe/recipes-core/uclibc/uclibc-git/argp-support.patch
deleted file mode 100644
index 04a3c7824..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/argp-support.patch
+++ /dev/null
@@ -1,5189 +0,0 @@
1From: Salvatore Cro <salvatore.cro at st.com>
2
3Argp is an advanced support for parsing unix-style argument vectors.
4In addition to the common getopt interface, it provides automatic response
5to `--help' and `--version' options and use of custom parser in conjunction
6with argp native option parser, among others.
7Argp support is required by elfutils package and prelink.
8
9In uClibc argp functionalities has been moved from C library to libuargp.so
10Further the libc.so linker script contains an AS_NEEDED entry so that
11it doesn't need to link libuargp.so explicitely.
12
13Signed-off-by: Salvatore Cro <salvatore.cro at st.com>
14Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono at st.com>
15Signed-off-by: Carmelo Amoroso <carmelo.amoroso at st.com>
16---
17 Makefile.in | 8 +
18 Makerules | 8 +-
19 Rules.mak | 7 +
20 extra/Configs/Config.in | 17 +
21 libc/sysdeps/linux/common/bits/getopt_int.h | 136 ++
22 libc/unistd/getopt.c | 18 +-
23 libc/unistd/getopt_int.h | 134 --
24 libuargp/Makefile | 14 +
25 libuargp/Makefile.in | 76 ++
26 libuargp/argp-ba.c | 26 +
27 libuargp/argp-eexst.c | 32 +
28 libuargp/argp-fmtstream.c | 439 +++++++
29 libuargp/argp-fmtstream.h | 314 +++++
30 libuargp/argp-fs-xinl.c | 44 +
31 libuargp/argp-help.c | 1882 +++++++++++++++++++++++++++
32 libuargp/argp-parse.c | 949 ++++++++++++++
33 libuargp/argp-pv.c | 25 +
34 libuargp/argp-pvh.c | 32 +
35 libuargp/argp-xinl.c | 35 +
36 test/argp/Makefile | 7 +
37 test/argp/Makefile.in | 12 +
38 test/argp/argp-ex1.c | 15 +
39 test/argp/argp-ex2.c | 45 +
40 test/argp/argp-ex3.c | 153 +++
41 test/argp/argp-ex4.c | 167 +++
42 test/argp/argp-test.c | 209 +++
43 test/argp/bug-argp1.c | 26 +
44 test/argp/tst-argp1.c | 118 ++
45 test/argp/tst-argp2.c | 101 ++
46 29 files changed, 4911 insertions(+), 138 deletions(-)
47 create mode 100644 libc/sysdeps/linux/common/bits/getopt_int.h
48 delete mode 100644 libc/unistd/getopt_int.h
49 create mode 100644 libuargp/Makefile
50 create mode 100644 libuargp/Makefile.in
51 create mode 100644 libuargp/argp-ba.c
52 create mode 100644 libuargp/argp-eexst.c
53 create mode 100644 libuargp/argp-fmtstream.c
54 create mode 100644 libuargp/argp-fmtstream.h
55 create mode 100644 libuargp/argp-fs-xinl.c
56 create mode 100644 libuargp/argp-help.c
57 create mode 100644 libuargp/argp-parse.c
58 create mode 100644 libuargp/argp-pv.c
59 create mode 100644 libuargp/argp-pvh.c
60 create mode 100644 libuargp/argp-xinl.c
61 create mode 100644 test/argp/Makefile
62 create mode 100644 test/argp/Makefile.in
63 create mode 100644 test/argp/argp-ex1.c
64 create mode 100644 test/argp/argp-ex2.c
65 create mode 100644 test/argp/argp-ex3.c
66 create mode 100644 test/argp/argp-ex4.c
67 create mode 100644 test/argp/argp-test.c
68 create mode 100644 test/argp/bug-argp1.c
69 create mode 100644 test/argp/tst-argp1.c
70 create mode 100644 test/argp/tst-argp2.c
71
72Index: git/Makefile.in
73===================================================================
74--- git.orig/Makefile.in
75+++ git/Makefile.in
76@@ -48,6 +48,7 @@ include $(top_srcdir)libresolv/Makefile.
77 include $(top_srcdir)libutil/Makefile.in
78 include $(top_srcdir)libpthread/Makefile.in
79 include $(top_srcdir)librt/Makefile.in
80+include $(top_srcdir)libuargp/Makefile.in
81 include $(top_srcdir)libubacktrace/Makefile.in
82 include $(top_srcdir)extra/locale/Makefile.in
83
84@@ -230,6 +231,7 @@ HEADERS_RM- += sgtty.h
85 endif
86 HEADERS_RM-$(HAVE_SHARED) += dlfcn.h bits/dlfcn.h
87 HEADERS_RM-$(PTHREADS_DEBUG_SUPPORT) += thread_db.h
88+HEADERS_RM-$(UCLIBC_HAS_ARGP) += argp.h
89 HEADERS_RM-$(UCLIBC_HAS_BSD_ERR) += err.h
90 HEADERS_RM-$(UCLIBC_HAS_CRYPT) += crypt.h
91 HEADERS_RM-$(UCLIBC_HAS_EPOLL) += sys/epoll.h
92@@ -340,6 +342,12 @@ ifeq ($(UCLIBC_HAS_BACKTRACE),y)
93 echo "GROUP ( $(UBACKTRACE_ASNEEDED) )" >> $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libc.so; \
94 fi
95 endif
96+ifeq ($(UCLIBC_HAS_ARGP),y)
97+# Add the AS_NEEDED entry for libuargp.so
98+ if [ -f $(top_builddir)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) ] ; then \
99+ echo "GROUP ( $(UARGP_ASNEEDED) )" >> $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
100+ fi
101+endif
102 ifeq ($(UCLIBC_HAS_THREADS),y)
103 ifneq ($(LINUXTHREADS_OLD),y)
104 ifeq ($(HARDWIRED_ABSPATH),y)
105Index: git/Makerules
106===================================================================
107--- git.orig/Makerules
108+++ git/Makerules
109@@ -32,12 +32,12 @@ shared_objs = $(libc-y:.o=.os) $(libc-sh
110 $(libpthread-so-y) $(libpthread-nonshared-y) $(libthread_db-so-y) \
111 $(libresolv-so-y) $(librt-so-y) \
112 $(ldso-y) \
113- $(libutil-so-y) $(libubacktrace-so-y)
114+ $(libutil-so-y) $(libubacktrace-so-y) $(libuargp-so-y)
115
116 ar_objs = $(libc-y) $(libc-static-y) $(libcrypt-a-y) \
117 $(libdl-a-y) $(libintl-a-y) $(libm-a-y) $(libnsl-a-y) \
118 $(libpthread-a-y) $(libthread_db-a-y) \
119- $(libresolv-a-y) $(librt-a-y) $(libutil-a-y) $(libubacktrace-a-y)
120+ $(libresolv-a-y) $(librt-a-y) $(libutil-a-y) $(libubacktrace-a-y) $(libuargp-a-y)
121 ifeq ($(DOPIC),y)
122 ar_objs := $(ar_objs:.o=.os)
123 endif
124@@ -464,7 +464,7 @@ files.dep := $(libc-a-y) $(libc-so-y) $(
125 $(librt-a-y) $(librt-so-y) $(libresolv-a-y) $(libresolv-so-y) \
126 $(libcrypt-a-y) $(libcrypt-so-y) $(libutil-a-y) $(libutil-so-y) \
127 $(libnsl-a-y) $(libnsl-so-y) $(ldso-y) $(libdl-a-y) $(libdl-so-y) \
128- $(libubacktrace-a-y) $(libubacktrace-so-y)
129+ $(libubacktrace-a-y) $(libubacktrace-so-y) $(libuargp-so-y) $(libuargp-a-y)
130 .depends.dep := \
131 $(patsubst %.s,%.s.dep,$(filter %.s,$(files.dep))) \
132 $(patsubst %.o,%.o.dep,$(filter %.o,$(files.dep))) \
133Index: git/Rules.mak
134===================================================================
135--- git.orig/Rules.mak
136+++ git/Rules.mak
137@@ -525,6 +525,13 @@ export UBACKTRACE_ASNEEDED:=$(shell $(LD
138 else
139 export UBACKTRACE_ASNEEDED:=""
140 endif
141+ifeq ($(UCLIBC_HAS_ARGP),y)
142+# Only used in installed libc.so linker script
143+UARGP_FULL_NAME := $(RUNTIME_PREFIX)lib/libuargp.so.$(MAJOR_VERSION)
144+export UARGP_ASNEEDED:=$(shell $(LD) --help 2>/dev/null | grep -q -- --as-needed && echo "AS_NEEDED ( $(UARGP_FULL_NAME) )" || echo "$(UARGP_FULL_NAME)")
145+else
146+export UARGP_ASNEEDED:=""
147+endif
148 endif
149
150 # Add a bunch of extra pedantic annoyingly strict checks
151Index: git/extra/Configs/Config.in
152===================================================================
153--- git.orig/extra/Configs/Config.in
154+++ git/extra/Configs/Config.in
155@@ -1814,6 +1814,23 @@ config UCLIBC_HAS_GNU_GETSUBOPT
156 smaller SUSv3 compatible getsubopt().
157
158 Most people will answer Y.
159+
160+config UCLIBC_HAS_ARGP
161+ bool "Support argp (as standalone shared object)"
162+ default n
163+ help
164+ Argp is an interface for parsing unix-style argument vectors. Unlike
165+ the common getopt interface, it provides many advanced features in
166+ addition to parsing options, such as automatic output in response to
167+ `--help' and `--version' options.
168+ A library can export an argp option parser, which programs can easily
169+ use in conjunction with their own option parser.
170+ A new shared object "libuargp" is created. The "libc.so" linker script
171+ contains the AS_NEEDED entry for getting the libuargp linked automatically.
172+ Argp support is needed by elfutils libdw.
173+
174+ Most people can safely answer N.
175+
176 endmenu
177
178
179Index: git/libc/sysdeps/linux/common/bits/getopt_int.h
180===================================================================
181--- /dev/null
182+++ git/libc/sysdeps/linux/common/bits/getopt_int.h
183@@ -0,0 +1,136 @@
184+/* Internal declarations for getopt.
185+ Copyright (C) 1989-1994,1996-1999,2001,2003,2004
186+ Free Software Foundation, Inc.
187+ This file is part of the GNU C Library.
188+
189+ The GNU C Library is free software; you can redistribute it and/or
190+ modify it under the terms of the GNU Lesser General Public
191+ License as published by the Free Software Foundation; either
192+ version 2.1 of the License, or (at your option) any later version.
193+
194+ The GNU C Library is distributed in the hope that it will be useful,
195+ but WITHOUT ANY WARRANTY; without even the implied warranty of
196+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
197+ Lesser General Public License for more details.
198+
199+ You should have received a copy of the GNU Lesser General Public
200+ License along with the GNU C Library; if not, write to the Free
201+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
202+ 02111-1307 USA. */
203+
204+#ifndef _GETOPT_INT_H
205+#define _GETOPT_INT_H 1
206+
207+extern int _getopt_internal (int ___argc, char *const *___argv,
208+ const char *__shortopts,
209+ const struct option *__longopts, int *__longind,
210+ int __long_only) attribute_hidden;
211+
212+
213+/* Reentrant versions which can handle parsing multiple argument
214+ vectors at the same time. */
215+
216+/* For __ordering member */
217+enum {
218+ REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
219+};
220+
221+/* Data type for reentrant functions. */
222+
223+struct _getopt_data
224+{
225+ /* These have exactly the same meaning as the corresponding global
226+ variables, except that they are used for the reentrant
227+ versions of getopt. */
228+ int optind;
229+ int opterr;
230+ char *optarg;
231+ smalluint optopt; /* we store characters here, a byte is enough */
232+
233+ /* Internal members. */
234+
235+ /* True if the internal members have been initialized. */
236+ smallint __initialized;
237+
238+ /* Describe how to deal with options that follow non-option ARGV-elements.
239+
240+ If the caller did not specify anything,
241+ the default is REQUIRE_ORDER if the environment variable
242+ POSIXLY_CORRECT is defined, PERMUTE otherwise.
243+
244+ REQUIRE_ORDER means don't recognize them as options;
245+ stop option processing when the first non-option is seen.
246+ This is what Unix does.
247+ This mode of operation is selected by either setting the environment
248+ variable POSIXLY_CORRECT, or using `+' as the first character
249+ of the list of option characters.
250+
251+ PERMUTE is the default. We permute the contents of ARGV as we
252+ scan, so that eventually all the non-options are at the end.
253+ This allows options to be given in any order, even with programs
254+ that were not written to expect this.
255+
256+ RETURN_IN_ORDER is an option available to programs that were
257+ written to expect options and other ARGV-elements in any order
258+ and that care about the ordering of the two. We describe each
259+ non-option ARGV-element as if it were the argument of an option
260+ with character code 1. Using `-' as the first character of the
261+ list of option characters selects this mode of operation.
262+
263+ The special argument `--' forces an end of option-scanning regardless
264+ of the value of `ordering'. In the case of RETURN_IN_ORDER, only
265+ `--' can cause `getopt' to return -1 with `optind' != ARGC. */
266+ smallint __ordering;
267+
268+ /* If the POSIXLY_CORRECT environment variable is set. */
269+ smallint __posixly_correct;
270+
271+ /* The next char to be scanned in the option-element
272+ in which the last option character we returned was found.
273+ This allows us to pick up the scan where we left off.
274+
275+ If this is zero, or a null string, it means resume the scan
276+ by advancing to the next ARGV-element. */
277+ char *__nextchar;
278+
279+
280+ /* Handle permutation of arguments. */
281+
282+ /* Describe the part of ARGV that contains non-options that have
283+ been skipped. `first_nonopt' is the index in ARGV of the first
284+ of them; `last_nonopt' is the index after the last of them. */
285+
286+ int __first_nonopt;
287+ int __last_nonopt;
288+
289+#if defined _LIBC && defined USE_NONOPTION_FLAGS
290+ int __nonoption_flags_max_len;
291+ int __nonoption_flags_len;
292+# endif
293+};
294+
295+/* The initializer is necessary to set OPTIND and OPTERR to their
296+ default values and to clear the initialization flag. */
297+#define _GETOPT_DATA_INITIALIZER { 1, 1 }
298+
299+#if 0 /* first is static on uClibc, the others not used */
300+extern int _getopt_internal_r (int ___argc, char *const *___argv,
301+ const char *__shortopts,
302+ const struct option *__longopts, int *__longind,
303+ int __long_only, struct _getopt_data *__data);
304+#endif
305+#if defined __UCLIBC_HAS_GNU_GETOPT__ || defined __UCLIBC_HAS_GETOPT_LONG__
306+#ifndef __need_getopt
307+extern int _getopt_long_r (int ___argc, char *const *___argv,
308+ const char *__shortopts,
309+ const struct option *__longopts, int *__longind,
310+ struct _getopt_data *__data);
311+
312+extern int _getopt_long_only_r (int ___argc, char *const *___argv,
313+ const char *__shortopts,
314+ const struct option *__longopts,
315+ int *__longind,
316+ struct _getopt_data *__data);
317+#endif
318+#endif
319+#endif /* getopt_int.h */
320Index: git/libc/unistd/getopt.c
321===================================================================
322--- git.orig/libc/unistd/getopt.c
323+++ git/libc/unistd/getopt.c
324@@ -119,7 +119,7 @@
325 they can distinguish the relative order of options and other arguments. */
326
327 #include <getopt.h>
328-#include "getopt_int.h"
329+#include <bits/getopt_int.h>
330
331
332 /* For communication from `getopt' to the caller.
333@@ -1183,6 +1183,15 @@ getopt_long (int argc, char *const *argv
334 return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
335 }
336
337+int
338+_getopt_long_r (int argc, char *const *argv, const char *options,
339+ const struct option *long_options, int *opt_index,
340+ struct _getopt_data *d)
341+{
342+ return _getopt_internal_r (argc, argv, options, long_options, opt_index,
343+ 0, d);
344+}
345+
346 /* Like getopt_long, but '-' as well as '--' can indicate a long option.
347 If an option that starts with '-' (not '--') doesn't match a long option,
348 but does match a short option, it is parsed as a short option
349@@ -1195,4 +1204,12 @@ getopt_long_only (int argc, char *const
350 return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
351 }
352
353+int
354+_getopt_long_only_r (int argc, char *const *argv, const char *options,
355+ const struct option *long_options, int *opt_index,
356+ struct _getopt_data *d)
357+{
358+ return _getopt_internal_r (argc, argv, options, long_options, opt_index, 1, d);
359+}
360+
361 #endif /* Not ELIDE_CODE. */
362Index: git/libuargp/Makefile
363===================================================================
364--- /dev/null
365+++ git/libuargp/Makefile
366@@ -0,0 +1,14 @@
367+# Makefile for uClibc (libuargp)
368+#
369+# Copyright (C) 2010 STMicroelectronics Ltd
370+# Author(s): Filippo Arcidiacono <filippo.arcidiacono at st.com>
371+#
372+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
373+#
374+
375+top_srcdir=../
376+top_builddir=../
377+include $(top_builddir)Rules.mak
378+all: libs
379+include Makefile.in
380+include $(top_srcdir)Makerules
381Index: git/libuargp/Makefile.in
382===================================================================
383--- /dev/null
384+++ git/libuargp/Makefile.in
385@@ -0,0 +1,73 @@
386+# Makefile for uClibc (libuargp)
387+#
388+# Copyright (C) 2009, 2010 STMicroelectronics Ltd.
389+# Author(s): Salvatore Cro <salvatore.cro at st.com>
390+# - First implementation, embedded into libc
391+# Filippo Arcidiacono <filippo.arcidiacono at st.com>
392+# - Reworked for stand-alone libuargp implementation
393+
394+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
395+#
396+
397+CFLAGS-libuargp := -DNOT_IN_libc -DIS_IN_libuargp $(SSP_ALL_CFLAGS)
398+
399+LDFLAGS-libuargp.so := $(LDFLAGS)
400+
401+LIBS-libuargp.so := $(LIBS)
402+
403+libuargp_FULL_NAME := libuargp-$(VERSION).so
404+
405+libuargp_DIR := $(top_srcdir)libuargp
406+libuargp_OUT := $(top_builddir)libuargp
407+
408+libuargp_SRC-y :=
409+libuargp_SRC-$(UCLIBC_HAS_ARGP) := $(addsuffix .c,$(addprefix argp-, ba \
410+ eexst fmtstream fs-xinl help parse pv pvh xinl))
411+
412+CFLAGS-argp-xinl.c = -fgnu89-inline
413+
414+libuargp_SRC := $(addprefix $(libuargp_DIR)/,$(libuargp_SRC-y))
415+libuargp_OBJ := $(patsubst $(libuargp_DIR)/%.c,$(libuargp_OUT)/%.o,$(libuargp_SRC))
416+
417+libuargp_SRCS := $(libuargp_SRC)
418+libuargp_OBJS := $(libuargp_OBJ)
419+
420+ifeq ($(DOPIC),y)
421+libuargp-a-y := $(libuargp_OBJS:.o=.os)
422+else
423+libuargp-a-y := $(libuargp_OBJS)
424+endif
425+libuargp-so-y := $(libuargp_OBJS:.o=.os)
426+
427+lib-a-$(UCLIBC_HAS_ARGP) += $(top_builddir)lib/libuargp.a
428+lib-so-$(UCLIBC_HAS_ARGP) += $(top_builddir)lib/libuargp.so
429+
430+objclean-y += CLEAN_libuargp
431+
432+ifeq ($(DOMULTI),n)
433+ifeq ($(DOPIC),y)
434+$(top_builddir)lib/libuargp.so: $(top_builddir)lib/libuargp.a $(libc.depend)
435+else
436+$(top_builddir)lib/libuargp.so: $(libuargp_OUT)/libuargp_so.a $(libc.depend)
437+endif
438+ $(call link.so,$(libuargp_FULL_NAME),$(MAJOR_VERSION))
439+else
440+$(top_builddir)lib/libuargp.so: $(libuargp_OUT)/libuargp.oS $(libc.depend)
441+ $(call linkm.so,$(libuargp_FULL_NAME),$(MAJOR_VERSION))
442+endif
443+
444+$(libuargp_OUT)/libuargp_so.a: $(libuargp-so-y)
445+ $(Q)$(RM) $@
446+ $(do_ar)
447+
448+$(libuargp_OUT)/libuargp.oS: $(libuargp_SRCS)
449+ $(Q)$(RM) $@
450+ $(compile-m)
451+
452+$(top_builddir)lib/libuargp.a: $(libuargp-a-y)
453+ $(Q)$(INSTALL) -d $(dir $@)
454+ $(Q)$(RM) $@
455+ $(do_ar)
456+
457+CLEAN_libuargp:
458+ $(do_rm) $(addprefix $(libuargp_OUT)/*., o os oS a)
459Index: git/libuargp/argp-ba.c
460===================================================================
461--- /dev/null
462+++ git/libuargp/argp-ba.c
463@@ -0,0 +1,26 @@
464+/* Default definition for ARGP_PROGRAM_BUG_ADDRESS.
465+ Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
466+ This file is part of the GNU C Library.
467+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
468+
469+ The GNU C Library is free software; you can redistribute it and/or
470+ modify it under the terms of the GNU Lesser General Public
471+ License as published by the Free Software Foundation; either
472+ version 2.1 of the License, or (at your option) any later version.
473+
474+ The GNU C Library is distributed in the hope that it will be useful,
475+ but WITHOUT ANY WARRANTY; without even the implied warranty of
476+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
477+ Lesser General Public License for more details.
478+
479+ You should have received a copy of the GNU Lesser General Public
480+ License along with the GNU C Library; if not, write to the Free
481+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
482+ 02111-1307 USA. */
483+
484+/* If set by the user program, it should point to string that is the
485+ bug-reporting address for the program. It will be printed by argp_help if
486+ the ARGP_HELP_BUG_ADDR flag is set (as it is by various standard help
487+ messages), embedded in a sentence that says something like `Report bugs to
488+ ADDR.'. */
489+const char *argp_program_bug_address;
490Index: git/libuargp/argp-eexst.c
491===================================================================
492--- /dev/null
493+++ git/libuargp/argp-eexst.c
494@@ -0,0 +1,32 @@
495+/* Default definition for ARGP_ERR_EXIT_STATUS
496+ Copyright (C) 1997 Free Software Foundation, Inc.
497+ This file is part of the GNU C Library.
498+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
499+
500+ The GNU C Library is free software; you can redistribute it and/or
501+ modify it under the terms of the GNU Lesser General Public
502+ License as published by the Free Software Foundation; either
503+ version 2.1 of the License, or (at your option) any later version.
504+
505+ The GNU C Library is distributed in the hope that it will be useful,
506+ but WITHOUT ANY WARRANTY; without even the implied warranty of
507+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
508+ Lesser General Public License for more details.
509+
510+ You should have received a copy of the GNU Lesser General Public
511+ License along with the GNU C Library; if not, write to the Free
512+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
513+ 02111-1307 USA. */
514+
515+#ifdef HAVE_CONFIG_H
516+# include <config.h>
517+#endif
518+
519+#include <sysexits.h>
520+
521+#include <argp.h>
522+
523+/* The exit status that argp will use when exiting due to a parsing error.
524+ If not defined or set by the user program, this defaults to EX_USAGE from
525+ <sysexits.h>. */
526+error_t argp_err_exit_status = EX_USAGE;
527Index: git/libuargp/argp-fmtstream.c
528===================================================================
529--- /dev/null
530+++ git/libuargp/argp-fmtstream.c
531@@ -0,0 +1,439 @@
532+/* Word-wrapping and line-truncating streams
533+ Copyright (C) 1997-1999,2001,2002,2003,2005 Free Software Foundation, Inc.
534+ This file is part of the GNU C Library.
535+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
536+
537+ The GNU C Library is free software; you can redistribute it and/or
538+ modify it under the terms of the GNU Lesser General Public
539+ License as published by the Free Software Foundation; either
540+ version 2.1 of the License, or (at your option) any later version.
541+
542+ The GNU C Library is distributed in the hope that it will be useful,
543+ but WITHOUT ANY WARRANTY; without even the implied warranty of
544+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
545+ Lesser General Public License for more details.
546+
547+ You should have received a copy of the GNU Lesser General Public
548+ License along with the GNU C Library; if not, write to the Free
549+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
550+ 02111-1307 USA.
551+
552+ Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com>
553+*/
554+
555+/* This package emulates glibc `line_wrap_stream' semantics for systems that
556+ don't have that. */
557+
558+#ifdef HAVE_CONFIG_H
559+# include <config.h>
560+#endif
561+
562+#include <stdlib.h>
563+#include <string.h>
564+#include <errno.h>
565+#include <stdarg.h>
566+#include <ctype.h>
567+
568+#include "argp-fmtstream.h"
569+
570+#ifndef ARGP_FMTSTREAM_USE_LINEWRAP
571+
572+#ifndef isblank
573+#define isblank(ch) ((ch)==' ' || (ch)=='\t')
574+#endif
575+
576+#if defined _LIBC && defined USE_IN_LIBIO
577+# include <wchar.h>
578+# include <libio/libioP.h>
579+# define __vsnprintf(s, l, f, a) _IO_vsnprintf (s, l, f, a)
580+#else
581+# define __vsnprintf(s, l, f, a) vsnprintf (s, l, f, a)
582+#endif
583+
584+#define INIT_BUF_SIZE 200
585+#define PRINTF_SIZE_GUESS 150
586+
587+/* Return an argp_fmtstream that outputs to STREAM, and which prefixes lines
588+ written on it with LMARGIN spaces and limits them to RMARGIN columns
589+ total. If WMARGIN >= 0, words that extend past RMARGIN are wrapped by
590+ replacing the whitespace before them with a newline and WMARGIN spaces.
591+ Otherwise, chars beyond RMARGIN are simply dropped until a newline.
592+ Returns NULL if there was an error. */
593+argp_fmtstream_t
594+__argp_make_fmtstream (FILE *stream,
595+ size_t lmargin, size_t rmargin, ssize_t wmargin)
596+{
597+ argp_fmtstream_t fs;
598+
599+ fs = (struct argp_fmtstream *) malloc (sizeof (struct argp_fmtstream));
600+ if (fs != NULL)
601+ {
602+ fs->stream = stream;
603+
604+ fs->lmargin = lmargin;
605+ fs->rmargin = rmargin;
606+ fs->wmargin = wmargin;
607+ fs->point_col = 0;
608+ fs->point_offs = 0;
609+
610+ fs->buf = (char *) malloc (INIT_BUF_SIZE);
611+ if (! fs->buf)
612+ {
613+ free (fs);
614+ fs = 0;
615+ }
616+ else
617+ {
618+ fs->p = fs->buf;
619+ fs->end = fs->buf + INIT_BUF_SIZE;
620+ }
621+ }
622+
623+ return fs;
624+}
625+#if 0
626+/* Not exported. */
627+#ifdef weak_alias
628+weak_alias (__argp_make_fmtstream, argp_make_fmtstream)
629+#endif
630+#endif
631+
632+/* Flush FS to its stream, and free it (but don't close the stream). */
633+void
634+__argp_fmtstream_free (argp_fmtstream_t fs)
635+{
636+ __argp_fmtstream_update (fs);
637+ if (fs->p > fs->buf)
638+ {
639+#ifdef USE_IN_LIBIO
640+ __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf);
641+#else
642+ fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
643+#endif
644+ }
645+ free (fs->buf);
646+ free (fs);
647+}
648+#if 0
649+/* Not exported. */
650+#ifdef weak_alias
651+weak_alias (__argp_fmtstream_free, argp_fmtstream_free)
652+#endif
653+#endif
654+
655+/* Process FS's buffer so that line wrapping is done from POINT_OFFS to the
656+ end of its buffer. This code is mostly from glibc stdio/linewrap.c. */
657+void
658+__argp_fmtstream_update (argp_fmtstream_t fs)
659+{
660+ char *buf, *nl;
661+ size_t len;
662+
663+ /* Scan the buffer for newlines. */
664+ buf = fs->buf + fs->point_offs;
665+ while (buf < fs->p)
666+ {
667+ size_t r;
668+
669+ if (fs->point_col == 0 && fs->lmargin != 0)
670+ {
671+ /* We are starting a new line. Print spaces to the left margin. */
672+ const size_t pad = fs->lmargin;
673+ if (fs->p + pad < fs->end)
674+ {
675+ /* We can fit in them in the buffer by moving the
676+ buffer text up and filling in the beginning. */
677+ memmove (buf + pad, buf, fs->p - buf);
678+ fs->p += pad; /* Compensate for bigger buffer. */
679+ memset (buf, ' ', pad); /* Fill in the spaces. */
680+ buf += pad; /* Don't bother searching them. */
681+ }
682+ else
683+ {
684+ /* No buffer space for spaces. Must flush. */
685+ size_t i;
686+ for (i = 0; i < pad; i++)
687+ {
688+#ifdef USE_IN_LIBIO
689+ if (_IO_fwide (fs->stream, 0) > 0)
690+ putwc_unlocked (L' ', fs->stream);
691+ else
692+#endif
693+ putc_unlocked (' ', fs->stream);
694+ }
695+ }
696+ fs->point_col = pad;
697+ }
698+
699+ len = fs->p - buf;
700+ nl = memchr (buf, '\n', len);
701+
702+ if (fs->point_col < 0)
703+ fs->point_col = 0;
704+
705+ if (!nl)
706+ {
707+ /* The buffer ends in a partial line. */
708+
709+ if (fs->point_col + len < fs->rmargin)
710+ {
711+ /* The remaining buffer text is a partial line and fits
712+ within the maximum line width. Advance point for the
713+ characters to be written and stop scanning. */
714+ fs->point_col += len;
715+ break;
716+ }
717+ else
718+ /* Set the end-of-line pointer for the code below to
719+ the end of the buffer. */
720+ nl = fs->p;
721+ }
722+ else if (fs->point_col + (nl - buf) < (ssize_t) fs->rmargin)
723+ {
724+ /* The buffer contains a full line that fits within the maximum
725+ line width. Reset point and scan the next line. */
726+ fs->point_col = 0;
727+ buf = nl + 1;
728+ continue;
729+ }
730+
731+ /* This line is too long. */
732+ r = fs->rmargin - 1;
733+
734+ if (fs->wmargin < 0)
735+ {
736+ /* Truncate the line by overwriting the excess with the
737+ newline and anything after it in the buffer. */
738+ if (nl < fs->p)
739+ {
740+ memmove (buf + (r - fs->point_col), nl, fs->p - nl);
741+ fs->p -= buf + (r - fs->point_col) - nl;
742+ /* Reset point for the next line and start scanning it. */
743+ fs->point_col = 0;
744+ buf += r + 1; /* Skip full line plus \n. */
745+ }
746+ else
747+ {
748+ /* The buffer ends with a partial line that is beyond the
749+ maximum line width. Advance point for the characters
750+ written, and discard those past the max from the buffer. */
751+ fs->point_col += len;
752+ fs->p -= fs->point_col - r;
753+ break;
754+ }
755+ }
756+ else
757+ {
758+ /* Do word wrap. Go to the column just past the maximum line
759+ width and scan back for the beginning of the word there.
760+ Then insert a line break. */
761+
762+ char *p, *nextline;
763+ int i;
764+
765+ p = buf + (r + 1 - fs->point_col);
766+ while (p >= buf && !isblank (*p))
767+ --p;
768+ nextline = p + 1; /* This will begin the next line. */
769+
770+ if (nextline > buf)
771+ {
772+ /* Swallow separating blanks. */
773+ if (p >= buf)
774+ do
775+ --p;
776+ while (p >= buf && isblank (*p));
777+ nl = p + 1; /* The newline will replace the first blank. */
778+ }
779+ else
780+ {
781+ /* A single word that is greater than the maximum line width.
782+ Oh well. Put it on an overlong line by itself. */
783+ p = buf + (r + 1 - fs->point_col);
784+ /* Find the end of the long word. */
785+ do
786+ ++p;
787+ while (p < nl && !isblank (*p));
788+ if (p == nl)
789+ {
790+ /* It already ends a line. No fussing required. */
791+ fs->point_col = 0;
792+ buf = nl + 1;
793+ continue;
794+ }
795+ /* We will move the newline to replace the first blank. */
796+ nl = p;
797+ /* Swallow separating blanks. */
798+ do
799+ ++p;
800+ while (isblank (*p));
801+ /* The next line will start here. */
802+ nextline = p;
803+ }
804+
805+ /* Note: There are a bunch of tests below for
806+ NEXTLINE == BUF + LEN + 1; this case is where NL happens to fall
807+ at the end of the buffer, and NEXTLINE is in fact empty (and so
808+ we need not be careful to maintain its contents). */
809+
810+ if ((nextline == buf + len + 1
811+ ? fs->end - nl < fs->wmargin + 1
812+ : nextline - (nl + 1) < fs->wmargin)
813+ && fs->p > nextline)
814+ {
815+ /* The margin needs more blanks than we removed. */
816+ if (fs->end - fs->p > fs->wmargin + 1)
817+ /* Make some space for them. */
818+ {
819+ size_t mv = fs->p - nextline;
820+ memmove (nl + 1 + fs->wmargin, nextline, mv);
821+ nextline = nl + 1 + fs->wmargin;
822+ len = nextline + mv - buf;
823+ *nl++ = '\n';
824+ }
825+ else
826+ /* Output the first line so we can use the space. */
827+ {
828+#if defined _LIBC && defined USE_IN_LIBIO
829+ __fxprintf (fs->stream, "%.*s\n",
830+ (int) (nl - fs->buf), fs->buf);
831+#else
832+ if (nl > fs->buf)
833+ fwrite_unlocked (fs->buf, 1, nl - fs->buf, fs->stream);
834+ putc_unlocked ('\n', fs->stream);
835+#endif
836+
837+ len += buf - fs->buf;
838+ nl = buf = fs->buf;
839+ }
840+ }
841+ else
842+ /* We can fit the newline and blanks in before
843+ the next word. */
844+ *nl++ = '\n';
845+
846+ if (nextline - nl >= fs->wmargin
847+ || (nextline == buf + len + 1 && fs->end - nextline >= fs->wmargin))
848+ /* Add blanks up to the wrap margin column. */
849+ for (i = 0; i < fs->wmargin; ++i)
850+ *nl++ = ' ';
851+ else
852+ for (i = 0; i < fs->wmargin; ++i)
853+#ifdef USE_IN_LIBIO
854+ if (_IO_fwide (fs->stream, 0) > 0)
855+ putwc_unlocked (L' ', fs->stream);
856+ else
857+#endif
858+ putc_unlocked (' ', fs->stream);
859+
860+ /* Copy the tail of the original buffer into the current buffer
861+ position. */
862+ if (nl < nextline)
863+ memmove (nl, nextline, buf + len - nextline);
864+ len -= nextline - buf;
865+
866+ /* Continue the scan on the remaining lines in the buffer. */
867+ buf = nl;
868+
869+ /* Restore bufp to include all the remaining text. */
870+ fs->p = nl + len;
871+
872+ /* Reset the counter of what has been output this line. If wmargin
873+ is 0, we want to avoid the lmargin getting added, so we set
874+ point_col to a magic value of -1 in that case. */
875+ fs->point_col = fs->wmargin ? fs->wmargin : -1;
876+ }
877+ }
878+
879+ /* Remember that we've scanned as far as the end of the buffer. */
880+ fs->point_offs = fs->p - fs->buf;
881+}
882+
883+/* Ensure that FS has space for AMOUNT more bytes in its buffer, either by
884+ growing the buffer, or by flushing it. True is returned iff we succeed. */
885+int
886+__argp_fmtstream_ensure (struct argp_fmtstream *fs, size_t amount)
887+{
888+ if ((size_t) (fs->end - fs->p) < amount)
889+ {
890+ ssize_t wrote;
891+
892+ /* Flush FS's buffer. */
893+ __argp_fmtstream_update (fs);
894+
895+#if defined _LIBC && defined USE_IN_LIBIO
896+ __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf);
897+ wrote = fs->p - fs->buf;
898+#else
899+ wrote = fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
900+#endif
901+ if (wrote == fs->p - fs->buf)
902+ {
903+ fs->p = fs->buf;
904+ fs->point_offs = 0;
905+ }
906+ else
907+ {
908+ fs->p -= wrote;
909+ fs->point_offs -= wrote;
910+ memmove (fs->buf, fs->buf + wrote, fs->p - fs->buf);
911+ return 0;
912+ }
913+
914+ if ((size_t) (fs->end - fs->buf) < amount)
915+ /* Gotta grow the buffer. */
916+ {
917+ size_t old_size = fs->end - fs->buf;
918+ size_t new_size = old_size + amount;
919+ char *new_buf;
920+
921+ if (new_size < old_size || ! (new_buf = realloc (fs->buf, new_size)))
922+ {
923+ __set_errno (ENOMEM);
924+ return 0;
925+ }
926+
927+ fs->buf = new_buf;
928+ fs->end = new_buf + new_size;
929+ fs->p = fs->buf;
930+ }
931+ }
932+
933+ return 1;
934+}
935+
936+ssize_t
937+__argp_fmtstream_printf (struct argp_fmtstream *fs, const char *fmt, ...)
938+{
939+ int out;
940+ size_t avail;
941+ size_t size_guess = PRINTF_SIZE_GUESS; /* How much space to reserve. */
942+
943+ do
944+ {
945+ va_list args;
946+
947+ if (! __argp_fmtstream_ensure (fs, size_guess))
948+ return -1;
949+
950+ va_start (args, fmt);
951+ avail = fs->end - fs->p;
952+ out = __vsnprintf (fs->p, avail, fmt, args);
953+ va_end (args);
954+ if ((size_t) out >= avail)
955+ size_guess = out + 1;
956+ }
957+ while ((size_t) out >= avail);
958+
959+ fs->p += out;
960+
961+ return out;
962+}
963+#if 0
964+/* Not exported. */
965+#ifdef weak_alias
966+weak_alias (__argp_fmtstream_printf, argp_fmtstream_printf)
967+#endif
968+#endif
969+
970+#endif /* !ARGP_FMTSTREAM_USE_LINEWRAP */
971Index: git/libuargp/argp-fmtstream.h
972===================================================================
973--- /dev/null
974+++ git/libuargp/argp-fmtstream.h
975@@ -0,0 +1,314 @@
976+/* Word-wrapping and line-truncating streams.
977+ Copyright (C) 1997 Free Software Foundation, Inc.
978+ This file is part of the GNU C Library.
979+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
980+
981+ The GNU C Library is free software; you can redistribute it and/or
982+ modify it under the terms of the GNU Lesser General Public
983+ License as published by the Free Software Foundation; either
984+ version 2.1 of the License, or (at your option) any later version.
985+
986+ The GNU C Library is distributed in the hope that it will be useful,
987+ but WITHOUT ANY WARRANTY; without even the implied warranty of
988+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
989+ Lesser General Public License for more details.
990+
991+ You should have received a copy of the GNU Lesser General Public
992+ License along with the GNU C Library; if not, write to the Free
993+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
994+ 02111-1307 USA.
995+
996+ Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com>
997+*/
998+
999+/* This package emulates glibc `line_wrap_stream' semantics for systems that
1000+ don't have that. If the system does have it, it is just a wrapper for
1001+ that. This header file is only used internally while compiling argp, and
1002+ shouldn't be installed. */
1003+
1004+#ifndef _ARGP_FMTSTREAM_H
1005+#define _ARGP_FMTSTREAM_H
1006+
1007+#include <stdio.h>
1008+#include <string.h>
1009+#include <unistd.h>
1010+
1011+#ifndef __attribute__
1012+/* This feature is available in gcc versions 2.5 and later. */
1013+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || defined(__STRICT_ANSI__)
1014+# define __attribute__(Spec) /* empty */
1015+# endif
1016+/* The __-protected variants of `format' and `printf' attributes
1017+ are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
1018+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) || defined(__STRICT_ANSI__)
1019+# define __format__ format
1020+# define __printf__ printf
1021+# endif
1022+#endif
1023+
1024+#if 0 /* uClibc: disabled */
1025+#if (_LIBC - 0 && !defined (USE_IN_LIBIO)) \
1026+ || (defined (__GNU_LIBRARY__) && defined (HAVE_LINEWRAP_H))
1027+/* line_wrap_stream is available, so use that. */
1028+#define ARGP_FMTSTREAM_USE_LINEWRAP
1029+#endif
1030+#else
1031+/* line_wrap stream NOT available */
1032+# undef ARGP_FMTSTREAM_USE_LINEWRAP
1033+#endif
1034+
1035+#ifdef ARGP_FMTSTREAM_USE_LINEWRAP
1036+/* Just be a simple wrapper for line_wrap_stream; the semantics are
1037+ *slightly* different, as line_wrap_stream doesn't actually make a new
1038+ object, it just modifies the given stream (reversibly) to do
1039+ line-wrapping. Since we control who uses this code, it doesn't matter. */
1040+
1041+#include <linewrap.h>
1042+
1043+typedef FILE *argp_fmtstream_t;
1044+
1045+#define argp_make_fmtstream line_wrap_stream
1046+#define __argp_make_fmtstream line_wrap_stream
1047+#define argp_fmtstream_free line_unwrap_stream
1048+#define __argp_fmtstream_free line_unwrap_stream
1049+
1050+#define __argp_fmtstream_putc(fs,ch) putc(ch,fs)
1051+#define argp_fmtstream_putc(fs,ch) putc(ch,fs)
1052+#define __argp_fmtstream_puts(fs,str) fputs(str,fs)
1053+#define argp_fmtstream_puts(fs,str) fputs(str,fs)
1054+#define __argp_fmtstream_write(fs,str,len) fwrite(str,1,len,fs)
1055+#define argp_fmtstream_write(fs,str,len) fwrite(str,1,len,fs)
1056+#define __argp_fmtstream_printf fprintf
1057+#define argp_fmtstream_printf fprintf
1058+
1059+#define __argp_fmtstream_lmargin line_wrap_lmargin
1060+#define argp_fmtstream_lmargin line_wrap_lmargin
1061+#define __argp_fmtstream_set_lmargin line_wrap_set_lmargin
1062+#define argp_fmtstream_set_lmargin line_wrap_set_lmargin
1063+#define __argp_fmtstream_rmargin line_wrap_rmargin
1064+#define argp_fmtstream_rmargin line_wrap_rmargin
1065+#define __argp_fmtstream_set_rmargin line_wrap_set_rmargin
1066+#define argp_fmtstream_set_rmargin line_wrap_set_rmargin
1067+#define __argp_fmtstream_wmargin line_wrap_wmargin
1068+#define argp_fmtstream_wmargin line_wrap_wmargin
1069+#define __argp_fmtstream_set_wmargin line_wrap_set_wmargin
1070+#define argp_fmtstream_set_wmargin line_wrap_set_wmargin
1071+#define __argp_fmtstream_point line_wrap_point
1072+#define argp_fmtstream_point line_wrap_point
1073+
1074+#else /* !ARGP_FMTSTREAM_USE_LINEWRAP */
1075+/* Guess we have to define our own version. */
1076+
1077+#ifndef __const
1078+#define __const const
1079+#endif
1080+
1081+struct argp_fmtstream
1082+{
1083+ FILE *stream; /* The stream we're outputting to. */
1084+
1085+ size_t lmargin, rmargin; /* Left and right margins. */
1086+ ssize_t wmargin; /* Margin to wrap to, or -1 to truncate. */
1087+
1088+ /* Point in buffer to which we've processed for wrapping, but not output. */
1089+ size_t point_offs;
1090+ /* Output column at POINT_OFFS, or -1 meaning 0 but don't add lmargin. */
1091+ ssize_t point_col;
1092+
1093+ char *buf; /* Output buffer. */
1094+ char *p; /* Current end of text in BUF. */
1095+ char *end; /* Absolute end of BUF. */
1096+};
1097+
1098+typedef struct argp_fmtstream *argp_fmtstream_t;
1099+
1100+/* Return an argp_fmtstream that outputs to STREAM, and which prefixes lines
1101+ written on it with LMARGIN spaces and limits them to RMARGIN columns
1102+ total. If WMARGIN >= 0, words that extend past RMARGIN are wrapped by
1103+ replacing the whitespace before them with a newline and WMARGIN spaces.
1104+ Otherwise, chars beyond RMARGIN are simply dropped until a newline.
1105+ Returns NULL if there was an error. */
1106+extern argp_fmtstream_t __argp_make_fmtstream (FILE *__stream,
1107+ size_t __lmargin,
1108+ size_t __rmargin,
1109+ ssize_t __wmargin);
1110+extern argp_fmtstream_t argp_make_fmtstream (FILE *__stream,
1111+ size_t __lmargin,
1112+ size_t __rmargin,
1113+ ssize_t __wmargin);
1114+
1115+/* Flush __FS to its stream, and free it (but don't close the stream). */
1116+extern void __argp_fmtstream_free (argp_fmtstream_t __fs);
1117+extern void argp_fmtstream_free (argp_fmtstream_t __fs);
1118+
1119+extern ssize_t __argp_fmtstream_printf (argp_fmtstream_t __fs,
1120+ __const char *__fmt, ...)
1121+ __attribute__ ((__format__ (printf, 2, 3)));
1122+extern ssize_t argp_fmtstream_printf (argp_fmtstream_t __fs,
1123+ __const char *__fmt, ...)
1124+ __attribute__ ((__format__ (printf, 2, 3)));
1125+
1126+extern int __argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch);
1127+extern int argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch);
1128+
1129+extern int __argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str);
1130+extern int argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str);
1131+
1132+extern size_t __argp_fmtstream_write (argp_fmtstream_t __fs,
1133+ __const char *__str, size_t __len);
1134+extern size_t argp_fmtstream_write (argp_fmtstream_t __fs,
1135+ __const char *__str, size_t __len);
1136+
1137+/* Access macros for various bits of state. */
1138+#define argp_fmtstream_lmargin(__fs) ((__fs)->lmargin)
1139+#define argp_fmtstream_rmargin(__fs) ((__fs)->rmargin)
1140+#define argp_fmtstream_wmargin(__fs) ((__fs)->wmargin)
1141+#define __argp_fmtstream_lmargin argp_fmtstream_lmargin
1142+#define __argp_fmtstream_rmargin argp_fmtstream_rmargin
1143+#define __argp_fmtstream_wmargin argp_fmtstream_wmargin
1144+
1145+/* Set __FS's left margin to LMARGIN and return the old value. */
1146+extern size_t argp_fmtstream_set_lmargin (argp_fmtstream_t __fs,
1147+ size_t __lmargin);
1148+extern size_t __argp_fmtstream_set_lmargin (argp_fmtstream_t __fs,
1149+ size_t __lmargin);
1150+
1151+/* Set __FS's right margin to __RMARGIN and return the old value. */
1152+extern size_t argp_fmtstream_set_rmargin (argp_fmtstream_t __fs,
1153+ size_t __rmargin);
1154+extern size_t __argp_fmtstream_set_rmargin (argp_fmtstream_t __fs,
1155+ size_t __rmargin);
1156+
1157+/* Set __FS's wrap margin to __WMARGIN and return the old value. */
1158+extern size_t argp_fmtstream_set_wmargin (argp_fmtstream_t __fs,
1159+ size_t __wmargin);
1160+extern size_t __argp_fmtstream_set_wmargin (argp_fmtstream_t __fs,
1161+ size_t __wmargin);
1162+
1163+/* Return the column number of the current output point in __FS. */
1164+extern size_t argp_fmtstream_point (argp_fmtstream_t __fs);
1165+extern size_t __argp_fmtstream_point (argp_fmtstream_t __fs);
1166+
1167+/* Internal routines. */
1168+extern void _argp_fmtstream_update (argp_fmtstream_t __fs);
1169+extern void __argp_fmtstream_update (argp_fmtstream_t __fs);
1170+extern int _argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount);
1171+extern int __argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount);
1172+
1173+#ifdef __OPTIMIZE__
1174+/* Inline versions of above routines. */
1175+
1176+#if !_LIBC
1177+#define __argp_fmtstream_putc argp_fmtstream_putc
1178+#define __argp_fmtstream_puts argp_fmtstream_puts
1179+#define __argp_fmtstream_write argp_fmtstream_write
1180+#define __argp_fmtstream_set_lmargin argp_fmtstream_set_lmargin
1181+#define __argp_fmtstream_set_rmargin argp_fmtstream_set_rmargin
1182+#define __argp_fmtstream_set_wmargin argp_fmtstream_set_wmargin
1183+#define __argp_fmtstream_point argp_fmtstream_point
1184+#define __argp_fmtstream_update _argp_fmtstream_update
1185+#define __argp_fmtstream_ensure _argp_fmtstream_ensure
1186+#endif
1187+
1188+#ifndef ARGP_FS_EI
1189+#define ARGP_FS_EI __extern_inline
1190+#endif
1191+
1192+ARGP_FS_EI size_t
1193+__argp_fmtstream_write (argp_fmtstream_t __fs,
1194+ __const char *__str, size_t __len)
1195+{
1196+ if (__fs->p + __len <= __fs->end || __argp_fmtstream_ensure (__fs, __len))
1197+ {
1198+ memcpy (__fs->p, __str, __len);
1199+ __fs->p += __len;
1200+ return __len;
1201+ }
1202+ else
1203+ return 0;
1204+}
1205+
1206+ARGP_FS_EI int
1207+__argp_fmtstream_puts (argp_fmtstream_t __fs, __const char *__str)
1208+{
1209+ size_t __len = strlen (__str);
1210+ if (__len)
1211+ {
1212+ size_t __wrote = __argp_fmtstream_write (__fs, __str, __len);
1213+ return __wrote == __len ? 0 : -1;
1214+ }
1215+ else
1216+ return 0;
1217+}
1218+
1219+ARGP_FS_EI int
1220+__argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch)
1221+{
1222+ if (__fs->p < __fs->end || __argp_fmtstream_ensure (__fs, 1))
1223+ return *__fs->p++ = __ch;
1224+ else
1225+ return EOF;
1226+}
1227+
1228+/* Set __FS's left margin to __LMARGIN and return the old value. */
1229+ARGP_FS_EI size_t
1230+__argp_fmtstream_set_lmargin (argp_fmtstream_t __fs, size_t __lmargin)
1231+{
1232+ size_t __old;
1233+ if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs)
1234+ __argp_fmtstream_update (__fs);
1235+ __old = __fs->lmargin;
1236+ __fs->lmargin = __lmargin;
1237+ return __old;
1238+}
1239+
1240+/* Set __FS's right margin to __RMARGIN and return the old value. */
1241+ARGP_FS_EI size_t
1242+__argp_fmtstream_set_rmargin (argp_fmtstream_t __fs, size_t __rmargin)
1243+{
1244+ size_t __old;
1245+ if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs)
1246+ __argp_fmtstream_update (__fs);
1247+ __old = __fs->rmargin;
1248+ __fs->rmargin = __rmargin;
1249+ return __old;
1250+}
1251+
1252+/* Set FS's wrap margin to __WMARGIN and return the old value. */
1253+ARGP_FS_EI size_t
1254+__argp_fmtstream_set_wmargin (argp_fmtstream_t __fs, size_t __wmargin)
1255+{
1256+ size_t __old;
1257+ if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs)
1258+ __argp_fmtstream_update (__fs);
1259+ __old = __fs->wmargin;
1260+ __fs->wmargin = __wmargin;
1261+ return __old;
1262+}
1263+
1264+/* Return the column number of the current output point in __FS. */
1265+ARGP_FS_EI size_t
1266+__argp_fmtstream_point (argp_fmtstream_t __fs)
1267+{
1268+ if ((size_t) (__fs->p - __fs->buf) > __fs->point_offs)
1269+ __argp_fmtstream_update (__fs);
1270+ return __fs->point_col >= 0 ? __fs->point_col : 0;
1271+}
1272+
1273+#if !_LIBC
1274+#undef __argp_fmtstream_putc
1275+#undef __argp_fmtstream_puts
1276+#undef __argp_fmtstream_write
1277+#undef __argp_fmtstream_set_lmargin
1278+#undef __argp_fmtstream_set_rmargin
1279+#undef __argp_fmtstream_set_wmargin
1280+#undef __argp_fmtstream_point
1281+#undef __argp_fmtstream_update
1282+#undef __argp_fmtstream_ensure
1283+#endif
1284+
1285+#endif /* __OPTIMIZE__ */
1286+
1287+#endif /* ARGP_FMTSTREAM_USE_LINEWRAP */
1288+
1289+#endif /* argp-fmtstream.h */
1290Index: git/libuargp/argp-fs-xinl.c
1291===================================================================
1292--- /dev/null
1293+++ git/libuargp/argp-fs-xinl.c
1294@@ -0,0 +1,44 @@
1295+/* Real definitions for extern inline functions in argp-fmtstream.h
1296+ Copyright (C) 1997, 2003, 2004 Free Software Foundation, Inc.
1297+ This file is part of the GNU C Library.
1298+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
1299+
1300+ The GNU C Library is free software; you can redistribute it and/or
1301+ modify it under the terms of the GNU Lesser General Public
1302+ License as published by the Free Software Foundation; either
1303+ version 2.1 of the License, or (at your option) any later version.
1304+
1305+ The GNU C Library is distributed in the hope that it will be useful,
1306+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1307+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1308+ Lesser General Public License for more details.
1309+
1310+ You should have received a copy of the GNU Lesser General Public
1311+ License along with the GNU C Library; if not, write to the Free
1312+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1313+ 02111-1307 USA. */
1314+
1315+#ifdef HAVE_CONFIG_H
1316+# include <config.h>
1317+#endif
1318+
1319+#define ARGP_FS_EI
1320+#undef __OPTIMIZE__
1321+#define __OPTIMIZE__ 1
1322+#include "argp-fmtstream.h"
1323+
1324+#if 0
1325+/* Not exported. */
1326+/* Add weak aliases. */
1327+#if _LIBC - 0 && !defined (ARGP_FMTSTREAM_USE_LINEWRAP) && defined (weak_alias)
1328+
1329+weak_alias (__argp_fmtstream_putc, argp_fmtstream_putc)
1330+weak_alias (__argp_fmtstream_puts, argp_fmtstream_puts)
1331+weak_alias (__argp_fmtstream_write, argp_fmtstream_write)
1332+weak_alias (__argp_fmtstream_set_lmargin, argp_fmtstream_set_lmargin)
1333+weak_alias (__argp_fmtstream_set_rmargin, argp_fmtstream_set_rmargin)
1334+weak_alias (__argp_fmtstream_set_wmargin, argp_fmtstream_set_wmargin)
1335+weak_alias (__argp_fmtstream_point, argp_fmtstream_point)
1336+
1337+#endif
1338+#endif
1339Index: git/libuargp/argp-help.c
1340===================================================================
1341--- /dev/null
1342+++ git/libuargp/argp-help.c
1343@@ -0,0 +1,1882 @@
1344+/* Hierarchial argument parsing help output
1345+ Copyright (C) 1995-2003, 2004, 2005, 2006, 2007
1346+ Free Software Foundation, Inc.
1347+ This file is part of the GNU C Library.
1348+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
1349+
1350+ The GNU C Library is free software; you can redistribute it and/or
1351+ modify it under the terms of the GNU Lesser General Public
1352+ License as published by the Free Software Foundation; either
1353+ version 2.1 of the License, or (at your option) any later version.
1354+
1355+ The GNU C Library is distributed in the hope that it will be useful,
1356+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1357+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1358+ Lesser General Public License for more details.
1359+
1360+ You should have received a copy of the GNU Lesser General Public
1361+ License along with the GNU C Library; if not, write to the Free
1362+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1363+ 02111-1307 USA.
1364+
1365+ Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com>
1366+*/
1367+
1368+#ifndef _GNU_SOURCE
1369+# define _GNU_SOURCE 1
1370+#endif
1371+
1372+#ifdef HAVE_CONFIG_H
1373+#include <config.h>
1374+#endif
1375+
1376+/* AIX requires this to be the first thing in the file. */
1377+#ifndef __GNUC__
1378+# if HAVE_ALLOCA_H || defined _LIBC
1379+# include <alloca.h>
1380+# else
1381+# ifdef _AIX
1382+#pragma alloca
1383+# else
1384+# ifndef alloca /* predefined by HP cc +Olibcalls */
1385+char *alloca ();
1386+# endif
1387+# endif
1388+# endif
1389+#endif
1390+
1391+#include <stddef.h>
1392+#include <stdlib.h>
1393+#include <string.h>
1394+#include <assert.h>
1395+#include <stdarg.h>
1396+#include <ctype.h>
1397+#include <limits.h>
1398+#ifdef _LIBC
1399+# include <wchar.h>
1400+#endif
1401+
1402+#include <features.h>
1403+#ifndef _
1404+/* This is for other GNU distributions with internationalized messages. */
1405+# if (defined HAVE_LIBINTL_H || defined _LIBC) && defined __UCLIBC_HAS_GETTEXT_AWARENESS__
1406+# include <libintl.h>
1407+# ifdef _LIBC
1408+# undef dgettext
1409+# define dgettext(domain, msgid) \
1410+ INTUSE(__dcgettext) (domain, msgid, LC_MESSAGES)
1411+# endif
1412+# else
1413+# define dgettext(domain, msgid) (msgid)
1414+# endif
1415+#endif
1416+
1417+#ifndef _LIBC
1418+# if HAVE_STRERROR_R
1419+# if !HAVE_DECL_STRERROR_R
1420+char *strerror_r (int errnum, char *buf, size_t buflen);
1421+# endif
1422+# else
1423+# if !HAVE_DECL_STRERROR
1424+char *strerror (int errnum);
1425+# endif
1426+# endif
1427+#endif
1428+
1429+#include <argp.h>
1430+#include "argp-fmtstream.h"
1431+#include <stdbool.h>
1432+#include <stdint.h>
1433+
1434+#ifndef SIZE_MAX
1435+# define SIZE_MAX ((size_t) -1)
1436+#endif
1437+
1438+/* User-selectable (using an environment variable) formatting parameters.
1439+
1440+ These may be specified in an environment variable called `ARGP_HELP_FMT',
1441+ with a contents like: VAR1=VAL1,VAR2=VAL2,BOOLVAR2,no-BOOLVAR2
1442+ Where VALn must be a positive integer. The list of variables is in the
1443+ UPARAM_NAMES vector, below. */
1444+
1445+/* Default parameters. */
1446+#define DUP_ARGS 0 /* True if option argument can be duplicated. */
1447+#define DUP_ARGS_NOTE 1 /* True to print a note about duplicate args. */
1448+#define SHORT_OPT_COL 2 /* column in which short options start */
1449+#define LONG_OPT_COL 6 /* column in which long options start */
1450+#define DOC_OPT_COL 2 /* column in which doc options start */
1451+#define OPT_DOC_COL 29 /* column in which option text starts */
1452+#define HEADER_COL 1 /* column in which group headers are printed */
1453+#define USAGE_INDENT 12 /* indentation of wrapped usage lines */
1454+#define RMARGIN 79 /* right margin used for wrapping */
1455+
1456+/* User-selectable (using an environment variable) formatting parameters.
1457+ They must all be of type `int' for the parsing code to work. */
1458+struct uparams
1459+{
1460+ /* If true, arguments for an option are shown with both short and long
1461+ options, even when a given option has both, e.g. `-x ARG, --longx=ARG'.
1462+ If false, then if an option has both, the argument is only shown with
1463+ the long one, e.g., `-x, --longx=ARG', and a message indicating that
1464+ this really means both is printed below the options. */
1465+ int dup_args;
1466+
1467+ /* This is true if when DUP_ARGS is false, and some duplicate arguments have
1468+ been suppressed, an explanatory message should be printed. */
1469+ int dup_args_note;
1470+
1471+ /* Various output columns. */
1472+ int short_opt_col;
1473+ int long_opt_col;
1474+ int doc_opt_col;
1475+ int opt_doc_col;
1476+ int header_col;
1477+ int usage_indent;
1478+ int rmargin;
1479+};
1480+
1481+/* This is a global variable, as user options are only ever read once. */
1482+static struct uparams uparams = {
1483+ DUP_ARGS, DUP_ARGS_NOTE,
1484+ SHORT_OPT_COL, LONG_OPT_COL, DOC_OPT_COL, OPT_DOC_COL, HEADER_COL,
1485+ USAGE_INDENT, RMARGIN
1486+};
1487+
1488+/* A particular uparam, and what the user name is. */
1489+struct uparam_name
1490+{
1491+ const char name[14]; /* User name. */
1492+ bool is_bool; /* Whether it's `boolean'. */
1493+ uint8_t uparams_offs; /* Location of the (int) field in UPARAMS. */
1494+};
1495+
1496+/* The name-field mappings we know about. */
1497+static const struct uparam_name uparam_names[] =
1498+{
1499+ { "dup-args", true, offsetof (struct uparams, dup_args) },
1500+ { "dup-args-note", true, offsetof (struct uparams, dup_args_note) },
1501+ { "short-opt-col", false, offsetof (struct uparams, short_opt_col) },
1502+ { "long-opt-col", false, offsetof (struct uparams, long_opt_col) },
1503+ { "doc-opt-col", false, offsetof (struct uparams, doc_opt_col) },
1504+ { "opt-doc-col", false, offsetof (struct uparams, opt_doc_col) },
1505+ { "header-col", false, offsetof (struct uparams, header_col) },
1506+ { "usage-indent", false, offsetof (struct uparams, usage_indent) },
1507+ { "rmargin", false, offsetof (struct uparams, rmargin) }
1508+};
1509+#define nuparam_names (sizeof (uparam_names) / sizeof (uparam_names[0]))
1510+
1511+/* Read user options from the environment, and fill in UPARAMS appropiately. */
1512+static void
1513+fill_in_uparams (const struct argp_state *state)
1514+{
1515+ const char *var = getenv ("ARGP_HELP_FMT");
1516+
1517+#define SKIPWS(p) do { while (isspace (*p)) p++; } while (0);
1518+
1519+ if (var)
1520+ /* Parse var. */
1521+ while (*var)
1522+ {
1523+ SKIPWS (var);
1524+
1525+ if (isalpha (*var))
1526+ {
1527+ size_t var_len;
1528+ const struct uparam_name *un;
1529+ int unspec = 0, val = 0;
1530+ const char *arg = var;
1531+
1532+ while (isalnum (*arg) || *arg == '-' || *arg == '_')
1533+ arg++;
1534+ var_len = arg - var;
1535+
1536+ SKIPWS (arg);
1537+
1538+ if (*arg == '\0' || *arg == ',')
1539+ unspec = 1;
1540+ else if (*arg == '=')
1541+ {
1542+ arg++;
1543+ SKIPWS (arg);
1544+ }
1545+
1546+ if (unspec)
1547+ {
1548+ if (var[0] == 'n' && var[1] == 'o' && var[2] == '-')
1549+ {
1550+ val = 0;
1551+ var += 3;
1552+ var_len -= 3;
1553+ }
1554+ else
1555+ val = 1;
1556+ }
1557+ else if (isdigit (*arg))
1558+ {
1559+ val = atoi (arg);
1560+ while (isdigit (*arg))
1561+ arg++;
1562+ SKIPWS (arg);
1563+ }
1564+
1565+ un = uparam_names;
1566+ size_t u;
1567+ for (u = 0; u < nuparam_names; ++un, ++u)
1568+ if (strlen (un->name) == var_len
1569+ && strncmp (var, un->name, var_len) == 0)
1570+ {
1571+ if (unspec && !un->is_bool)
1572+ argp_failure (state, 0, 0,
1573+ dgettext (state == NULL ? NULL
1574+ : state->root_argp->argp_domain,
1575+ "\
1576+%.*s: ARGP_HELP_FMT parameter requires a value"),
1577+ (int) var_len, var);
1578+ else
1579+ *(int *)((char *)&uparams + un->uparams_offs) = val;
1580+ break;
1581+ }
1582+ if (u == nuparam_names)
1583+ argp_failure (state, 0, 0,
1584+ dgettext (state == NULL ? NULL
1585+ : state->root_argp->argp_domain, "\
1586+%.*s: Unknown ARGP_HELP_FMT parameter"),
1587+ (int) var_len, var);
1588+
1589+ var = arg;
1590+ if (*var == ',')
1591+ var++;
1592+ }
1593+ else if (*var)
1594+ {
1595+ argp_failure (state, 0, 0,
1596+ dgettext (state == NULL ? NULL
1597+ : state->root_argp->argp_domain,
1598+ "Garbage in ARGP_HELP_FMT: %s"), var);
1599+ break;
1600+ }
1601+ }
1602+}
1603+
1604+/* Returns true if OPT hasn't been marked invisible. Visibility only affects
1605+ whether OPT is displayed or used in sorting, not option shadowing. */
1606+#define ovisible(opt) (! ((opt)->flags & OPTION_HIDDEN))
1607+
1608+/* Returns true if OPT is an alias for an earlier option. */
1609+#define oalias(opt) ((opt)->flags & OPTION_ALIAS)
1610+
1611+/* Returns true if OPT is an documentation-only entry. */
1612+#define odoc(opt) ((opt)->flags & OPTION_DOC)
1613+
1614+/* Returns true if OPT is the end-of-list marker for a list of options. */
1615+#define oend(opt) __option_is_end (opt)
1616+
1617+/* Returns true if OPT has a short option. */
1618+#define oshort(opt) __option_is_short (opt)
1619+
1620+/*
1621+ The help format for a particular option is like:
1622+
1623+ -xARG, -yARG, --long1=ARG, --long2=ARG Documentation...
1624+
1625+ Where ARG will be omitted if there's no argument, for this option, or
1626+ will be surrounded by "[" and "]" appropiately if the argument is
1627+ optional. The documentation string is word-wrapped appropiately, and if
1628+ the list of options is long enough, it will be started on a separate line.
1629+ If there are no short options for a given option, the first long option is
1630+ indented slighly in a way that's supposed to make most long options appear
1631+ to be in a separate column.
1632+
1633+ For example, the following output (from ps):
1634+
1635+ -p PID, --pid=PID List the process PID
1636+ --pgrp=PGRP List processes in the process group PGRP
1637+ -P, -x, --no-parent Include processes without parents
1638+ -Q, --all-fields Don't elide unusable fields (normally if there's
1639+ some reason ps can't print a field for any
1640+ process, it's removed from the output entirely)
1641+ -r, --reverse, --gratuitously-long-reverse-option
1642+ Reverse the order of any sort
1643+ --session[=SID] Add the processes from the session SID (which
1644+ defaults to the sid of the current process)
1645+
1646+ Here are some more options:
1647+ -f ZOT, --foonly=ZOT Glork a foonly
1648+ -z, --zaza Snit a zar
1649+
1650+ -?, --help Give this help list
1651+ --usage Give a short usage message
1652+ -V, --version Print program version
1653+
1654+ The struct argp_option array for the above could look like:
1655+
1656+ {
1657+ {"pid", 'p', "PID", 0, "List the process PID"},
1658+ {"pgrp", OPT_PGRP, "PGRP", 0, "List processes in the process group PGRP"},
1659+ {"no-parent", 'P', 0, 0, "Include processes without parents"},
1660+ {0, 'x', 0, OPTION_ALIAS},
1661+ {"all-fields",'Q', 0, 0, "Don't elide unusable fields (normally"
1662+ " if there's some reason ps can't"
1663+ " print a field for any process, it's"
1664+ " removed from the output entirely)" },
1665+ {"reverse", 'r', 0, 0, "Reverse the order of any sort"},
1666+ {"gratuitously-long-reverse-option", 0, 0, OPTION_ALIAS},
1667+ {"session", OPT_SESS, "SID", OPTION_ARG_OPTIONAL,
1668+ "Add the processes from the session"
1669+ " SID (which defaults to the sid of"
1670+ " the current process)" },
1671+
1672+ {0,0,0,0, "Here are some more options:"},
1673+ {"foonly", 'f', "ZOT", 0, "Glork a foonly"},
1674+ {"zaza", 'z', 0, 0, "Snit a zar"},
1675+
1676+ {0}
1677+ }
1678+
1679+ Note that the last three options are automatically supplied by argp_parse,
1680+ unless you tell it not to with ARGP_NO_HELP.
1681+
1682+*/
1683+
1684+/* Returns true if CH occurs between BEG and END. */
1685+static int
1686+find_char (char ch, char *beg, char *end)
1687+{
1688+ while (beg < end)
1689+ if (*beg == ch)
1690+ return 1;
1691+ else
1692+ beg++;
1693+ return 0;
1694+}
1695+
1696+struct hol_cluster; /* fwd decl */
1697+
1698+struct hol_entry
1699+{
1700+ /* First option. */
1701+ const struct argp_option *opt;
1702+ /* Number of options (including aliases). */
1703+ unsigned num;
1704+
1705+ /* A pointers into the HOL's short_options field, to the first short option
1706+ letter for this entry. The order of the characters following this point
1707+ corresponds to the order of options pointed to by OPT, and there are at
1708+ most NUM. A short option recorded in a option following OPT is only
1709+ valid if it occurs in the right place in SHORT_OPTIONS (otherwise it's
1710+ probably been shadowed by some other entry). */
1711+ char *short_options;
1712+
1713+ /* Entries are sorted by their group first, in the order:
1714+ 1, 2, ..., n, 0, -m, ..., -2, -1
1715+ and then alphabetically within each group. The default is 0. */
1716+ int group;
1717+
1718+ /* The cluster of options this entry belongs to, or 0 if none. */
1719+ struct hol_cluster *cluster;
1720+
1721+ /* The argp from which this option came. */
1722+ const struct argp *argp;
1723+};
1724+
1725+/* A cluster of entries to reflect the argp tree structure. */
1726+struct hol_cluster
1727+{
1728+ /* A descriptive header printed before options in this cluster. */
1729+ const char *header;
1730+
1731+ /* Used to order clusters within the same group with the same parent,
1732+ according to the order in which they occurred in the parent argp's child
1733+ list. */
1734+ int index;
1735+
1736+ /* How to sort this cluster with respect to options and other clusters at the
1737+ same depth (clusters always follow options in the same group). */
1738+ int group;
1739+
1740+ /* The cluster to which this cluster belongs, or 0 if it's at the base
1741+ level. */
1742+ struct hol_cluster *parent;
1743+
1744+ /* The argp from which this cluster is (eventually) derived. */
1745+ const struct argp *argp;
1746+
1747+ /* The distance this cluster is from the root. */
1748+ int depth;
1749+
1750+ /* Clusters in a given hol are kept in a linked list, to make freeing them
1751+ possible. */
1752+ struct hol_cluster *next;
1753+};
1754+
1755+/* A list of options for help. */
1756+struct hol
1757+{
1758+ /* An array of hol_entry's. */
1759+ struct hol_entry *entries;
1760+ /* The number of entries in this hol. If this field is zero, the others
1761+ are undefined. */
1762+ unsigned num_entries;
1763+
1764+ /* A string containing all short options in this HOL. Each entry contains
1765+ pointers into this string, so the order can't be messed with blindly. */
1766+ char *short_options;
1767+
1768+ /* Clusters of entries in this hol. */
1769+ struct hol_cluster *clusters;
1770+};
1771+
1772+/* Create a struct hol from the options in ARGP. CLUSTER is the
1773+ hol_cluster in which these entries occur, or 0, if at the root. */
1774+static struct hol *
1775+make_hol (const struct argp *argp, struct hol_cluster *cluster)
1776+{
1777+ char *so;
1778+ const struct argp_option *o;
1779+ const struct argp_option *opts = argp->options;
1780+ struct hol_entry *entry;
1781+ unsigned num_short_options = 0;
1782+ struct hol *hol = malloc (sizeof (struct hol));
1783+
1784+ assert (hol);
1785+
1786+ hol->num_entries = 0;
1787+ hol->clusters = 0;
1788+
1789+ if (opts)
1790+ {
1791+ int cur_group = 0;
1792+
1793+ /* The first option must not be an alias. */
1794+ assert (! oalias (opts));
1795+
1796+ /* Calculate the space needed. */
1797+ for (o = opts; ! oend (o); o++)
1798+ {
1799+ if (! oalias (o))
1800+ hol->num_entries++;
1801+ if (oshort (o))
1802+ num_short_options++; /* This is an upper bound. */
1803+ }
1804+
1805+ hol->entries = malloc (sizeof (struct hol_entry) * hol->num_entries);
1806+ hol->short_options = malloc (num_short_options + 1);
1807+
1808+ assert (hol->entries && hol->short_options);
1809+#if SIZE_MAX <= UINT_MAX
1810+ assert (hol->num_entries <= SIZE_MAX / sizeof (struct hol_entry));
1811+#endif
1812+
1813+ /* Fill in the entries. */
1814+ so = hol->short_options;
1815+ for (o = opts, entry = hol->entries; ! oend (o); entry++)
1816+ {
1817+ entry->opt = o;
1818+ entry->num = 0;
1819+ entry->short_options = so;
1820+ entry->group = cur_group =
1821+ o->group
1822+ ? o->group
1823+ : ((!o->name && !o->key)
1824+ ? cur_group + 1
1825+ : cur_group);
1826+ entry->cluster = cluster;
1827+ entry->argp = argp;
1828+
1829+ do
1830+ {
1831+ entry->num++;
1832+ if (oshort (o) && ! find_char (o->key, hol->short_options, so))
1833+ /* O has a valid short option which hasn't already been used.*/
1834+ *so++ = o->key;
1835+ o++;
1836+ }
1837+ while (! oend (o) && oalias (o));
1838+ }
1839+ *so = '\0'; /* null terminated so we can find the length */
1840+ }
1841+
1842+ return hol;
1843+}
1844+
1845+/* Add a new cluster to HOL, with the given GROUP and HEADER (taken from the
1846+ associated argp child list entry), INDEX, and PARENT, and return a pointer
1847+ to it. ARGP is the argp that this cluster results from. */
1848+static struct hol_cluster *
1849+hol_add_cluster (struct hol *hol, int group, const char *header, int index,
1850+ struct hol_cluster *parent, const struct argp *argp)
1851+{
1852+ struct hol_cluster *cl = malloc (sizeof (struct hol_cluster));
1853+ if (cl)
1854+ {
1855+ cl->group = group;
1856+ cl->header = header;
1857+
1858+ cl->index = index;
1859+ cl->parent = parent;
1860+ cl->argp = argp;
1861+ cl->depth = parent ? parent->depth + 1 : 0;
1862+
1863+ cl->next = hol->clusters;
1864+ hol->clusters = cl;
1865+ }
1866+ return cl;
1867+}
1868+
1869+/* Free HOL and any resources it uses. */
1870+static void
1871+hol_free (struct hol *hol)
1872+{
1873+ struct hol_cluster *cl = hol->clusters;
1874+
1875+ while (cl)
1876+ {
1877+ struct hol_cluster *next = cl->next;
1878+ free (cl);
1879+ cl = next;
1880+ }
1881+
1882+ if (hol->num_entries > 0)
1883+ {
1884+ free (hol->entries);
1885+ free (hol->short_options);
1886+ }
1887+
1888+ free (hol);
1889+}
1890+
1891+static int
1892+hol_entry_short_iterate (const struct hol_entry *entry,
1893+ int (*func)(const struct argp_option *opt,
1894+ const struct argp_option *real,
1895+ const char *domain, void *cookie),
1896+ const char *domain, void *cookie)
1897+{
1898+ unsigned nopts;
1899+ int val = 0;
1900+ const struct argp_option *opt, *real = entry->opt;
1901+ char *so = entry->short_options;
1902+
1903+ for (opt = real, nopts = entry->num; nopts > 0 && !val; opt++, nopts--)
1904+ if (oshort (opt) && *so == opt->key)
1905+ {
1906+ if (!oalias (opt))
1907+ real = opt;
1908+ if (ovisible (opt))
1909+ val = (*func)(opt, real, domain, cookie);
1910+ so++;
1911+ }
1912+
1913+ return val;
1914+}
1915+
1916+static __inline__ int
1917+__attribute__ ((always_inline))
1918+hol_entry_long_iterate (const struct hol_entry *entry,
1919+ int (*func)(const struct argp_option *opt,
1920+ const struct argp_option *real,
1921+ const char *domain, void *cookie),
1922+ const char *domain, void *cookie)
1923+{
1924+ unsigned nopts;
1925+ int val = 0;
1926+ const struct argp_option *opt, *real = entry->opt;
1927+
1928+ for (opt = real, nopts = entry->num; nopts > 0 && !val; opt++, nopts--)
1929+ if (opt->name)
1930+ {
1931+ if (!oalias (opt))
1932+ real = opt;
1933+ if (ovisible (opt))
1934+ val = (*func)(opt, real, domain, cookie);
1935+ }
1936+
1937+ return val;
1938+}
1939+
1940+/* Iterator that returns true for the first short option. */
1941+static __inline__ int
1942+until_short (const struct argp_option *opt, const struct argp_option *real,
1943+ const char *domain, void *cookie)
1944+{
1945+ return oshort (opt) ? opt->key : 0;
1946+}
1947+
1948+/* Returns the first valid short option in ENTRY, or 0 if there is none. */
1949+static char
1950+hol_entry_first_short (const struct hol_entry *entry)
1951+{
1952+ return hol_entry_short_iterate (entry, until_short,
1953+ entry->argp->argp_domain, 0);
1954+}
1955+
1956+/* Returns the first valid long option in ENTRY, or 0 if there is none. */
1957+static const char *
1958+hol_entry_first_long (const struct hol_entry *entry)
1959+{
1960+ const struct argp_option *opt;
1961+ unsigned num;
1962+ for (opt = entry->opt, num = entry->num; num > 0; opt++, num--)
1963+ if (opt->name && ovisible (opt))
1964+ return opt->name;
1965+ return 0;
1966+}
1967+
1968+/* Returns the entry in HOL with the long option name NAME, or 0 if there is
1969+ none. */
1970+static struct hol_entry *
1971+hol_find_entry (struct hol *hol, const char *name)
1972+{
1973+ struct hol_entry *entry = hol->entries;
1974+ unsigned num_entries = hol->num_entries;
1975+
1976+ while (num_entries-- > 0)
1977+ {
1978+ const struct argp_option *opt = entry->opt;
1979+ unsigned num_opts = entry->num;
1980+
1981+ while (num_opts-- > 0)
1982+ if (opt->name && ovisible (opt) && strcmp (opt->name, name) == 0)
1983+ return entry;
1984+ else
1985+ opt++;
1986+
1987+ entry++;
1988+ }
1989+
1990+ return 0;
1991+}
1992+
1993+/* If an entry with the long option NAME occurs in HOL, set it's special
1994+ sort position to GROUP. */
1995+static void
1996+hol_set_group (struct hol *hol, const char *name, int group)
1997+{
1998+ struct hol_entry *entry = hol_find_entry (hol, name);
1999+ if (entry)
2000+ entry->group = group;
2001+}
2002+
2003+/* Order by group: 0, 1, 2, ..., n, -m, ..., -2, -1.
2004+ EQ is what to return if GROUP1 and GROUP2 are the same. */
2005+static int
2006+group_cmp (int group1, int group2, int eq)
2007+{
2008+ if (group1 == group2)
2009+ return eq;
2010+ else if ((group1 < 0 && group2 < 0) || (group1 >= 0 && group2 >= 0))
2011+ return group1 - group2;
2012+ else
2013+ return group2 - group1;
2014+}
2015+
2016+/* Compare clusters CL1 & CL2 by the order that they should appear in
2017+ output. */
2018+static int
2019+hol_cluster_cmp (const struct hol_cluster *cl1, const struct hol_cluster *cl2)
2020+{
2021+ /* If one cluster is deeper than the other, use its ancestor at the same
2022+ level, so that finding the common ancestor is straightforward. */
2023+ while (cl1->depth > cl2->depth)
2024+ cl1 = cl1->parent;
2025+ while (cl2->depth > cl1->depth)
2026+ cl2 = cl2->parent;
2027+
2028+ /* Now reduce both clusters to their ancestors at the point where both have
2029+ a common parent; these can be directly compared. */
2030+ while (cl1->parent != cl2->parent)
2031+ cl1 = cl1->parent, cl2 = cl2->parent;
2032+
2033+ return group_cmp (cl1->group, cl2->group, cl2->index - cl1->index);
2034+}
2035+
2036+/* Return the ancestor of CL that's just below the root (i.e., has a parent
2037+ of 0). */
2038+static struct hol_cluster *
2039+hol_cluster_base (struct hol_cluster *cl)
2040+{
2041+ while (cl->parent)
2042+ cl = cl->parent;
2043+ return cl;
2044+}
2045+
2046+/* Return true if CL1 is a child of CL2. */
2047+static int
2048+hol_cluster_is_child (const struct hol_cluster *cl1,
2049+ const struct hol_cluster *cl2)
2050+{
2051+ while (cl1 && cl1 != cl2)
2052+ cl1 = cl1->parent;
2053+ return cl1 == cl2;
2054+}
2055+
2056+/* Given the name of a OPTION_DOC option, modifies NAME to start at the tail
2057+ that should be used for comparisons, and returns true iff it should be
2058+ treated as a non-option. */
2059+static int
2060+canon_doc_option (const char **name)
2061+{
2062+ int non_opt;
2063+ /* Skip initial whitespace. */
2064+ while (isspace (**name))
2065+ (*name)++;
2066+ /* Decide whether this looks like an option (leading `-') or not. */
2067+ non_opt = (**name != '-');
2068+ /* Skip until part of name used for sorting. */
2069+ while (**name && !isalnum (**name))
2070+ (*name)++;
2071+ return non_opt;
2072+}
2073+
2074+/* Order ENTRY1 & ENTRY2 by the order which they should appear in a help
2075+ listing. */
2076+static int
2077+hol_entry_cmp (const struct hol_entry *entry1,
2078+ const struct hol_entry *entry2)
2079+{
2080+ /* The group numbers by which the entries should be ordered; if either is
2081+ in a cluster, then this is just the group within the cluster. */
2082+ int group1 = entry1->group, group2 = entry2->group;
2083+
2084+ if (entry1->cluster != entry2->cluster)
2085+ {
2086+ /* The entries are not within the same cluster, so we can't compare them
2087+ directly, we have to use the appropiate clustering level too. */
2088+ if (! entry1->cluster)
2089+ /* ENTRY1 is at the `base level', not in a cluster, so we have to
2090+ compare it's group number with that of the base cluster in which
2091+ ENTRY2 resides. Note that if they're in the same group, the
2092+ clustered option always comes laster. */
2093+ return group_cmp (group1, hol_cluster_base (entry2->cluster)->group, -1);
2094+ else if (! entry2->cluster)
2095+ /* Likewise, but ENTRY2's not in a cluster. */
2096+ return group_cmp (hol_cluster_base (entry1->cluster)->group, group2, 1);
2097+ else
2098+ /* Both entries are in clusters, we can just compare the clusters. */
2099+ return hol_cluster_cmp (entry1->cluster, entry2->cluster);
2100+ }
2101+ else if (group1 == group2)
2102+ /* The entries are both in the same cluster and group, so compare them
2103+ alphabetically. */
2104+ {
2105+ int short1 = hol_entry_first_short (entry1);
2106+ int short2 = hol_entry_first_short (entry2);
2107+ int doc1 = odoc (entry1->opt);
2108+ int doc2 = odoc (entry2->opt);
2109+ const char *long1 = hol_entry_first_long (entry1);
2110+ const char *long2 = hol_entry_first_long (entry2);
2111+
2112+ if (doc1)
2113+ doc1 = long1 != NULL && canon_doc_option (&long1);
2114+ if (doc2)
2115+ doc2 = long2 != NULL && canon_doc_option (&long2);
2116+
2117+ if (doc1 != doc2)
2118+ /* `documentation' options always follow normal options (or
2119+ documentation options that *look* like normal options). */
2120+ return doc1 - doc2;
2121+ else if (!short1 && !short2 && long1 && long2)
2122+ /* Only long options. */
2123+ return strcasecmp (long1, long2);
2124+ else
2125+ /* Compare short/short, long/short, short/long, using the first
2126+ character of long options. Entries without *any* valid
2127+ options (such as options with OPTION_HIDDEN set) will be put
2128+ first, but as they're not displayed, it doesn't matter where
2129+ they are. */
2130+ {
2131+ char first1 = short1 ? short1 : long1 ? *long1 : 0;
2132+ char first2 = short2 ? short2 : long2 ? *long2 : 0;
2133+#ifdef _tolower
2134+ int lower_cmp = _tolower (first1) - _tolower (first2);
2135+#else
2136+ int lower_cmp = tolower (first1) - tolower (first2);
2137+#endif
2138+ /* Compare ignoring case, except when the options are both the
2139+ same letter, in which case lower-case always comes first. */
2140+ return lower_cmp ? lower_cmp : first2 - first1;
2141+ }
2142+ }
2143+ else
2144+ /* Within the same cluster, but not the same group, so just compare
2145+ groups. */
2146+ return group_cmp (group1, group2, 0);
2147+}
2148+
2149+/* Version of hol_entry_cmp with correct signature for qsort. */
2150+static int
2151+hol_entry_qcmp (const void *entry1_v, const void *entry2_v)
2152+{
2153+ return hol_entry_cmp (entry1_v, entry2_v);
2154+}
2155+
2156+/* Sort HOL by group and alphabetically by option name (with short options
2157+ taking precedence over long). Since the sorting is for display purposes
2158+ only, the shadowing of options isn't effected. */
2159+static void
2160+hol_sort (struct hol *hol)
2161+{
2162+ if (hol->num_entries > 0)
2163+ qsort (hol->entries, hol->num_entries, sizeof (struct hol_entry),
2164+ hol_entry_qcmp);
2165+}
2166+
2167+/* Append MORE to HOL, destroying MORE in the process. Options in HOL shadow
2168+ any in MORE with the same name. */
2169+static void
2170+hol_append (struct hol *hol, struct hol *more)
2171+{
2172+ struct hol_cluster **cl_end = &hol->clusters;
2173+
2174+ /* Steal MORE's cluster list, and add it to the end of HOL's. */
2175+ while (*cl_end)
2176+ cl_end = &(*cl_end)->next;
2177+ *cl_end = more->clusters;
2178+ more->clusters = 0;
2179+
2180+ /* Merge entries. */
2181+ if (more->num_entries > 0)
2182+ {
2183+ if (hol->num_entries == 0)
2184+ {
2185+ hol->num_entries = more->num_entries;
2186+ hol->entries = more->entries;
2187+ hol->short_options = more->short_options;
2188+ more->num_entries = 0; /* Mark MORE's fields as invalid. */
2189+ }
2190+ else
2191+ /* Append the entries in MORE to those in HOL, taking care to only add
2192+ non-shadowed SHORT_OPTIONS values. */
2193+ {
2194+ unsigned left;
2195+ char *so, *more_so;
2196+ struct hol_entry *e;
2197+ unsigned num_entries = hol->num_entries + more->num_entries;
2198+ struct hol_entry *entries =
2199+ malloc (num_entries * sizeof (struct hol_entry));
2200+ unsigned hol_so_len = strlen (hol->short_options);
2201+ char *short_options =
2202+ malloc (hol_so_len + strlen (more->short_options) + 1);
2203+
2204+ assert (entries && short_options);
2205+#if SIZE_MAX <= UINT_MAX
2206+ assert (num_entries <= SIZE_MAX / sizeof (struct hol_entry));
2207+#endif
2208+
2209+ mempcpy (mempcpy (entries, hol->entries,
2210+ hol->num_entries * sizeof (struct hol_entry)),
2211+ more->entries,
2212+ more->num_entries * sizeof (struct hol_entry));
2213+
2214+ mempcpy (short_options, hol->short_options, hol_so_len);
2215+
2216+ /* Fix up the short options pointers from HOL. */
2217+ for (e = entries, left = hol->num_entries; left > 0; e++, left--)
2218+ e->short_options += (short_options - hol->short_options);
2219+
2220+ /* Now add the short options from MORE, fixing up its entries
2221+ too. */
2222+ so = short_options + hol_so_len;
2223+ more_so = more->short_options;
2224+ for (left = more->num_entries; left > 0; e++, left--)
2225+ {
2226+ int opts_left;
2227+ const struct argp_option *opt;
2228+
2229+ e->short_options = so;
2230+
2231+ for (opts_left = e->num, opt = e->opt; opts_left; opt++, opts_left--)
2232+ {
2233+ int ch = *more_so;
2234+ if (oshort (opt) && ch == opt->key)
2235+ /* The next short option in MORE_SO, CH, is from OPT. */
2236+ {
2237+ if (! find_char (ch, short_options,
2238+ short_options + hol_so_len))
2239+ /* The short option CH isn't shadowed by HOL's options,
2240+ so add it to the sum. */
2241+ *so++ = ch;
2242+ more_so++;
2243+ }
2244+ }
2245+ }
2246+
2247+ *so = '\0';
2248+
2249+ free (hol->entries);
2250+ free (hol->short_options);
2251+
2252+ hol->entries = entries;
2253+ hol->num_entries = num_entries;
2254+ hol->short_options = short_options;
2255+ }
2256+ }
2257+
2258+ hol_free (more);
2259+}
2260+
2261+/* Inserts enough spaces to make sure STREAM is at column COL. */
2262+static void
2263+indent_to (argp_fmtstream_t stream, unsigned col)
2264+{
2265+ int needed = col - __argp_fmtstream_point (stream);
2266+ while (needed-- > 0)
2267+ __argp_fmtstream_putc (stream, ' ');
2268+}
2269+
2270+/* Output to STREAM either a space, or a newline if there isn't room for at
2271+ least ENSURE characters before the right margin. */
2272+static void
2273+space (argp_fmtstream_t stream, size_t ensure)
2274+{
2275+ if (__argp_fmtstream_point (stream) + ensure
2276+ >= __argp_fmtstream_rmargin (stream))
2277+ __argp_fmtstream_putc (stream, '\n');
2278+ else
2279+ __argp_fmtstream_putc (stream, ' ');
2280+}
2281+
2282+/* If the option REAL has an argument, we print it in using the printf
2283+ format REQ_FMT or OPT_FMT depending on whether it's a required or
2284+ optional argument. */
2285+static void
2286+arg (const struct argp_option *real, const char *req_fmt, const char *opt_fmt,
2287+ const char *domain, argp_fmtstream_t stream)
2288+{
2289+ if (real->arg)
2290+ {
2291+ if (real->flags & OPTION_ARG_OPTIONAL)
2292+ __argp_fmtstream_printf (stream, opt_fmt,
2293+ dgettext (domain, real->arg));
2294+ else
2295+ __argp_fmtstream_printf (stream, req_fmt,
2296+ dgettext (domain, real->arg));
2297+ }
2298+}
2299+
2300+/* Helper functions for hol_entry_help. */
2301+
2302+/* State used during the execution of hol_help. */
2303+struct hol_help_state
2304+{
2305+ /* PREV_ENTRY should contain the previous entry printed, or 0. */
2306+ struct hol_entry *prev_entry;
2307+
2308+ /* If an entry is in a different group from the previous one, and SEP_GROUPS
2309+ is true, then a blank line will be printed before any output. */
2310+ int sep_groups;
2311+
2312+ /* True if a duplicate option argument was suppressed (only ever set if
2313+ UPARAMS.dup_args is false). */
2314+ int suppressed_dup_arg;
2315+};
2316+
2317+/* Some state used while printing a help entry (used to communicate with
2318+ helper functions). See the doc for hol_entry_help for more info, as most
2319+ of the fields are copied from its arguments. */
2320+struct pentry_state
2321+{
2322+ const struct hol_entry *entry;
2323+ argp_fmtstream_t stream;
2324+ struct hol_help_state *hhstate;
2325+
2326+ /* True if nothing's been printed so far. */
2327+ int first;
2328+
2329+ /* If non-zero, the state that was used to print this help. */
2330+ const struct argp_state *state;
2331+};
2332+
2333+/* If a user doc filter should be applied to DOC, do so. */
2334+static const char *
2335+filter_doc (const char *doc, int key, const struct argp *argp,
2336+ const struct argp_state *state)
2337+{
2338+ if (argp && argp->help_filter)
2339+ /* We must apply a user filter to this output. */
2340+ {
2341+ void *input = __argp_input (argp, state);
2342+ return (*argp->help_filter) (key, doc, input);
2343+ }
2344+ else
2345+ /* No filter. */
2346+ return doc;
2347+}
2348+
2349+/* Prints STR as a header line, with the margin lines set appropiately, and
2350+ notes the fact that groups should be separated with a blank line. ARGP is
2351+ the argp that should dictate any user doc filtering to take place. Note
2352+ that the previous wrap margin isn't restored, but the left margin is reset
2353+ to 0. */
2354+static void
2355+print_header (const char *str, const struct argp *argp,
2356+ struct pentry_state *pest)
2357+{
2358+ const char *tstr = dgettext (argp->argp_domain, str);
2359+ const char *fstr = filter_doc (tstr, ARGP_KEY_HELP_HEADER, argp, pest->state);
2360+
2361+ if (fstr)
2362+ {
2363+ if (*fstr)
2364+ {
2365+ if (pest->hhstate->prev_entry)
2366+ /* Precede with a blank line. */
2367+ __argp_fmtstream_putc (pest->stream, '\n');
2368+ indent_to (pest->stream, uparams.header_col);
2369+ __argp_fmtstream_set_lmargin (pest->stream, uparams.header_col);
2370+ __argp_fmtstream_set_wmargin (pest->stream, uparams.header_col);
2371+ __argp_fmtstream_puts (pest->stream, fstr);
2372+ __argp_fmtstream_set_lmargin (pest->stream, 0);
2373+ __argp_fmtstream_putc (pest->stream, '\n');
2374+ }
2375+
2376+ pest->hhstate->sep_groups = 1; /* Separate subsequent groups. */
2377+ }
2378+
2379+ if (fstr != tstr)
2380+ free ((char *) fstr);
2381+}
2382+
2383+/* Inserts a comma if this isn't the first item on the line, and then makes
2384+ sure we're at least to column COL. If this *is* the first item on a line,
2385+ prints any pending whitespace/headers that should precede this line. Also
2386+ clears FIRST. */
2387+static void
2388+comma (unsigned col, struct pentry_state *pest)
2389+{
2390+ if (pest->first)
2391+ {
2392+ const struct hol_entry *pe = pest->hhstate->prev_entry;
2393+ const struct hol_cluster *cl = pest->entry->cluster;
2394+
2395+ if (pest->hhstate->sep_groups && pe && pest->entry->group != pe->group)
2396+ __argp_fmtstream_putc (pest->stream, '\n');
2397+
2398+ if (cl && cl->header && *cl->header
2399+ && (!pe
2400+ || (pe->cluster != cl
2401+ && !hol_cluster_is_child (pe->cluster, cl))))
2402+ /* If we're changing clusters, then this must be the start of the
2403+ ENTRY's cluster unless that is an ancestor of the previous one
2404+ (in which case we had just popped into a sub-cluster for a bit).
2405+ If so, then print the cluster's header line. */
2406+ {
2407+ int old_wm = __argp_fmtstream_wmargin (pest->stream);
2408+ print_header (cl->header, cl->argp, pest);
2409+ __argp_fmtstream_set_wmargin (pest->stream, old_wm);
2410+ }
2411+
2412+ pest->first = 0;
2413+ }
2414+ else
2415+ __argp_fmtstream_puts (pest->stream, ", ");
2416+
2417+ indent_to (pest->stream, col);
2418+}
2419+
2420+/* Print help for ENTRY to STREAM. */
2421+static void
2422+hol_entry_help (struct hol_entry *entry, const struct argp_state *state,
2423+ argp_fmtstream_t stream, struct hol_help_state *hhstate)
2424+{
2425+ unsigned num;
2426+ const struct argp_option *real = entry->opt, *opt;
2427+ char *so = entry->short_options;
2428+ int have_long_opt = 0; /* We have any long options. */
2429+ /* Saved margins. */
2430+ int old_lm = __argp_fmtstream_set_lmargin (stream, 0);
2431+ int old_wm = __argp_fmtstream_wmargin (stream);
2432+ /* PEST is a state block holding some of our variables that we'd like to
2433+ share with helper functions. */
2434+ struct pentry_state pest = { entry, stream, hhstate, 1, state };
2435+
2436+ if (! odoc (real))
2437+ for (opt = real, num = entry->num; num > 0; opt++, num--)
2438+ if (opt->name && ovisible (opt))
2439+ {
2440+ have_long_opt = 1;
2441+ break;
2442+ }
2443+
2444+ /* First emit short options. */
2445+ __argp_fmtstream_set_wmargin (stream, uparams.short_opt_col); /* For truly bizarre cases. */
2446+ for (opt = real, num = entry->num; num > 0; opt++, num--)
2447+ if (oshort (opt) && opt->key == *so)
2448+ /* OPT has a valid (non shadowed) short option. */
2449+ {
2450+ if (ovisible (opt))
2451+ {
2452+ comma (uparams.short_opt_col, &pest);
2453+ __argp_fmtstream_putc (stream, '-');
2454+ __argp_fmtstream_putc (stream, *so);
2455+ if (!have_long_opt || uparams.dup_args)
2456+ arg (real, " %s", "[%s]",
2457+ state == NULL ? NULL : state->root_argp->argp_domain,
2458+ stream);
2459+ else if (real->arg)
2460+ hhstate->suppressed_dup_arg = 1;
2461+ }
2462+ so++;
2463+ }
2464+
2465+ /* Now, long options. */
2466+ if (odoc (real))
2467+ /* A `documentation' option. */
2468+ {
2469+ __argp_fmtstream_set_wmargin (stream, uparams.doc_opt_col);
2470+ for (opt = real, num = entry->num; num > 0; opt++, num--)
2471+ if (opt->name && ovisible (opt))
2472+ {
2473+ comma (uparams.doc_opt_col, &pest);
2474+ /* Calling gettext here isn't quite right, since sorting will
2475+ have been done on the original; but documentation options
2476+ should be pretty rare anyway... */
2477+ __argp_fmtstream_puts (stream,
2478+ dgettext (state == NULL ? NULL
2479+ : state->root_argp->argp_domain,
2480+ opt->name));
2481+ }
2482+ }
2483+ else
2484+ /* A real long option. */
2485+ {
2486+ __argp_fmtstream_set_wmargin (stream, uparams.long_opt_col);
2487+ for (opt = real, num = entry->num; num > 0; opt++, num--)
2488+ if (opt->name && ovisible (opt))
2489+ {
2490+ comma (uparams.long_opt_col, &pest);
2491+ __argp_fmtstream_printf (stream, "--%s", opt->name);
2492+ arg (real, "=%s", "[=%s]",
2493+ state == NULL ? NULL : state->root_argp->argp_domain, stream);
2494+ }
2495+ }
2496+
2497+ /* Next, documentation strings. */
2498+ __argp_fmtstream_set_lmargin (stream, 0);
2499+
2500+ if (pest.first)
2501+ {
2502+ /* Didn't print any switches, what's up? */
2503+ if (!oshort (real) && !real->name)
2504+ /* This is a group header, print it nicely. */
2505+ print_header (real->doc, entry->argp, &pest);
2506+ else
2507+ /* Just a totally shadowed option or null header; print nothing. */
2508+ goto cleanup; /* Just return, after cleaning up. */
2509+ }
2510+ else
2511+ {
2512+ const char *tstr = real->doc ? dgettext (state == NULL ? NULL
2513+ : state->root_argp->argp_domain,
2514+ real->doc) : 0;
2515+ const char *fstr = filter_doc (tstr, real->key, entry->argp, state);
2516+ if (fstr && *fstr)
2517+ {
2518+ unsigned int col = __argp_fmtstream_point (stream);
2519+
2520+ __argp_fmtstream_set_lmargin (stream, uparams.opt_doc_col);
2521+ __argp_fmtstream_set_wmargin (stream, uparams.opt_doc_col);
2522+
2523+ if (col > (unsigned int) (uparams.opt_doc_col + 3))
2524+ __argp_fmtstream_putc (stream, '\n');
2525+ else if (col >= (unsigned int) uparams.opt_doc_col)
2526+ __argp_fmtstream_puts (stream, " ");
2527+ else
2528+ indent_to (stream, uparams.opt_doc_col);
2529+
2530+ __argp_fmtstream_puts (stream, fstr);
2531+ }
2532+ if (fstr && fstr != tstr)
2533+ free ((char *) fstr);
2534+
2535+ /* Reset the left margin. */
2536+ __argp_fmtstream_set_lmargin (stream, 0);
2537+ __argp_fmtstream_putc (stream, '\n');
2538+ }
2539+
2540+ hhstate->prev_entry = entry;
2541+
2542+cleanup:
2543+ __argp_fmtstream_set_lmargin (stream, old_lm);
2544+ __argp_fmtstream_set_wmargin (stream, old_wm);
2545+}
2546+
2547+/* Output a long help message about the options in HOL to STREAM. */
2548+static void
2549+hol_help (struct hol *hol, const struct argp_state *state,
2550+ argp_fmtstream_t stream)
2551+{
2552+ unsigned num;
2553+ struct hol_entry *entry;
2554+ struct hol_help_state hhstate = { 0, 0, 0 };
2555+
2556+ for (entry = hol->entries, num = hol->num_entries; num > 0; entry++, num--)
2557+ hol_entry_help (entry, state, stream, &hhstate);
2558+
2559+ if (hhstate.suppressed_dup_arg && uparams.dup_args_note)
2560+ {
2561+ const char *tstr = dgettext (state == NULL ? NULL
2562+ : state->root_argp->argp_domain, "\
2563+Mandatory or optional arguments to long options are also mandatory or \
2564+optional for any corresponding short options.");
2565+ const char *fstr = filter_doc (tstr, ARGP_KEY_HELP_DUP_ARGS_NOTE,
2566+ state ? state->root_argp : 0, state);
2567+ if (fstr && *fstr)
2568+ {
2569+ __argp_fmtstream_putc (stream, '\n');
2570+ __argp_fmtstream_puts (stream, fstr);
2571+ __argp_fmtstream_putc (stream, '\n');
2572+ }
2573+ if (fstr && fstr != tstr)
2574+ free ((char *) fstr);
2575+ }
2576+}
2577+
2578+/* Helper functions for hol_usage. */
2579+
2580+/* If OPT is a short option without an arg, append its key to the string
2581+ pointer pointer to by COOKIE, and advance the pointer. */
2582+static int
2583+add_argless_short_opt (const struct argp_option *opt,
2584+ const struct argp_option *real,
2585+ const char *domain, void *cookie)
2586+{
2587+ char **snao_end = cookie;
2588+ if (!(opt->arg || real->arg)
2589+ && !((opt->flags | real->flags) & OPTION_NO_USAGE))
2590+ *(*snao_end)++ = opt->key;
2591+ return 0;
2592+}
2593+
2594+/* If OPT is a short option with an arg, output a usage entry for it to the
2595+ stream pointed at by COOKIE. */
2596+static int
2597+usage_argful_short_opt (const struct argp_option *opt,
2598+ const struct argp_option *real,
2599+ const char *domain, void *cookie)
2600+{
2601+ argp_fmtstream_t stream = cookie;
2602+ const char *arg = opt->arg;
2603+ int flags = opt->flags | real->flags;
2604+
2605+ if (! arg)
2606+ arg = real->arg;
2607+
2608+ if (arg && !(flags & OPTION_NO_USAGE))
2609+ {
2610+ arg = dgettext (domain, arg);
2611+
2612+ if (flags & OPTION_ARG_OPTIONAL)
2613+ __argp_fmtstream_printf (stream, " [-%c[%s]]", opt->key, arg);
2614+ else
2615+ {
2616+ /* Manually do line wrapping so that it (probably) won't
2617+ get wrapped at the embedded space. */
2618+ space (stream, 6 + strlen (arg));
2619+ __argp_fmtstream_printf (stream, "[-%c %s]", opt->key, arg);
2620+ }
2621+ }
2622+
2623+ return 0;
2624+}
2625+
2626+/* Output a usage entry for the long option opt to the stream pointed at by
2627+ COOKIE. */
2628+static int
2629+usage_long_opt (const struct argp_option *opt,
2630+ const struct argp_option *real,
2631+ const char *domain, void *cookie)
2632+{
2633+ argp_fmtstream_t stream = cookie;
2634+ const char *arg = opt->arg;
2635+ int flags = opt->flags | real->flags;
2636+
2637+ if (! arg)
2638+ arg = real->arg;
2639+
2640+ if (! (flags & OPTION_NO_USAGE))
2641+ {
2642+ if (arg)
2643+ {
2644+ arg = dgettext (domain, arg);
2645+ if (flags & OPTION_ARG_OPTIONAL)
2646+ __argp_fmtstream_printf (stream, " [--%s[=%s]]", opt->name, arg);
2647+ else
2648+ __argp_fmtstream_printf (stream, " [--%s=%s]", opt->name, arg);
2649+ }
2650+ else
2651+ __argp_fmtstream_printf (stream, " [--%s]", opt->name);
2652+ }
2653+
2654+ return 0;
2655+}
2656+
2657+/* Print a short usage description for the arguments in HOL to STREAM. */
2658+static void
2659+hol_usage (struct hol *hol, argp_fmtstream_t stream)
2660+{
2661+ if (hol->num_entries > 0)
2662+ {
2663+ unsigned nentries;
2664+ struct hol_entry *entry;
2665+ char *short_no_arg_opts = alloca (strlen (hol->short_options) + 1);
2666+ char *snao_end = short_no_arg_opts;
2667+
2668+ /* First we put a list of short options without arguments. */
2669+ for (entry = hol->entries, nentries = hol->num_entries
2670+ ; nentries > 0
2671+ ; entry++, nentries--)
2672+ hol_entry_short_iterate (entry, add_argless_short_opt,
2673+ entry->argp->argp_domain, &snao_end);
2674+ if (snao_end > short_no_arg_opts)
2675+ {
2676+ *snao_end++ = 0;
2677+ __argp_fmtstream_printf (stream, " [-%s]", short_no_arg_opts);
2678+ }
2679+
2680+ /* Now a list of short options *with* arguments. */
2681+ for (entry = hol->entries, nentries = hol->num_entries
2682+ ; nentries > 0
2683+ ; entry++, nentries--)
2684+ hol_entry_short_iterate (entry, usage_argful_short_opt,
2685+ entry->argp->argp_domain, stream);
2686+
2687+ /* Finally, a list of long options (whew!). */
2688+ for (entry = hol->entries, nentries = hol->num_entries
2689+ ; nentries > 0
2690+ ; entry++, nentries--)
2691+ hol_entry_long_iterate (entry, usage_long_opt,
2692+ entry->argp->argp_domain, stream);
2693+ }
2694+}
2695+
2696+/* Make a HOL containing all levels of options in ARGP. CLUSTER is the
2697+ cluster in which ARGP's entries should be clustered, or 0. */
2698+static struct hol *
2699+argp_hol (const struct argp *argp, struct hol_cluster *cluster)
2700+{
2701+ const struct argp_child *child = argp->children;
2702+ struct hol *hol = make_hol (argp, cluster);
2703+ if (child)
2704+ while (child->argp)
2705+ {
2706+ struct hol_cluster *child_cluster =
2707+ ((child->group || child->header)
2708+ /* Put CHILD->argp within its own cluster. */
2709+ ? hol_add_cluster (hol, child->group, child->header,
2710+ child - argp->children, cluster, argp)
2711+ /* Just merge it into the parent's cluster. */
2712+ : cluster);
2713+ hol_append (hol, argp_hol (child->argp, child_cluster)) ;
2714+ child++;
2715+ }
2716+ return hol;
2717+}
2718+
2719+/* Calculate how many different levels with alternative args strings exist in
2720+ ARGP. */
2721+static size_t
2722+argp_args_levels (const struct argp *argp)
2723+{
2724+ size_t levels = 0;
2725+ const struct argp_child *child = argp->children;
2726+
2727+ if (argp->args_doc && strchr (argp->args_doc, '\n'))
2728+ levels++;
2729+
2730+ if (child)
2731+ while (child->argp)
2732+ levels += argp_args_levels ((child++)->argp);
2733+
2734+ return levels;
2735+}
2736+
2737+/* Print all the non-option args documented in ARGP to STREAM. Any output is
2738+ preceded by a space. LEVELS is a pointer to a byte vector the length
2739+ returned by argp_args_levels; it should be initialized to zero, and
2740+ updated by this routine for the next call if ADVANCE is true. True is
2741+ returned as long as there are more patterns to output. */
2742+static int
2743+argp_args_usage (const struct argp *argp, const struct argp_state *state,
2744+ char **levels, int advance, argp_fmtstream_t stream)
2745+{
2746+ char *our_level = *levels;
2747+ int multiple = 0;
2748+ const struct argp_child *child = argp->children;
2749+ const char *tdoc = dgettext (argp->argp_domain, argp->args_doc), *nl = 0;
2750+ const char *fdoc = filter_doc (tdoc, ARGP_KEY_HELP_ARGS_DOC, argp, state);
2751+
2752+ if (fdoc)
2753+ {
2754+ const char *cp = fdoc;
2755+ nl = strchrnul (cp, '\n');
2756+ if (*nl != '\0')
2757+ /* This is a `multi-level' args doc; advance to the correct position
2758+ as determined by our state in LEVELS, and update LEVELS. */
2759+ {
2760+ int i;
2761+ multiple = 1;
2762+ for (i = 0; i < *our_level; i++)
2763+ cp = nl + 1, nl = strchrnul (cp, '\n');
2764+ (*levels)++;
2765+ }
2766+
2767+ /* Manually do line wrapping so that it (probably) won't get wrapped at
2768+ any embedded spaces. */
2769+ space (stream, 1 + nl - cp);
2770+
2771+ __argp_fmtstream_write (stream, cp, nl - cp);
2772+ }
2773+ if (fdoc && fdoc != tdoc)
2774+ free ((char *)fdoc); /* Free user's modified doc string. */
2775+
2776+ if (child)
2777+ while (child->argp)
2778+ advance = !argp_args_usage ((child++)->argp, state, levels, advance, stream);
2779+
2780+ if (advance && multiple)
2781+ {
2782+ /* Need to increment our level. */
2783+ if (*nl)
2784+ /* There's more we can do here. */
2785+ {
2786+ (*our_level)++;
2787+ advance = 0; /* Our parent shouldn't advance also. */
2788+ }
2789+ else if (*our_level > 0)
2790+ /* We had multiple levels, but used them up; reset to zero. */
2791+ *our_level = 0;
2792+ }
2793+
2794+ return !advance;
2795+}
2796+
2797+/* Print the documentation for ARGP to STREAM; if POST is false, then
2798+ everything preceeding a `\v' character in the documentation strings (or
2799+ the whole string, for those with none) is printed, otherwise, everything
2800+ following the `\v' character (nothing for strings without). Each separate
2801+ bit of documentation is separated a blank line, and if PRE_BLANK is true,
2802+ then the first is as well. If FIRST_ONLY is true, only the first
2803+ occurrence is output. Returns true if anything was output. */
2804+static int
2805+argp_doc (const struct argp *argp, const struct argp_state *state,
2806+ int post, int pre_blank, int first_only,
2807+ argp_fmtstream_t stream)
2808+{
2809+ const char *text;
2810+ const char *inp_text;
2811+ void *input = 0;
2812+ int anything = 0;
2813+ size_t inp_text_limit = 0;
2814+ const char *doc = dgettext (argp->argp_domain, argp->doc);
2815+ const struct argp_child *child = argp->children;
2816+
2817+ if (doc)
2818+ {
2819+ char *vt = strchr (doc, '\v');
2820+ inp_text = post ? (vt ? vt + 1 : 0) : doc;
2821+ inp_text_limit = (!post && vt) ? (vt - doc) : 0;
2822+ }
2823+ else
2824+ inp_text = 0;
2825+
2826+ if (argp->help_filter)
2827+ /* We have to filter the doc strings. */
2828+ {
2829+ if (inp_text_limit)
2830+ /* Copy INP_TEXT so that it's nul-terminated. */
2831+ inp_text = strndup (inp_text, inp_text_limit);
2832+ input = __argp_input (argp, state);
2833+ text =
2834+ (*argp->help_filter) (post
2835+ ? ARGP_KEY_HELP_POST_DOC
2836+ : ARGP_KEY_HELP_PRE_DOC,
2837+ inp_text, input);
2838+ }
2839+ else
2840+ text = (const char *) inp_text;
2841+
2842+ if (text)
2843+ {
2844+ if (pre_blank)
2845+ __argp_fmtstream_putc (stream, '\n');
2846+
2847+ if (text == inp_text && inp_text_limit)
2848+ __argp_fmtstream_write (stream, inp_text, inp_text_limit);
2849+ else
2850+ __argp_fmtstream_puts (stream, text);
2851+
2852+ if (__argp_fmtstream_point (stream) > __argp_fmtstream_lmargin (stream))
2853+ __argp_fmtstream_putc (stream, '\n');
2854+
2855+ anything = 1;
2856+ }
2857+
2858+ if (text && text != inp_text)
2859+ free ((char *) text); /* Free TEXT returned from the help filter. */
2860+ if (inp_text && inp_text_limit && argp->help_filter)
2861+ free ((char *) inp_text); /* We copied INP_TEXT, so free it now. */
2862+
2863+ if (post && argp->help_filter)
2864+ /* Now see if we have to output a ARGP_KEY_HELP_EXTRA text. */
2865+ {
2866+ text = (*argp->help_filter) (ARGP_KEY_HELP_EXTRA, 0, input);
2867+ if (text)
2868+ {
2869+ if (anything || pre_blank)
2870+ __argp_fmtstream_putc (stream, '\n');
2871+ __argp_fmtstream_puts (stream, text);
2872+ free ((char *) text);
2873+ if (__argp_fmtstream_point (stream)
2874+ > __argp_fmtstream_lmargin (stream))
2875+ __argp_fmtstream_putc (stream, '\n');
2876+ anything = 1;
2877+ }
2878+ }
2879+
2880+ if (child)
2881+ while (child->argp && !(first_only && anything))
2882+ anything |=
2883+ argp_doc ((child++)->argp, state,
2884+ post, anything || pre_blank, first_only,
2885+ stream);
2886+
2887+ return anything;
2888+}
2889+
2890+/* Output a usage message for ARGP to STREAM. If called from
2891+ argp_state_help, STATE is the relevent parsing state. FLAGS are from the
2892+ set ARGP_HELP_*. NAME is what to use wherever a `program name' is
2893+ needed. */
2894+static void
2895+_help (const struct argp *argp, const struct argp_state *state, FILE *stream,
2896+ unsigned flags, char *name)
2897+{
2898+ int anything = 0; /* Whether we've output anything. */
2899+ struct hol *hol = 0;
2900+ argp_fmtstream_t fs;
2901+
2902+ if (! stream)
2903+ return;
2904+
2905+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
2906+ flockfile (stream);
2907+#endif
2908+
2909+ fill_in_uparams (state);
2910+
2911+ fs = __argp_make_fmtstream (stream, 0, uparams.rmargin, 0);
2912+ if (! fs)
2913+ {
2914+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
2915+ funlockfile (stream);
2916+#endif
2917+ return;
2918+ }
2919+
2920+ if (flags & (ARGP_HELP_USAGE | ARGP_HELP_SHORT_USAGE | ARGP_HELP_LONG))
2921+ {
2922+ hol = argp_hol (argp, 0);
2923+
2924+ /* If present, these options always come last. */
2925+ hol_set_group (hol, "help", -1);
2926+ hol_set_group (hol, "version", -1);
2927+
2928+ hol_sort (hol);
2929+ }
2930+
2931+ if (flags & (ARGP_HELP_USAGE | ARGP_HELP_SHORT_USAGE))
2932+ /* Print a short `Usage:' message. */
2933+ {
2934+ int first_pattern = 1, more_patterns;
2935+ size_t num_pattern_levels = argp_args_levels (argp);
2936+ char *pattern_levels = alloca (num_pattern_levels);
2937+
2938+ memset (pattern_levels, 0, num_pattern_levels);
2939+
2940+ do
2941+ {
2942+ int old_lm;
2943+ int old_wm = __argp_fmtstream_set_wmargin (fs, uparams.usage_indent);
2944+ char *levels = pattern_levels;
2945+
2946+ if (first_pattern)
2947+ __argp_fmtstream_printf (fs, "%s %s",
2948+ dgettext (argp->argp_domain, "Usage:"),
2949+ name);
2950+ else
2951+ __argp_fmtstream_printf (fs, "%s %s",
2952+ dgettext (argp->argp_domain, " or: "),
2953+ name);
2954+
2955+ /* We set the lmargin as well as the wmargin, because hol_usage
2956+ manually wraps options with newline to avoid annoying breaks. */
2957+ old_lm = __argp_fmtstream_set_lmargin (fs, uparams.usage_indent);
2958+
2959+ if (flags & ARGP_HELP_SHORT_USAGE)
2960+ /* Just show where the options go. */
2961+ {
2962+ if (hol->num_entries > 0)
2963+ __argp_fmtstream_puts (fs, dgettext (argp->argp_domain,
2964+ " [OPTION...]"));
2965+ }
2966+ else
2967+ /* Actually print the options. */
2968+ {
2969+ hol_usage (hol, fs);
2970+ flags |= ARGP_HELP_SHORT_USAGE; /* But only do so once. */
2971+ }
2972+
2973+ more_patterns = argp_args_usage (argp, state, &levels, 1, fs);
2974+
2975+ __argp_fmtstream_set_wmargin (fs, old_wm);
2976+ __argp_fmtstream_set_lmargin (fs, old_lm);
2977+
2978+ __argp_fmtstream_putc (fs, '\n');
2979+ anything = 1;
2980+
2981+ first_pattern = 0;
2982+ }
2983+ while (more_patterns);
2984+ }
2985+
2986+ if (flags & ARGP_HELP_PRE_DOC)
2987+ anything |= argp_doc (argp, state, 0, 0, 1, fs);
2988+
2989+ if (flags & ARGP_HELP_SEE)
2990+ {
2991+ __argp_fmtstream_printf (fs, dgettext (argp->argp_domain, "\
2992+Try `%s --help' or `%s --usage' for more information.\n"),
2993+ name, name);
2994+ anything = 1;
2995+ }
2996+
2997+ if (flags & ARGP_HELP_LONG)
2998+ /* Print a long, detailed help message. */
2999+ {
3000+ /* Print info about all the options. */
3001+ if (hol->num_entries > 0)
3002+ {
3003+ if (anything)
3004+ __argp_fmtstream_putc (fs, '\n');
3005+ hol_help (hol, state, fs);
3006+ anything = 1;
3007+ }
3008+ }
3009+
3010+ if (flags & ARGP_HELP_POST_DOC)
3011+ /* Print any documentation strings at the end. */
3012+ anything |= argp_doc (argp, state, 1, anything, 0, fs);
3013+
3014+ if ((flags & ARGP_HELP_BUG_ADDR) && argp_program_bug_address)
3015+ {
3016+ if (anything)
3017+ __argp_fmtstream_putc (fs, '\n');
3018+ __argp_fmtstream_printf (fs, dgettext (argp->argp_domain,
3019+ "Report bugs to %s.\n"),
3020+ argp_program_bug_address);
3021+ anything = 1;
3022+ }
3023+
3024+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
3025+ funlockfile (stream);
3026+#endif
3027+
3028+ if (hol)
3029+ hol_free (hol);
3030+
3031+ __argp_fmtstream_free (fs);
3032+}
3033+
3034+/* Output a usage message for ARGP to STREAM. FLAGS are from the set
3035+ ARGP_HELP_*. NAME is what to use wherever a `program name' is needed. */
3036+void argp_help (const struct argp *argp, FILE *stream,
3037+ unsigned flags, char *name)
3038+{
3039+ _help (argp, 0, stream, flags, name);
3040+}
3041+
3042+char *
3043+__argp_short_program_name (void)
3044+{
3045+# ifdef __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__
3046+/*
3047+ * uClibc provides both program_invocation_name and
3048+ * program_invocation_short_name
3049+ */
3050+ return (char *) program_invocation_short_name;
3051+# else
3052+ /* FIXME: What now? Miles suggests that it is better to use NULL,
3053+ but currently the value is passed on directly to fputs_unlocked,
3054+ so that requires more changes. */
3055+# if __GNUC__
3056+# warning No reasonable value to return
3057+# endif /* __GNUC__ */
3058+ return "";
3059+# endif
3060+}
3061+
3062+/* Output, if appropriate, a usage message for STATE to STREAM. FLAGS are
3063+ from the set ARGP_HELP_*. */
3064+void
3065+argp_state_help (const struct argp_state *state, FILE *stream, unsigned flags)
3066+{
3067+ if ((!state || ! (state->flags & ARGP_NO_ERRS)) && stream)
3068+ {
3069+ if (state && (state->flags & ARGP_LONG_ONLY))
3070+ flags |= ARGP_HELP_LONG_ONLY;
3071+
3072+ _help (state ? state->root_argp : 0, state, stream, flags,
3073+ state ? state->name : __argp_short_program_name ());
3074+
3075+ if (!state || ! (state->flags & ARGP_NO_EXIT))
3076+ {
3077+ if (flags & ARGP_HELP_EXIT_ERR)
3078+ exit (argp_err_exit_status);
3079+ if (flags & ARGP_HELP_EXIT_OK)
3080+ exit (0);
3081+ }
3082+ }
3083+}
3084+
3085+/* If appropriate, print the printf string FMT and following args, preceded
3086+ by the program name and `:', to stderr, and followed by a `Try ... --help'
3087+ message, then exit (1). */
3088+void
3089+argp_error (const struct argp_state *state, const char *fmt, ...)
3090+{
3091+ if (!state || !(state->flags & ARGP_NO_ERRS))
3092+ {
3093+ FILE *stream = state ? state->err_stream : stderr;
3094+
3095+ if (stream)
3096+ {
3097+ va_list ap;
3098+
3099+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
3100+ flockfile (stream);
3101+#endif
3102+
3103+ va_start (ap, fmt);
3104+
3105+#if defined _LIBC && defined USE_IN_LIBIO
3106+ char *buf;
3107+
3108+ if (_IO_vasprintf (&buf, fmt, ap) < 0)
3109+ buf = NULL;
3110+
3111+ __fxprintf (stream, "%s: %s\n",
3112+ state ? state->name : __argp_short_program_name (), buf);
3113+
3114+ free (buf);
3115+#else
3116+ fputs_unlocked (state ? state->name : __argp_short_program_name (),
3117+ stream);
3118+ putc_unlocked (':', stream);
3119+ putc_unlocked (' ', stream);
3120+
3121+ vfprintf (stream, fmt, ap);
3122+
3123+ putc_unlocked ('\n', stream);
3124+#endif
3125+
3126+ argp_state_help (state, stream, ARGP_HELP_STD_ERR);
3127+
3128+ va_end (ap);
3129+
3130+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
3131+ funlockfile (stream);
3132+#endif
3133+ }
3134+ }
3135+}
3136+
3137+/* Similar to the standard gnu error-reporting function error(), but will
3138+ respect the ARGP_NO_EXIT and ARGP_NO_ERRS flags in STATE, and will print
3139+ to STATE->err_stream. This is useful for argument parsing code that is
3140+ shared between program startup (when exiting is desired) and runtime
3141+ option parsing (when typically an error code is returned instead). The
3142+ difference between this function and argp_error is that the latter is for
3143+ *parsing errors*, and the former is for other problems that occur during
3144+ parsing but don't reflect a (syntactic) problem with the input. */
3145+void
3146+argp_failure (const struct argp_state *state, int status, int errnum,
3147+ const char *fmt, ...)
3148+{
3149+ if (!state || !(state->flags & ARGP_NO_ERRS))
3150+ {
3151+ FILE *stream = state ? state->err_stream : stderr;
3152+
3153+ if (stream)
3154+ {
3155+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
3156+ flockfile (stream);
3157+#endif
3158+
3159+#if defined _LIBC && defined USE_IN_LIBIO
3160+ __fxprintf (stream, "%s",
3161+ state ? state->name : __argp_short_program_name ());
3162+#else
3163+ fputs_unlocked (state ? state->name : __argp_short_program_name (),
3164+ stream);
3165+#endif
3166+
3167+ if (fmt)
3168+ {
3169+ va_list ap;
3170+
3171+ va_start (ap, fmt);
3172+#if defined _LIBC && defined USE_IN_LIBIO
3173+ char *buf;
3174+
3175+ if (_IO_vasprintf (&buf, fmt, ap) < 0)
3176+ buf = NULL;
3177+
3178+ __fxprintf (stream, ": %s", buf);
3179+
3180+ free (buf);
3181+#else
3182+ putc_unlocked (':', stream);
3183+ putc_unlocked (' ', stream);
3184+
3185+ vfprintf (stream, fmt, ap);
3186+#endif
3187+
3188+ va_end (ap);
3189+ }
3190+
3191+ if (errnum)
3192+ {
3193+#if (defined _LIBC && defined USE_IN_LIBIO) || defined HAVE_STRERROR_R
3194+ char buf[200];
3195+#endif
3196+#if defined _LIBC && defined USE_IN_LIBIO
3197+ __fxprintf (stream, ": %s",
3198+ strerror_r (errnum, buf, sizeof (buf)));
3199+#else
3200+ putc_unlocked (':', stream);
3201+ putc_unlocked (' ', stream);
3202+# ifdef HAVE_STRERROR_R
3203+ fputs (strerror_r (errnum, buf, sizeof (buf)), stream);
3204+# else
3205+ fputs (strerror (errnum), stream);
3206+# endif
3207+#endif
3208+ }
3209+
3210+#ifdef USE_IN_LIBIO
3211+ if (_IO_fwide (stream, 0) > 0)
3212+ putwc_unlocked (L'\n', stream);
3213+ else
3214+#endif
3215+ putc_unlocked ('\n', stream);
3216+
3217+#if _LIBC || (HAVE_FLOCKFILE && HAVE_FUNLOCKFILE)
3218+ funlockfile (stream);
3219+#endif
3220+
3221+ if (status && (!state || !(state->flags & ARGP_NO_EXIT)))
3222+ exit (status);
3223+ }
3224+ }
3225+}
3226Index: git/libuargp/argp-parse.c
3227===================================================================
3228--- /dev/null
3229+++ git/libuargp/argp-parse.c
3230@@ -0,0 +1,949 @@
3231+/* Hierarchial argument parsing, layered over getopt
3232+ Copyright (C) 1995-2000, 2002, 2003, 2004 Free Software Foundation, Inc.
3233+ This file is part of the GNU C Library.
3234+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
3235+
3236+ The GNU C Library is free software; you can redistribute it and/or
3237+ modify it under the terms of the GNU Lesser General Public
3238+ License as published by the Free Software Foundation; either
3239+ version 2.1 of the License, or (at your option) any later version.
3240+
3241+ The GNU C Library is distributed in the hope that it will be useful,
3242+ but WITHOUT ANY WARRANTY; without even the implied warranty of
3243+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3244+ Lesser General Public License for more details.
3245+
3246+ You should have received a copy of the GNU Lesser General Public
3247+ License along with the GNU C Library; if not, write to the Free
3248+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3249+ 02111-1307 USA.
3250+
3251+ Modified for uClibc by: Salvatore Cro <salvatore.cro at st.com>
3252+*/
3253+
3254+#ifdef HAVE_CONFIG_H
3255+#include <config.h>
3256+#endif
3257+
3258+/* AIX requires this to be the first thing in the file. */
3259+#ifndef __GNUC__
3260+# if HAVE_ALLOCA_H || defined _LIBC
3261+# include <alloca.h>
3262+# else
3263+# ifdef _AIX
3264+#pragma alloca
3265+# else
3266+# ifndef alloca /* predefined by HP cc +Olibcalls */
3267+char *alloca ();
3268+# endif
3269+# endif
3270+# endif
3271+#endif
3272+
3273+#include <stdlib.h>
3274+#include <string.h>
3275+#include <unistd.h>
3276+#include <limits.h>
3277+#include <getopt.h>
3278+#include <bits/getopt_int.h>
3279+
3280+#include <features.h>
3281+#ifndef _
3282+/* This is for other GNU distributions with internationalized messages.
3283+ When compiling libc, the _ macro is predefined. */
3284+# if (defined HAVE_LIBINTL_H || defined _LIBC) && defined __UCLIBC_HAS_GETTEXT_AWARENESS__
3285+# include <libintl.h>
3286+# ifdef _LIBC
3287+# undef dgettext
3288+# define dgettext(domain, msgid) \
3289+ INTUSE(__dcgettext) (domain, msgid, LC_MESSAGES)
3290+# endif
3291+# else
3292+# define dgettext(domain, msgid) (msgid)
3293+# define gettext(msgid) (msgid)
3294+# endif
3295+#endif
3296+#ifndef N_
3297+# define N_(msgid) (msgid)
3298+#endif
3299+
3300+#include <argp.h>
3301+
3302+/* Getopt return values. */
3303+#define KEY_END (-1) /* The end of the options. */
3304+#define KEY_ARG 1 /* A non-option argument. */
3305+#define KEY_ERR '?' /* An error parsing the options. */
3306+
3307+/* The meta-argument used to prevent any further arguments being interpreted
3308+ as options. */
3309+#define QUOTE "--"
3310+
3311+/* The number of bits we steal in a long-option value for our own use. */
3312+#define GROUP_BITS CHAR_BIT
3313+
3314+/* The number of bits available for the user value. */
3315+#define USER_BITS ((sizeof ((struct option *)0)->val * CHAR_BIT) - GROUP_BITS)
3316+#define USER_MASK ((1 << USER_BITS) - 1)
3317+
3318+/* EZ alias for ARGP_ERR_UNKNOWN. */
3319+#define EBADKEY ARGP_ERR_UNKNOWN
3320+
3321+/* Default options. */
3322+
3323+/* When argp is given the --HANG switch, _ARGP_HANG is set and argp will sleep
3324+ for one second intervals, decrementing _ARGP_HANG until it's zero. Thus
3325+ you can force the program to continue by attaching a debugger and setting
3326+ it to 0 yourself. */
3327+static volatile int _argp_hang;
3328+
3329+#define OPT_PROGNAME -2
3330+#define OPT_USAGE -3
3331+#define OPT_HANG -4
3332+
3333+static const struct argp_option argp_default_options[] =
3334+{
3335+ {"help", '?', 0, 0, N_("Give this help list"), -1},
3336+ {"usage", OPT_USAGE, 0, 0, N_("Give a short usage message")},
3337+ {"program-name",OPT_PROGNAME,"NAME", OPTION_HIDDEN, N_("Set the program name")},
3338+ {"HANG", OPT_HANG, "SECS", OPTION_ARG_OPTIONAL | OPTION_HIDDEN,
3339+ N_("Hang for SECS seconds (default 3600)")},
3340+ {0, 0}
3341+};
3342+
3343+static error_t
3344+argp_default_parser (int key, char *arg, struct argp_state *state)
3345+{
3346+ switch (key)
3347+ {
3348+ case '?':
3349+ argp_state_help (state, state->out_stream, ARGP_HELP_STD_HELP);
3350+ break;
3351+ case OPT_USAGE:
3352+ argp_state_help (state, state->out_stream,
3353+ ARGP_HELP_USAGE | ARGP_HELP_EXIT_OK);
3354+ break;
3355+
3356+ case OPT_PROGNAME: /* Set the program name. */
3357+#if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_NAME
3358+ program_invocation_name = arg;
3359+#endif
3360+ /* [Note that some systems only have PROGRAM_INVOCATION_SHORT_NAME (aka
3361+ __PROGNAME), in which case, PROGRAM_INVOCATION_NAME is just defined
3362+ to be that, so we have to be a bit careful here.] */
3363+
3364+ /* Update what we use for messages. */
3365+ state->name = strrchr (arg, '/');
3366+ if (state->name)
3367+ state->name++;
3368+ else
3369+ state->name = arg;
3370+
3371+#if defined _LIBC || HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
3372+ program_invocation_short_name = state->name;
3373+#endif
3374+
3375+ if ((state->flags & (ARGP_PARSE_ARGV0 | ARGP_NO_ERRS))
3376+ == ARGP_PARSE_ARGV0)
3377+ /* Update what getopt uses too. */
3378+ state->argv[0] = arg;
3379+
3380+ break;
3381+
3382+ case OPT_HANG:
3383+ _argp_hang = atoi (arg ? arg : "3600");
3384+ while (_argp_hang-- > 0)
3385+ sleep (1);
3386+ break;
3387+
3388+ default:
3389+ return EBADKEY;
3390+ }
3391+ return 0;
3392+}
3393+
3394+static const struct argp argp_default_argp =
3395+ {argp_default_options, &argp_default_parser, NULL, NULL, NULL, NULL, "libc"};
3396+
3397+
3398+static const struct argp_option argp_version_options[] =
3399+{
3400+ {"version", 'V', 0, 0, N_("Print program version"), -1},
3401+ {0, 0}
3402+};
3403+
3404+static error_t
3405+argp_version_parser (int key, char *arg, struct argp_state *state)
3406+{
3407+ switch (key)
3408+ {
3409+ case 'V':
3410+ if (argp_program_version_hook)
3411+ (*argp_program_version_hook) (state->out_stream, state);
3412+ else if (argp_program_version)
3413+ fprintf (state->out_stream, "%s\n", argp_program_version);
3414+ else
3415+ argp_error (state, dgettext (state->root_argp->argp_domain,
3416+ "(PROGRAM ERROR) No version known!?"));
3417+ if (! (state->flags & ARGP_NO_EXIT))
3418+ exit (0);
3419+ break;
3420+ default:
3421+ return EBADKEY;
3422+ }
3423+ return 0;
3424+}
3425+
3426+static const struct argp argp_version_argp =
3427+ {argp_version_options, &argp_version_parser, NULL, NULL, NULL, NULL, "libc"};
3428+
3429+/* Returns the offset into the getopt long options array LONG_OPTIONS of a
3430+ long option with called NAME, or -1 if none is found. Passing NULL as
3431+ NAME will return the number of options. */
3432+static int
3433+find_long_option (struct option *long_options, const char *name)
3434+{
3435+ struct option *l = long_options;
3436+ while (l->name != NULL)
3437+ if (name != NULL && strcmp (l->name, name) == 0)
3438+ return l - long_options;
3439+ else
3440+ l++;
3441+ if (name == NULL)
3442+ return l - long_options;
3443+ else
3444+ return -1;
3445+}
3446+
3447+
3448+/* The state of a `group' during parsing. Each group corresponds to a
3449+ particular argp structure from the tree of such descending from the top
3450+ level argp passed to argp_parse. */
3451+struct group
3452+{
3453+ /* This group's parsing function. */
3454+ argp_parser_t parser;
3455+
3456+ /* Which argp this group is from. */
3457+ const struct argp *argp;
3458+
3459+ /* Points to the point in SHORT_OPTS corresponding to the end of the short
3460+ options for this group. We use it to determine from which group a
3461+ particular short options is from. */
3462+ char *short_end;
3463+
3464+ /* The number of non-option args sucessfully handled by this parser. */
3465+ unsigned args_processed;
3466+
3467+ /* This group's parser's parent's group. */
3468+ struct group *parent;
3469+ unsigned parent_index; /* And the our position in the parent. */
3470+
3471+ /* These fields are swapped into and out of the state structure when
3472+ calling this group's parser. */
3473+ void *input, **child_inputs;
3474+ void *hook;
3475+};
3476+
3477+/* Call GROUP's parser with KEY and ARG, swapping any group-specific info
3478+ from STATE before calling, and back into state afterwards. If GROUP has
3479+ no parser, EBADKEY is returned. */
3480+static error_t
3481+group_parse (struct group *group, struct argp_state *state, int key, char *arg)
3482+{
3483+ if (group->parser)
3484+ {
3485+ error_t err;
3486+ state->hook = group->hook;
3487+ state->input = group->input;
3488+ state->child_inputs = group->child_inputs;
3489+ state->arg_num = group->args_processed;
3490+ err = (*group->parser)(key, arg, state);
3491+ group->hook = state->hook;
3492+ return err;
3493+ }
3494+ else
3495+ return EBADKEY;
3496+}
3497+
3498+struct parser
3499+{
3500+ const struct argp *argp;
3501+
3502+ /* SHORT_OPTS is the getopt short options string for the union of all the
3503+ groups of options. */
3504+ char *short_opts;
3505+ /* LONG_OPTS is the array of getop long option structures for the union of
3506+ all the groups of options. */
3507+ struct option *long_opts;
3508+ /* OPT_DATA is the getopt data used for the re-entrant getopt. */
3509+ struct _getopt_data opt_data;
3510+
3511+ /* States of the various parsing groups. */
3512+ struct group *groups;
3513+ /* The end of the GROUPS array. */
3514+ struct group *egroup;
3515+ /* An vector containing storage for the CHILD_INPUTS field in all groups. */
3516+ void **child_inputs;
3517+
3518+ /* True if we think using getopt is still useful; if false, then
3519+ remaining arguments are just passed verbatim with ARGP_KEY_ARG. This is
3520+ cleared whenever getopt returns KEY_END, but may be set again if the user
3521+ moves the next argument pointer backwards. */
3522+ int try_getopt;
3523+
3524+ /* State block supplied to parsing routines. */
3525+ struct argp_state state;
3526+
3527+ /* Memory used by this parser. */
3528+ void *storage;
3529+};
3530+
3531+/* The next usable entries in the various parser tables being filled in by
3532+ convert_options. */
3533+struct parser_convert_state
3534+{
3535+ struct parser *parser;
3536+ char *short_end;
3537+ struct option *long_end;
3538+ void **child_inputs_end;
3539+};
3540+
3541+/* Converts all options in ARGP (which is put in GROUP) and ancestors
3542+ into getopt options stored in SHORT_OPTS and LONG_OPTS; SHORT_END and
3543+ CVT->LONG_END are the points at which new options are added. Returns the
3544+ next unused group entry. CVT holds state used during the conversion. */
3545+static struct group *
3546+convert_options (const struct argp *argp,
3547+ struct group *parent, unsigned parent_index,
3548+ struct group *group, struct parser_convert_state *cvt)
3549+{
3550+ /* REAL is the most recent non-alias value of OPT. */
3551+ const struct argp_option *real = argp->options;
3552+ const struct argp_child *children = argp->children;
3553+
3554+ if (real || argp->parser)
3555+ {
3556+ const struct argp_option *opt;
3557+
3558+ if (real)
3559+ for (opt = real; !__option_is_end (opt); opt++)
3560+ {
3561+ if (! (opt->flags & OPTION_ALIAS))
3562+ /* OPT isn't an alias, so we can use values from it. */
3563+ real = opt;
3564+
3565+ if (! (real->flags & OPTION_DOC))
3566+ /* A real option (not just documentation). */
3567+ {
3568+ if (__option_is_short (opt))
3569+ /* OPT can be used as a short option. */
3570+ {
3571+ *cvt->short_end++ = opt->key;
3572+ if (real->arg)
3573+ {
3574+ *cvt->short_end++ = ':';
3575+ if (real->flags & OPTION_ARG_OPTIONAL)
3576+ *cvt->short_end++ = ':';
3577+ }
3578+ *cvt->short_end = '\0'; /* keep 0 terminated */
3579+ }
3580+
3581+ if (opt->name
3582+ && find_long_option (cvt->parser->long_opts, opt->name) < 0)
3583+ /* OPT can be used as a long option. */
3584+ {
3585+ cvt->long_end->name = opt->name;
3586+ cvt->long_end->has_arg =
3587+ (real->arg
3588+ ? (real->flags & OPTION_ARG_OPTIONAL
3589+ ? optional_argument
3590+ : required_argument)
3591+ : no_argument);
3592+ cvt->long_end->flag = 0;
3593+ /* we add a disambiguating code to all the user's
3594+ values (which is removed before we actually call
3595+ the function to parse the value); this means that
3596+ the user loses use of the high 8 bits in all his
3597+ values (the sign of the lower bits is preserved
3598+ however)... */
3599+ cvt->long_end->val =
3600+ ((opt->key | real->key) & USER_MASK)
3601+ + (((group - cvt->parser->groups) + 1) << USER_BITS);
3602+
3603+ /* Keep the LONG_OPTS list terminated. */
3604+ (++cvt->long_end)->name = NULL;
3605+ }
3606+ }
3607+ }
3608+
3609+ group->parser = argp->parser;
3610+ group->argp = argp;
3611+ group->short_end = cvt->short_end;
3612+ group->args_processed = 0;
3613+ group->parent = parent;
3614+ group->parent_index = parent_index;
3615+ group->input = 0;
3616+ group->hook = 0;
3617+ group->child_inputs = 0;
3618+
3619+ if (children)
3620+ /* Assign GROUP's CHILD_INPUTS field some space from
3621+ CVT->child_inputs_end.*/
3622+ {
3623+ unsigned num_children = 0;
3624+ while (children[num_children].argp)
3625+ num_children++;
3626+ group->child_inputs = cvt->child_inputs_end;
3627+ cvt->child_inputs_end += num_children;
3628+ }
3629+
3630+ parent = group++;
3631+ }
3632+ else
3633+ parent = 0;
3634+
3635+ if (children)
3636+ {
3637+ unsigned index = 0;
3638+ while (children->argp)
3639+ group =
3640+ convert_options (children++->argp, parent, index++, group, cvt);
3641+ }
3642+
3643+ return group;
3644+}
3645+
3646+/* Find the merged set of getopt options, with keys appropiately prefixed. */
3647+static void
3648+parser_convert (struct parser *parser, const struct argp *argp, int flags)
3649+{
3650+ struct parser_convert_state cvt;
3651+
3652+ cvt.parser = parser;
3653+ cvt.short_end = parser->short_opts;
3654+ cvt.long_end = parser->long_opts;
3655+ cvt.child_inputs_end = parser->child_inputs;
3656+
3657+ if (flags & ARGP_IN_ORDER)
3658+ *cvt.short_end++ = '-';
3659+ else if (flags & ARGP_NO_ARGS)
3660+ *cvt.short_end++ = '+';
3661+ *cvt.short_end = '\0';
3662+
3663+ cvt.long_end->name = NULL;
3664+
3665+ parser->argp = argp;
3666+
3667+ if (argp)
3668+ parser->egroup = convert_options (argp, 0, 0, parser->groups, &cvt);
3669+ else
3670+ parser->egroup = parser->groups; /* No parsers at all! */
3671+}
3672+
3673+/* Lengths of various parser fields which we will allocated. */
3674+struct parser_sizes
3675+{
3676+ size_t short_len; /* Getopt short options string. */
3677+ size_t long_len; /* Getopt long options vector. */
3678+ size_t num_groups; /* Group structures we allocate. */
3679+ size_t num_child_inputs; /* Child input slots. */
3680+};
3681+
3682+/* For ARGP, increments the NUM_GROUPS field in SZS by the total number of
3683+ argp structures descended from it, and the SHORT_LEN & LONG_LEN fields by
3684+ the maximum lengths of the resulting merged getopt short options string and
3685+ long-options array, respectively. */
3686+static void
3687+calc_sizes (const struct argp *argp, struct parser_sizes *szs)
3688+{
3689+ const struct argp_child *child = argp->children;
3690+ const struct argp_option *opt = argp->options;
3691+
3692+ if (opt || argp->parser)
3693+ {
3694+ szs->num_groups++;
3695+ if (opt)
3696+ {
3697+ int num_opts = 0;
3698+ while (!__option_is_end (opt++))
3699+ num_opts++;
3700+ szs->short_len += num_opts * 3; /* opt + up to 2 `:'s */
3701+ szs->long_len += num_opts;
3702+ }
3703+ }
3704+
3705+ if (child)
3706+ while (child->argp)
3707+ {
3708+ calc_sizes ((child++)->argp, szs);
3709+ szs->num_child_inputs++;
3710+ }
3711+}
3712+
3713+
3714+extern char * __argp_short_program_name (void);
3715+/* Initializes PARSER to parse ARGP in a manner described by FLAGS. */
3716+static error_t
3717+parser_init (struct parser *parser, const struct argp *argp,
3718+ int argc, char **argv, int flags, void *input)
3719+{
3720+ error_t err = 0;
3721+ struct group *group;
3722+ struct parser_sizes szs;
3723+ struct _getopt_data opt_data = _GETOPT_DATA_INITIALIZER;
3724+
3725+ szs.short_len = (flags & ARGP_NO_ARGS) ? 0 : 1;
3726+ szs.long_len = 0;
3727+ szs.num_groups = 0;
3728+ szs.num_child_inputs = 0;
3729+
3730+ if (argp)
3731+ calc_sizes (argp, &szs);
3732+
3733+ /* Lengths of the various bits of storage used by PARSER. */
3734+#define GLEN (szs.num_groups + 1) * sizeof (struct group)
3735+#define CLEN (szs.num_child_inputs * sizeof (void *))
3736+#define LLEN ((szs.long_len + 1) * sizeof (struct option))
3737+#define SLEN (szs.short_len + 1)
3738+
3739+ parser->storage = malloc (GLEN + CLEN + LLEN + SLEN);
3740+ if (! parser->storage)
3741+ return ENOMEM;
3742+
3743+ parser->groups = parser->storage;
3744+ parser->child_inputs = parser->storage + GLEN;
3745+ parser->long_opts = parser->storage + GLEN + CLEN;
3746+ parser->short_opts = parser->storage + GLEN + CLEN + LLEN;
3747+ parser->opt_data = opt_data;
3748+
3749+ memset (parser->child_inputs, 0, szs.num_child_inputs * sizeof (void *));
3750+ parser_convert (parser, argp, flags);
3751+
3752+ memset (&parser->state, 0, sizeof (struct argp_state));
3753+ parser->state.root_argp = parser->argp;
3754+ parser->state.argc = argc;
3755+ parser->state.argv = argv;
3756+ parser->state.flags = flags;
3757+ parser->state.err_stream = stderr;
3758+ parser->state.out_stream = stdout;
3759+ parser->state.next = 0; /* Tell getopt to initialize. */
3760+ parser->state.pstate = parser;
3761+
3762+ parser->try_getopt = 1;
3763+
3764+ /* Call each parser for the first time, giving it a chance to propagate
3765+ values to child parsers. */
3766+ if (parser->groups < parser->egroup)
3767+ parser->groups->input = input;
3768+ for (group = parser->groups;
3769+ group < parser->egroup && (!err || err == EBADKEY);
3770+ group++)
3771+ {
3772+ if (group->parent)
3773+ /* If a child parser, get the initial input value from the parent. */
3774+ group->input = group->parent->child_inputs[group->parent_index];
3775+
3776+ if (!group->parser
3777+ && group->argp->children && group->argp->children->argp)
3778+ /* For the special case where no parsing function is supplied for an
3779+ argp, propagate its input to its first child, if any (this just
3780+ makes very simple wrapper argps more convenient). */
3781+ group->child_inputs[0] = group->input;
3782+
3783+ err = group_parse (group, &parser->state, ARGP_KEY_INIT, 0);
3784+ }
3785+ if (err == EBADKEY)
3786+ err = 0; /* Some parser didn't understand. */
3787+
3788+ if (err)
3789+ return err;
3790+
3791+ if (parser->state.flags & ARGP_NO_ERRS)
3792+ {
3793+ parser->opt_data.opterr = 0;
3794+ if (parser->state.flags & ARGP_PARSE_ARGV0)
3795+ /* getopt always skips ARGV[0], so we have to fake it out. As long
3796+ as OPTERR is 0, then it shouldn't actually try to access it. */
3797+ parser->state.argv--, parser->state.argc++;
3798+ }
3799+ else
3800+ parser->opt_data.opterr = 1; /* Print error messages. */
3801+
3802+ if (parser->state.argv == argv && argv[0])
3803+ /* There's an argv[0]; use it for messages. */
3804+ {
3805+ char *short_name = strrchr (argv[0], '/');
3806+ parser->state.name = short_name ? short_name + 1 : argv[0];
3807+ }
3808+ else
3809+ parser->state.name = __argp_short_program_name ();
3810+
3811+ return 0;
3812+}
3813+
3814+/* Free any storage consumed by PARSER (but not PARSER itself). */
3815+static error_t
3816+parser_finalize (struct parser *parser,
3817+ error_t err, int arg_ebadkey, int *end_index)
3818+{
3819+ struct group *group;
3820+
3821+ if (err == EBADKEY && arg_ebadkey)
3822+ /* Suppress errors generated by unparsed arguments. */
3823+ err = 0;
3824+
3825+ if (! err)
3826+ {
3827+ if (parser->state.next == parser->state.argc)
3828+ /* We successfully parsed all arguments! Call all the parsers again,
3829+ just a few more times... */
3830+ {
3831+ for (group = parser->groups;
3832+ group < parser->egroup && (!err || err==EBADKEY);
3833+ group++)
3834+ if (group->args_processed == 0)
3835+ err = group_parse (group, &parser->state, ARGP_KEY_NO_ARGS, 0);
3836+ for (group = parser->egroup - 1;
3837+ group >= parser->groups && (!err || err==EBADKEY);
3838+ group--)
3839+ err = group_parse (group, &parser->state, ARGP_KEY_END, 0);
3840+
3841+ if (err == EBADKEY)
3842+ err = 0; /* Some parser didn't understand. */
3843+
3844+ /* Tell the user that all arguments are parsed. */
3845+ if (end_index)
3846+ *end_index = parser->state.next;
3847+ }
3848+ else if (end_index)
3849+ /* Return any remaining arguments to the user. */
3850+ *end_index = parser->state.next;
3851+ else
3852+ /* No way to return the remaining arguments, they must be bogus. */
3853+ {
3854+ if (!(parser->state.flags & ARGP_NO_ERRS)
3855+ && parser->state.err_stream)
3856+ fprintf (parser->state.err_stream,
3857+ dgettext (parser->argp->argp_domain,
3858+ "%s: Too many arguments\n"),
3859+ parser->state.name);
3860+ err = EBADKEY;
3861+ }
3862+ }
3863+
3864+ /* Okay, we're all done, with either an error or success; call the parsers
3865+ to indicate which one. */
3866+
3867+ if (err)
3868+ {
3869+ /* Maybe print an error message. */
3870+ if (err == EBADKEY)
3871+ /* An appropriate message describing what the error was should have
3872+ been printed earlier. */
3873+ argp_state_help (&parser->state, parser->state.err_stream,
3874+ ARGP_HELP_STD_ERR);
3875+
3876+ /* Since we didn't exit, give each parser an error indication. */
3877+ for (group = parser->groups; group < parser->egroup; group++)
3878+ group_parse (group, &parser->state, ARGP_KEY_ERROR, 0);
3879+ }
3880+ else
3881+ /* Notify parsers of success, and propagate back values from parsers. */
3882+ {
3883+ /* We pass over the groups in reverse order so that child groups are
3884+ given a chance to do there processing before passing back a value to
3885+ the parent. */
3886+ for (group = parser->egroup - 1
3887+ ; group >= parser->groups && (!err || err == EBADKEY)
3888+ ; group--)
3889+ err = group_parse (group, &parser->state, ARGP_KEY_SUCCESS, 0);
3890+ if (err == EBADKEY)
3891+ err = 0; /* Some parser didn't understand. */
3892+ }
3893+
3894+ /* Call parsers once more, to do any final cleanup. Errors are ignored. */
3895+ for (group = parser->egroup - 1; group >= parser->groups; group--)
3896+ group_parse (group, &parser->state, ARGP_KEY_FINI, 0);
3897+
3898+ if (err == EBADKEY)
3899+ err = EINVAL;
3900+
3901+ free (parser->storage);
3902+
3903+ return err;
3904+}
3905+
3906+/* Call the user parsers to parse the non-option argument VAL, at the current
3907+ position, returning any error. The state NEXT pointer is assumed to have
3908+ been adjusted (by getopt) to point after this argument; this function will
3909+ adjust it correctly to reflect however many args actually end up being
3910+ consumed. */
3911+static error_t
3912+parser_parse_arg (struct parser *parser, char *val)
3913+{
3914+ /* Save the starting value of NEXT, first adjusting it so that the arg
3915+ we're parsing is again the front of the arg vector. */
3916+ int index = --parser->state.next;
3917+ error_t err = EBADKEY;
3918+ struct group *group;
3919+ int key = 0; /* Which of ARGP_KEY_ARG[S] we used. */
3920+
3921+ /* Try to parse the argument in each parser. */
3922+ for (group = parser->groups
3923+ ; group < parser->egroup && err == EBADKEY
3924+ ; group++)
3925+ {
3926+ parser->state.next++; /* For ARGP_KEY_ARG, consume the arg. */
3927+ key = ARGP_KEY_ARG;
3928+ err = group_parse (group, &parser->state, key, val);
3929+
3930+ if (err == EBADKEY)
3931+ /* This parser doesn't like ARGP_KEY_ARG; try ARGP_KEY_ARGS instead. */
3932+ {
3933+ parser->state.next--; /* For ARGP_KEY_ARGS, put back the arg. */
3934+ key = ARGP_KEY_ARGS;
3935+ err = group_parse (group, &parser->state, key, 0);
3936+ }
3937+ }
3938+
3939+ if (! err)
3940+ {
3941+ if (key == ARGP_KEY_ARGS)
3942+ /* The default for ARGP_KEY_ARGS is to assume that if NEXT isn't
3943+ changed by the user, *all* arguments should be considered
3944+ consumed. */
3945+ parser->state.next = parser->state.argc;
3946+
3947+ if (parser->state.next > index)
3948+ /* Remember that we successfully processed a non-option
3949+ argument -- but only if the user hasn't gotten tricky and set
3950+ the clock back. */
3951+ (--group)->args_processed += (parser->state.next - index);
3952+ else
3953+ /* The user wants to reparse some args, give getopt another try. */
3954+ parser->try_getopt = 1;
3955+ }
3956+
3957+ return err;
3958+}
3959+
3960+/* Call the user parsers to parse the option OPT, with argument VAL, at the
3961+ current position, returning any error. */
3962+static error_t
3963+parser_parse_opt (struct parser *parser, int opt, char *val)
3964+{
3965+ /* The group key encoded in the high bits; 0 for short opts or
3966+ group_number + 1 for long opts. */
3967+ int group_key = opt >> USER_BITS;
3968+ error_t err = EBADKEY;
3969+
3970+ if (group_key == 0)
3971+ /* A short option. By comparing OPT's position in SHORT_OPTS to the
3972+ various starting positions in each group's SHORT_END field, we can
3973+ determine which group OPT came from. */
3974+ {
3975+ struct group *group;
3976+ char *short_index = strchr (parser->short_opts, opt);
3977+
3978+ if (short_index)
3979+ for (group = parser->groups; group < parser->egroup; group++)
3980+ if (group->short_end > short_index)
3981+ {
3982+ err = group_parse (group, &parser->state, opt,
3983+ parser->opt_data.optarg);
3984+ break;
3985+ }
3986+ }
3987+ else
3988+ /* A long option. We use shifts instead of masking for extracting
3989+ the user value in order to preserve the sign. */
3990+ err =
3991+ group_parse (&parser->groups[group_key - 1], &parser->state,
3992+ (opt << GROUP_BITS) >> GROUP_BITS,
3993+ parser->opt_data.optarg);
3994+
3995+ if (err == EBADKEY)
3996+ /* At least currently, an option not recognized is an error in the
3997+ parser, because we pre-compute which parser is supposed to deal
3998+ with each option. */
3999+ {
4000+ static const char bad_key_err[] =
4001+ N_("(PROGRAM ERROR) Option should have been recognized!?");
4002+ if (group_key == 0)
4003+ argp_error (&parser->state, "-%c: %s", opt,
4004+ dgettext (parser->argp->argp_domain, bad_key_err));
4005+ else
4006+ {
4007+ struct option *long_opt = parser->long_opts;
4008+ while (long_opt->val != opt && long_opt->name)
4009+ long_opt++;
4010+ argp_error (&parser->state, "--%s: %s",
4011+ long_opt->name ? long_opt->name : "???",
4012+ dgettext (parser->argp->argp_domain, bad_key_err));
4013+ }
4014+ }
4015+
4016+ return err;
4017+}
4018+
4019+/* Parse the next argument in PARSER (as indicated by PARSER->state.next).
4020+ Any error from the parsers is returned, and *ARGP_EBADKEY indicates
4021+ whether a value of EBADKEY is due to an unrecognized argument (which is
4022+ generally not fatal). */
4023+static error_t
4024+parser_parse_next (struct parser *parser, int *arg_ebadkey)
4025+{
4026+ int opt;
4027+ error_t err = 0;
4028+
4029+ if (parser->state.quoted && parser->state.next < parser->state.quoted)
4030+ /* The next argument pointer has been moved to before the quoted
4031+ region, so pretend we never saw the quoting `--', and give getopt
4032+ another chance. If the user hasn't removed it, getopt will just
4033+ process it again. */
4034+ parser->state.quoted = 0;
4035+
4036+ if (parser->try_getopt && !parser->state.quoted)
4037+ /* Give getopt a chance to parse this. */
4038+ {
4039+ /* Put it back in OPTIND for getopt. */
4040+ parser->opt_data.optind = parser->state.next;
4041+ /* Distinguish KEY_ERR from a real option. */
4042+ parser->opt_data.optopt = KEY_END;
4043+ if (parser->state.flags & ARGP_LONG_ONLY)
4044+ opt = _getopt_long_only_r (parser->state.argc, parser->state.argv,
4045+ parser->short_opts, parser->long_opts, 0,
4046+ &parser->opt_data);
4047+ else
4048+ opt = _getopt_long_r (parser->state.argc, parser->state.argv,
4049+ parser->short_opts, parser->long_opts, 0,
4050+ &parser->opt_data);
4051+ /* And see what getopt did. */
4052+ parser->state.next = parser->opt_data.optind;
4053+
4054+ if (opt == KEY_END)
4055+ /* Getopt says there are no more options, so stop using
4056+ getopt; we'll continue if necessary on our own. */
4057+ {
4058+ parser->try_getopt = 0;
4059+ if (parser->state.next > 1
4060+ && strcmp (parser->state.argv[parser->state.next - 1], QUOTE)
4061+ == 0)
4062+ /* Not only is this the end of the options, but it's a
4063+ `quoted' region, which may have args that *look* like
4064+ options, so we definitely shouldn't try to use getopt past
4065+ here, whatever happens. */
4066+ parser->state.quoted = parser->state.next;
4067+ }
4068+ else if (opt == KEY_ERR && parser->opt_data.optopt != KEY_END)
4069+ /* KEY_ERR can have the same value as a valid user short
4070+ option, but in the case of a real error, getopt sets OPTOPT
4071+ to the offending character, which can never be KEY_END. */
4072+ {
4073+ *arg_ebadkey = 0;
4074+ return EBADKEY;
4075+ }
4076+ }
4077+ else
4078+ opt = KEY_END;
4079+
4080+ if (opt == KEY_END)
4081+ {
4082+ /* We're past what getopt considers the options. */
4083+ if (parser->state.next >= parser->state.argc
4084+ || (parser->state.flags & ARGP_NO_ARGS))
4085+ /* Indicate that we're done. */
4086+ {
4087+ *arg_ebadkey = 1;
4088+ return EBADKEY;
4089+ }
4090+ else
4091+ /* A non-option arg; simulate what getopt might have done. */
4092+ {
4093+ opt = KEY_ARG;
4094+ parser->opt_data.optarg = parser->state.argv[parser->state.next++];
4095+ }
4096+ }
4097+
4098+ if (opt == KEY_ARG)
4099+ /* A non-option argument; try each parser in turn. */
4100+ err = parser_parse_arg (parser, parser->opt_data.optarg);
4101+ else
4102+ err = parser_parse_opt (parser, opt, parser->opt_data.optarg);
4103+
4104+ if (err == EBADKEY)
4105+ *arg_ebadkey = (opt == KEY_END || opt == KEY_ARG);
4106+
4107+ return err;
4108+}
4109+
4110+/* Parse the options strings in ARGC & ARGV according to the argp in ARGP.
4111+ FLAGS is one of the ARGP_ flags above. If END_INDEX is non-NULL, the
4112+ index in ARGV of the first unparsed option is returned in it. If an
4113+ unknown option is present, EINVAL is returned; if some parser routine
4114+ returned a non-zero value, it is returned; otherwise 0 is returned. */
4115+error_t
4116+argp_parse (const struct argp *argp, int argc, char **argv, unsigned flags,
4117+ int *end_index, void *input)
4118+{
4119+ error_t err;
4120+ struct parser parser;
4121+
4122+ /* If true, then err == EBADKEY is a result of a non-option argument failing
4123+ to be parsed (which in some cases isn't actually an error). */
4124+ int arg_ebadkey = 0;
4125+
4126+ if (! (flags & ARGP_NO_HELP))
4127+ /* Add our own options. */
4128+ {
4129+ struct argp_child *child = alloca (4 * sizeof (struct argp_child));
4130+ struct argp *top_argp = alloca (sizeof (struct argp));
4131+
4132+ /* TOP_ARGP has no options, it just serves to group the user & default
4133+ argps. */
4134+ memset (top_argp, 0, sizeof (*top_argp));
4135+ top_argp->children = child;
4136+
4137+ memset (child, 0, 4 * sizeof (struct argp_child));
4138+
4139+ if (argp)
4140+ (child++)->argp = argp;
4141+ (child++)->argp = &argp_default_argp;
4142+ if (argp_program_version || argp_program_version_hook)
4143+ (child++)->argp = &argp_version_argp;
4144+ child->argp = 0;
4145+
4146+ argp = top_argp;
4147+ }
4148+
4149+ /* Construct a parser for these arguments. */
4150+ err = parser_init (&parser, argp, argc, argv, flags, input);
4151+
4152+ if (! err)
4153+ /* Parse! */
4154+ {
4155+ while (! err)
4156+ err = parser_parse_next (&parser, &arg_ebadkey);
4157+ err = parser_finalize (&parser, err, arg_ebadkey, end_index);
4158+ }
4159+
4160+ return err;
4161+}
4162+
4163+/* Return the input field for ARGP in the parser corresponding to STATE; used
4164+ by the help routines. */
4165+void *
4166+__argp_input (const struct argp *argp, const struct argp_state *state)
4167+{
4168+ if (state)
4169+ {
4170+ struct group *group;
4171+ struct parser *parser = state->pstate;
4172+
4173+ for (group = parser->groups; group < parser->egroup; group++)
4174+ if (group->argp == argp)
4175+ return group->input;
4176+ }
4177+
4178+ return 0;
4179+}
4180Index: git/libuargp/argp-pv.c
4181===================================================================
4182--- /dev/null
4183+++ git/libuargp/argp-pv.c
4184@@ -0,0 +1,25 @@
4185+/* Default definition for ARGP_PROGRAM_VERSION.
4186+ Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
4187+ This file is part of the GNU C Library.
4188+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
4189+
4190+ The GNU C Library is free software; you can redistribute it and/or
4191+ modify it under the terms of the GNU Lesser General Public
4192+ License as published by the Free Software Foundation; either
4193+ version 2.1 of the License, or (at your option) any later version.
4194+
4195+ The GNU C Library is distributed in the hope that it will be useful,
4196+ but WITHOUT ANY WARRANTY; without even the implied warranty of
4197+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4198+ Lesser General Public License for more details.
4199+
4200+ You should have received a copy of the GNU Lesser General Public
4201+ License along with the GNU C Library; if not, write to the Free
4202+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4203+ 02111-1307 USA. */
4204+
4205+/* If set by the user program to a non-zero value, then a default option
4206+ --version is added (unless the ARGP_NO_HELP flag is used), which will
4207+ print this this string followed by a newline and exit (unless the
4208+ ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */
4209+const char *argp_program_version;
4210Index: git/libuargp/argp-pvh.c
4211===================================================================
4212--- /dev/null
4213+++ git/libuargp/argp-pvh.c
4214@@ -0,0 +1,32 @@
4215+/* Default definition for ARGP_PROGRAM_VERSION_HOOK.
4216+ Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
4217+ This file is part of the GNU C Library.
4218+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
4219+
4220+ The GNU C Library is free software; you can redistribute it and/or
4221+ modify it under the terms of the GNU Lesser General Public
4222+ License as published by the Free Software Foundation; either
4223+ version 2.1 of the License, or (at your option) any later version.
4224+
4225+ The GNU C Library is distributed in the hope that it will be useful,
4226+ but WITHOUT ANY WARRANTY; without even the implied warranty of
4227+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4228+ Lesser General Public License for more details.
4229+
4230+ You should have received a copy of the GNU Lesser General Public
4231+ License along with the GNU C Library; if not, write to the Free
4232+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4233+ 02111-1307 USA. */
4234+
4235+#ifdef HAVE_CONFIG_H
4236+#include <config.h>
4237+#endif
4238+
4239+#include <argp.h>
4240+
4241+/* If set by the user program to a non-zero value, then a default option
4242+ --version is added (unless the ARGP_NO_HELP flag is used), which calls
4243+ this function with a stream to print the version to and a pointer to the
4244+ current parsing state, and then exits (unless the ARGP_NO_EXIT flag is
4245+ used). This variable takes precedent over ARGP_PROGRAM_VERSION. */
4246+void (*argp_program_version_hook) (FILE *stream, struct argp_state *state);
4247Index: git/libuargp/argp-xinl.c
4248===================================================================
4249--- /dev/null
4250+++ git/libuargp/argp-xinl.c
4251@@ -0,0 +1,35 @@
4252+/* Real definitions for extern inline functions in argp.h
4253+ Copyright (C) 1997, 1998, 2004 Free Software Foundation, Inc.
4254+ This file is part of the GNU C Library.
4255+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
4256+
4257+ The GNU C Library is free software; you can redistribute it and/or
4258+ modify it under the terms of the GNU Lesser General Public
4259+ License as published by the Free Software Foundation; either
4260+ version 2.1 of the License, or (at your option) any later version.
4261+
4262+ The GNU C Library is distributed in the hope that it will be useful,
4263+ but WITHOUT ANY WARRANTY; without even the implied warranty of
4264+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4265+ Lesser General Public License for more details.
4266+
4267+ You should have received a copy of the GNU Lesser General Public
4268+ License along with the GNU C Library; if not, write to the Free
4269+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4270+ 02111-1307 USA. */
4271+
4272+#ifdef HAVE_CONFIG_H
4273+# include <config.h>
4274+#endif
4275+
4276+#if defined _LIBC || defined HAVE_FEATURES_H
4277+# include <features.h>
4278+#endif
4279+
4280+#ifndef __USE_EXTERN_INLINES
4281+# define __USE_EXTERN_INLINES 1
4282+#endif
4283+#define ARGP_EI
4284+#undef __OPTIMIZE__
4285+#define __OPTIMIZE__ 1
4286+#include <argp.h>
4287Index: git/test/argp/Makefile
4288===================================================================
4289--- /dev/null
4290+++ git/test/argp/Makefile
4291@@ -0,0 +1,7 @@
4292+# uClibc argp tests
4293+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
4294+
4295+top_builddir=../../
4296+include ../Rules.mak
4297+-include Makefile.in
4298+include ../Test.mak
4299Index: git/test/argp/Makefile.in
4300===================================================================
4301--- /dev/null
4302+++ git/test/argp/Makefile.in
4303@@ -0,0 +1,12 @@
4304+# uClibc argp tests
4305+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
4306+
4307+TESTS := $(addprefix argp-, ex1 ex2 ex3 ex4 test) \
4308+ bug-argp1 tst-argp1 tst-argp2
4309+
4310+EXTRA_LDFLAGS = -luargp
4311+
4312+OPTS_argp-ex3 = ARG1 ARG2
4313+OPTS_argp-ex4 = ARG1 string1 string2 string3
4314+OPTS_bug-argp1 = -- --help
4315+
4316Index: git/test/argp/argp-ex1.c
4317===================================================================
4318--- /dev/null
4319+++ git/test/argp/argp-ex1.c
4320@@ -0,0 +1,15 @@
4321+/* Argp example #1 -- a minimal program using argp */
4322+
4323+/* This is (probably) the smallest possible program that
4324+ uses argp. It won't do much except give an error
4325+ messages and exit when there are any arguments, and print
4326+ a (rather pointless) messages for --help. */
4327+
4328+#include <stdlib.h>
4329+#include <argp.h>
4330+
4331+int main (int argc, char **argv)
4332+{
4333+ argp_parse (0, argc, argv, 0, 0, 0);
4334+ exit (0);
4335+}
4336Index: git/test/argp/argp-ex2.c
4337===================================================================
4338--- /dev/null
4339+++ git/test/argp/argp-ex2.c
4340@@ -0,0 +1,45 @@
4341+/* Argp example #2 -- a pretty minimal program using argp */
4342+
4343+/* This program doesn't use any options or arguments, but uses
4344+ argp to be compliant with the GNU standard command line
4345+ format.
4346+
4347+ In addition to making sure no arguments are given, and
4348+ implementing a --help option, this example will have a
4349+ --version option, and will put the given documentation string
4350+ and bug address in the --help output, as per GNU standards.
4351+
4352+ The variable ARGP contains the argument parser specification;
4353+ adding fields to this structure is the way most parameters are
4354+ passed to argp_parse (the first three fields are usually used,
4355+ but not in this small program). There are also two global
4356+ variables that argp knows about defined here,
4357+ ARGP_PROGRAM_VERSION and ARGP_PROGRAM_BUG_ADDRESS (they are
4358+ global variables because they will almost always be constant
4359+ for a given program, even if it uses different argument
4360+ parsers for various tasks). */
4361+
4362+#include <stdlib.h>
4363+#include <argp.h>
4364+
4365+const char *argp_program_version =
4366+ "argp-ex2 1.0";
4367+const char *argp_program_bug_address =
4368+ "<bug-gnu-utils@@gnu.org>";
4369+
4370+/* Program documentation. */
4371+static char doc[] =
4372+ "Argp example #2 -- a pretty minimal program using argp";
4373+
4374+/* Our argument parser. The @code{options}, @code{parser}, and
4375+ @code{args_doc} fields are zero because we have neither options or
4376+ arguments; @code{doc} and @code{argp_program_bug_address} will be
4377+ used in the output for @samp{--help}, and the @samp{--version}
4378+ option will print out @code{argp_program_version}. */
4379+static struct argp argp = { 0, 0, 0, doc };
4380+
4381+int main (int argc, char **argv)
4382+{
4383+ argp_parse (&argp, argc, argv, 0, 0, 0);
4384+ exit (0);
4385+}
4386Index: git/test/argp/argp-ex3.c
4387===================================================================
4388--- /dev/null
4389+++ git/test/argp/argp-ex3.c
4390@@ -0,0 +1,153 @@
4391+/* Argp example #3 -- a program with options and arguments using argp */
4392+
4393+/* This program uses the same features as example 2, and uses options and
4394+ arguments.
4395+
4396+ We now use the first four fields in ARGP, so here's a description of them:
4397+ OPTIONS -- A pointer to a vector of struct argp_option (see below)
4398+ PARSER -- A function to parse a single option, called by argp
4399+ ARGS_DOC -- A string describing how the non-option arguments should look
4400+ DOC -- A descriptive string about this program; if it contains a
4401+ vertical tab character (\v), the part after it will be
4402+ printed *following* the options
4403+
4404+ The function PARSER takes the following arguments:
4405+ KEY -- An integer specifying which option this is (taken
4406+ from the KEY field in each struct argp_option), or
4407+ a special key specifying something else; the only
4408+ special keys we use here are ARGP_KEY_ARG, meaning
4409+ a non-option argument, and ARGP_KEY_END, meaning
4410+ that all arguments have been parsed
4411+ ARG -- For an option KEY, the string value of its
4412+ argument, or NULL if it has none
4413+ STATE-- A pointer to a struct argp_state, containing
4414+ various useful information about the parsing state; used here
4415+ are the INPUT field, which reflects the INPUT argument to
4416+ argp_parse, and the ARG_NUM field, which is the number of the
4417+ current non-option argument being parsed
4418+ It should return either 0, meaning success, ARGP_ERR_UNKNOWN, meaning the
4419+ given KEY wasn't recognized, or an errno value indicating some other
4420+ error.
4421+
4422+ Note that in this example, main uses a structure to communicate with the
4423+ parse_opt function, a pointer to which it passes in the INPUT argument to
4424+ argp_parse. Of course, it's also possible to use global variables
4425+ instead, but this is somewhat more flexible.
4426+
4427+ The OPTIONS field contains a pointer to a vector of struct argp_option's;
4428+ that structure has the following fields (if you assign your option
4429+ structures using array initialization like this example, unspecified
4430+ fields will be defaulted to 0, and need not be specified):
4431+ NAME -- The name of this option's long option (may be zero)
4432+ KEY -- The KEY to pass to the PARSER function when parsing this option,
4433+ *and* the name of this option's short option, if it is a
4434+ printable ascii character
4435+ ARG -- The name of this option's argument, if any
4436+ FLAGS -- Flags describing this option; some of them are:
4437+ OPTION_ARG_OPTIONAL -- The argument to this option is optional
4438+ OPTION_ALIAS -- This option is an alias for the
4439+ previous option
4440+ OPTION_HIDDEN -- Don't show this option in --help output
4441+ DOC -- A documentation string for this option, shown in --help output
4442+
4443+ An options vector should be terminated by an option with all fields zero. */
4444+
4445+#include <stdlib.h>
4446+#include <argp.h>
4447+
4448+const char *argp_program_version =
4449+ "argp-ex3 1.0";
4450+const char *argp_program_bug_address =
4451+ "<bug-gnu-utils@@gnu.org>";
4452+
4453+/* Program documentation. */
4454+static char doc[] =
4455+ "Argp example #3 -- a program with options and arguments using argp";
4456+
4457+/* A description of the arguments we accept. */
4458+static char args_doc[] = "ARG1 ARG2";
4459+
4460+/* The options we understand. */
4461+static struct argp_option options[] = {
4462+ {"verbose", 'v', 0, 0, "Produce verbose output" },
4463+ {"quiet", 'q', 0, 0, "Don't produce any output" },
4464+ {"silent", 's', 0, OPTION_ALIAS },
4465+ {"output", 'o', "FILE", 0,
4466+ "Output to FILE instead of standard output" },
4467+ { 0 }
4468+};
4469+
4470+/* Used by @code{main} to communicate with @code{parse_opt}. */
4471+struct arguments
4472+{
4473+ char *args[2]; /* @var{arg1} & @var{arg2} */
4474+ int silent, verbose;
4475+ char *output_file;
4476+};
4477+
4478+/* Parse a single option. */
4479+static error_t
4480+parse_opt (int key, char *arg, struct argp_state *state)
4481+{
4482+ /* Get the @var{input} argument from @code{argp_parse}, which we
4483+ know is a pointer to our arguments structure. */
4484+ struct arguments *arguments = state->input;
4485+
4486+ switch (key)
4487+ {
4488+ case 'q': case 's':
4489+ arguments->silent = 1;
4490+ break;
4491+ case 'v':
4492+ arguments->verbose = 1;
4493+ break;
4494+ case 'o':
4495+ arguments->output_file = arg;
4496+ break;
4497+
4498+ case ARGP_KEY_ARG:
4499+ if (state->arg_num >= 2)
4500+ /* Too many arguments. */
4501+ argp_usage (state);
4502+
4503+ arguments->args[state->arg_num] = arg;
4504+
4505+ break;
4506+
4507+ case ARGP_KEY_END:
4508+ if (state->arg_num < 2)
4509+ /* Not enough arguments. */
4510+ argp_usage (state);
4511+ break;
4512+
4513+ default:
4514+ return ARGP_ERR_UNKNOWN;
4515+ }
4516+ return 0;
4517+}
4518+
4519+/* Our argp parser. */
4520+static struct argp argp = { options, parse_opt, args_doc, doc };
4521+
4522+int main (int argc, char **argv)
4523+{
4524+ struct arguments arguments;
4525+
4526+ /* Default values. */
4527+ arguments.silent = 0;
4528+ arguments.verbose = 0;
4529+ arguments.output_file = "-";
4530+
4531+ /* Parse our arguments; every option seen by @code{parse_opt} will
4532+ be reflected in @code{arguments}. */
4533+ argp_parse (&argp, argc, argv, 0, 0, &arguments);
4534+
4535+ printf ("ARG1 = %s\nARG2 = %s\nOUTPUT_FILE = %s\n"
4536+ "VERBOSE = %s\nSILENT = %s\n",
4537+ arguments.args[0], arguments.args[1],
4538+ arguments.output_file,
4539+ arguments.verbose ? "yes" : "no",
4540+ arguments.silent ? "yes" : "no");
4541+
4542+ exit (0);
4543+}
4544Index: git/test/argp/argp-ex4.c
4545===================================================================
4546--- /dev/null
4547+++ git/test/argp/argp-ex4.c
4548@@ -0,0 +1,167 @@
4549+/* Argp example #4 -- a program with somewhat more complicated options */
4550+
4551+/* This program uses the same features as example 3, but has more
4552+ options, and somewhat more structure in the -help output. It
4553+ also shows how you can `steal' the remainder of the input
4554+ arguments past a certain point, for programs that accept a
4555+ list of items. It also shows the special argp KEY value
4556+ ARGP_KEY_NO_ARGS, which is only given if no non-option
4557+ arguments were supplied to the program.
4558+
4559+ For structuring the help output, two features are used,
4560+ *headers* which are entries in the options vector with the
4561+ first four fields being zero, and a two part documentation
4562+ string (in the variable DOC), which allows documentation both
4563+ before and after the options; the two parts of DOC are
4564+ separated by a vertical-tab character ('\v', or '\013'). By
4565+ convention, the documentation before the options is just a
4566+ short string saying what the program does, and that afterwards
4567+ is longer, describing the behavior in more detail. All
4568+ documentation strings are automatically filled for output,
4569+ although newlines may be included to force a line break at a
4570+ particular point. All documentation strings are also passed to
4571+ the `gettext' function, for possible translation into the
4572+ current locale. */
4573+
4574+#include <stdlib.h>
4575+#include <error.h>
4576+#include <argp.h>
4577+
4578+const char *argp_program_version =
4579+ "argp-ex4 1.0";
4580+const char *argp_program_bug_address =
4581+ "<bug-gnu-utils@@prep.ai.mit.edu>";
4582+
4583+/* Program documentation. */
4584+static char doc[] =
4585+ "Argp example #4 -- a program with somewhat more complicated\
4586+options\
4587+\vThis part of the documentation comes *after* the options;\
4588+ note that the text is automatically filled, but it's possible\
4589+ to force a line-break, e.g.\n<-- here.";
4590+
4591+/* A description of the arguments we accept. */
4592+static char args_doc[] = "ARG1 [STRING...]";
4593+
4594+/* Keys for options without short-options. */
4595+#define OPT_ABORT 1 /* --abort */
4596+
4597+/* The options we understand. */
4598+static struct argp_option options[] = {
4599+ {"verbose", 'v', 0, 0, "Produce verbose output" },
4600+ {"quiet", 'q', 0, 0, "Don't produce any output" },
4601+ {"silent", 's', 0, OPTION_ALIAS },
4602+ {"output", 'o', "FILE", 0,
4603+ "Output to FILE instead of standard output" },
4604+
4605+ {0,0,0,0, "The following options should be grouped together:" },
4606+ {"repeat", 'r', "COUNT", OPTION_ARG_OPTIONAL,
4607+ "Repeat the output COUNT (default 10) times"},
4608+ {"abort", OPT_ABORT, 0, 0, "Abort before showing any output"},
4609+
4610+ { 0 }
4611+};
4612+
4613+/* Used by @code{main} to communicate with @code{parse_opt}. */
4614+struct arguments
4615+{
4616+ char *arg1; /* @var{arg1} */
4617+ char **strings; /* [@var{string}@dots{}] */
4618+ int silent, verbose, abort; /* @samp{-s}, @samp{-v}, @samp{--abort} */
4619+ char *output_file; /* @var{file} arg to @samp{--output} */
4620+ int repeat_count; /* @var{count} arg to @samp{--repeat} */
4621+};
4622+
4623+/* Parse a single option. */
4624+static error_t
4625+parse_opt (int key, char *arg, struct argp_state *state)
4626+{
4627+ /* Get the @code{input} argument from @code{argp_parse}, which we
4628+ know is a pointer to our arguments structure. */
4629+ struct arguments *arguments = state->input;
4630+
4631+ switch (key)
4632+ {
4633+ case 'q': case 's':
4634+ arguments->silent = 1;
4635+ break;
4636+ case 'v':
4637+ arguments->verbose = 1;
4638+ break;
4639+ case 'o':
4640+ arguments->output_file = arg;
4641+ break;
4642+ case 'r':
4643+ arguments->repeat_count = arg ? atoi (arg) : 10;
4644+ break;
4645+ case OPT_ABORT:
4646+ arguments->abort = 1;
4647+ break;
4648+
4649+ case ARGP_KEY_NO_ARGS:
4650+ argp_usage (state);
4651+
4652+ case ARGP_KEY_ARG:
4653+ /* Here we know that @code{state->arg_num == 0}, since we
4654+ force argument parsing to end before any more arguments can
4655+ get here. */
4656+ arguments->arg1 = arg;
4657+
4658+ /* Now we consume all the rest of the arguments.
4659+ @code{state->next} is the index in @code{state->argv} of the
4660+ next argument to be parsed, which is the first @var{string}
4661+ we're interested in, so we can just use
4662+ @code{&state->argv[state->next]} as the value for
4663+ arguments->strings.
4664+
4665+ @emph{In addition}, by setting @code{state->next} to the end
4666+ of the arguments, we can force argp to stop parsing here and
4667+ return. */
4668+ arguments->strings = &state->argv[state->next];
4669+ state->next = state->argc;
4670+
4671+ break;
4672+
4673+ default:
4674+ return ARGP_ERR_UNKNOWN;
4675+ }
4676+ return 0;
4677+}
4678+
4679+/* Our argp parser. */
4680+static struct argp argp = { options, parse_opt, args_doc, doc };
4681+
4682+int main (int argc, char **argv)
4683+{
4684+ int i, j;
4685+ struct arguments arguments;
4686+
4687+ /* Default values. */
4688+ arguments.silent = 0;
4689+ arguments.verbose = 0;
4690+ arguments.output_file = "-";
4691+ arguments.repeat_count = 1;
4692+ arguments.abort = 0;
4693+
4694+ /* Parse our arguments; every option seen by @code{parse_opt} will be
4695+ reflected in @code{arguments}. */
4696+ argp_parse (&argp, argc, argv, 0, 0, &arguments);
4697+
4698+ if (arguments.abort)
4699+ error (10, 0, "ABORTED");
4700+
4701+ for (i = 0; i < arguments.repeat_count; i++)
4702+ {
4703+ printf ("ARG1 = %s\n", arguments.arg1);
4704+ printf ("STRINGS = ");
4705+ for (j = 0; arguments.strings[j]; j++)
4706+ printf (j == 0 ? "%s" : ", %s", arguments.strings[j]);
4707+ printf ("\n");
4708+ printf ("OUTPUT_FILE = %s\nVERBOSE = %s\nSILENT = %s\n",
4709+ arguments.output_file,
4710+ arguments.verbose ? "yes" : "no",
4711+ arguments.silent ? "yes" : "no");
4712+ }
4713+
4714+ exit (0);
4715+}
4716Index: git/test/argp/argp-test.c
4717===================================================================
4718--- /dev/null
4719+++ git/test/argp/argp-test.c
4720@@ -0,0 +1,209 @@
4721+/* Test program for argp argument parser
4722+ Copyright (C) 1997 Free Software Foundation, Inc.
4723+ This file is part of the GNU C Library.
4724+ Written by Miles Bader <miles at gnu.ai.mit.edu>.
4725+
4726+ The GNU C Library is free software; you can redistribute it and/or
4727+ modify it under the terms of the GNU Lesser General Public
4728+ License as published by the Free Software Foundation; either
4729+ version 2.1 of the License, or (at your option) any later version.
4730+
4731+ The GNU C Library is distributed in the hope that it will be useful,
4732+ but WITHOUT ANY WARRANTY; without even the implied warranty of
4733+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4734+ Lesser General Public License for more details.
4735+
4736+ You should have received a copy of the GNU Lesser General Public
4737+ License along with the GNU C Library; if not, write to the Free
4738+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4739+ 02111-1307 USA. */
4740+
4741+#ifdef HAVE_CONFIG_H
4742+#include <config.h>
4743+#endif
4744+
4745+#include <stdlib.h>
4746+#include <time.h>
4747+#include <string.h>
4748+#include <argp.h>
4749+
4750+const char *argp_program_version = "argp-test 1.0";
4751+
4752+struct argp_option sub_options[] =
4753+{
4754+ {"subopt1", 's', 0, 0, "Nested option 1"},
4755+ {"subopt2", 'S', 0, 0, "Nested option 2"},
4756+
4757+ { 0, 0, 0, 0, "Some more nested options:", 10},
4758+ {"subopt3", 'p', 0, 0, "Nested option 3"},
4759+
4760+ {"subopt4", 'q', 0, 0, "Nested option 4", 1},
4761+
4762+ {0}
4763+};
4764+
4765+static const char sub_args_doc[] = "STRING...\n-";
4766+static const char sub_doc[] = "\vThis is the doc string from the sub-arg-parser.";
4767+
4768+static error_t
4769+sub_parse_opt (int key, char *arg, struct argp_state *state)
4770+{
4771+ switch (key)
4772+ {
4773+ case ARGP_KEY_NO_ARGS:
4774+ printf ("NO SUB ARGS\n");
4775+ break;
4776+ case ARGP_KEY_ARG:
4777+ printf ("SUB ARG: %s\n", arg);
4778+ break;
4779+
4780+ case 's' : case 'S': case 'p': case 'q':
4781+ printf ("SUB KEY %c\n", key);
4782+ break;
4783+
4784+ default:
4785+ return ARGP_ERR_UNKNOWN;
4786+ }
4787+ return 0;
4788+}
4789+
4790+static char *
4791+sub_help_filter (int key, const char *text, void *input)
4792+{
4793+ if (key == ARGP_KEY_HELP_EXTRA)
4794+ return strdup ("This is some extra text from the sub parser (note that it \
4795+is preceded by a blank line).");
4796+ else
4797+ return (char *)text;
4798+}
4799+
4800+static struct argp sub_argp = {
4801+ sub_options, sub_parse_opt, sub_args_doc, sub_doc, 0, sub_help_filter
4802+};
4803+
4804+/* Structure used to communicate with the parsing functions. */
4805+struct params
4806+{
4807+ unsigned foonly; /* Value parsed for foonly. */
4808+ unsigned foonly_default; /* Default value for it. */
4809+};
4810+
4811+#define OPT_PGRP 1
4812+#define OPT_SESS 2
4813+
4814+struct argp_option options[] =
4815+{
4816+ {"pid", 'p', "PID", 0, "List the process PID"},
4817+ {"pgrp", OPT_PGRP,"PGRP",0, "List processes in the process group PGRP"},
4818+ {"no-parent", 'P', 0, 0, "Include processes without parents"},
4819+ {0, 'x', 0, OPTION_ALIAS},
4820+ {"all-fields",'Q', 0, 0, "Don't elide unusable fields (normally"
4821+ " if there's some reason ps can't"
4822+ " print a field for any process, it's"
4823+ " removed from the output entirely)" },
4824+ {"reverse", 'r', 0, 0, "Reverse the order of any sort"},
4825+ {"gratuitously-long-reverse-option", 0, 0, OPTION_ALIAS},
4826+ {"session", OPT_SESS,"SID", OPTION_ARG_OPTIONAL,
4827+ "Add the processes from the session"
4828+ " SID (which defaults to the sid of"
4829+ " the current process)" },
4830+
4831+ {0,0,0,0, "Here are some more options:"},
4832+ {"foonly", 'f', "ZOT", OPTION_ARG_OPTIONAL, "Glork a foonly"},
4833+ {"zaza", 'z', 0, 0, "Snit a zar"},
4834+
4835+ {0}
4836+};
4837+
4838+static const char args_doc[] = "STRING";
4839+static const char doc[] = "Test program for argp."
4840+ "\vThis doc string comes after the options."
4841+ "\nHey! Some manual formatting!"
4842+ "\nThe current time is: %s";
4843+
4844+static void
4845+popt (int key, char *arg)
4846+{
4847+ char buf[10];
4848+ if (isprint (key))
4849+ sprintf (buf, "%c", key);
4850+ else
4851+ sprintf (buf, "%d", key);
4852+ if (arg)
4853+ printf ("KEY %s: %s\n", buf, arg);
4854+ else
4855+ printf ("KEY %s\n", buf);
4856+}
4857+
4858+static error_t
4859+parse_opt (int key, char *arg, struct argp_state *state)
4860+{
4861+ struct params *params = state->input;
4862+
4863+ switch (key)
4864+ {
4865+ case ARGP_KEY_NO_ARGS:
4866+ printf ("NO ARGS\n");
4867+ break;
4868+
4869+ case ARGP_KEY_ARG:
4870+ if (state->arg_num > 0)
4871+ return ARGP_ERR_UNKNOWN; /* Leave it for the sub-arg parser. */
4872+ printf ("ARG: %s\n", arg);
4873+ break;
4874+
4875+ case 'f':
4876+ if (arg)
4877+ params->foonly = atoi (arg);
4878+ else
4879+ params->foonly = params->foonly_default;
4880+ popt (key, arg);
4881+ break;
4882+
4883+ case 'p': case 'P': case OPT_PGRP: case 'x': case 'Q':
4884+ case 'r': case OPT_SESS: case 'z':
4885+ popt (key, arg);
4886+ break;
4887+
4888+ default:
4889+ return ARGP_ERR_UNKNOWN;
4890+ }
4891+ return 0;
4892+}
4893+
4894+static char *
4895+help_filter (int key, const char *text, void *input)
4896+{
4897+ char *new_text;
4898+ struct params *params = input;
4899+
4900+ if (key == ARGP_KEY_HELP_POST_DOC && text)
4901+ {
4902+ time_t now = time (0);
4903+ asprintf (&new_text, text, ctime (&now));
4904+ }
4905+ else if (key == 'f')
4906+ /* Show the default for the --foonly option. */
4907+ asprintf (&new_text, "%s (ZOT defaults to %x)",
4908+ text, params->foonly_default);
4909+ else
4910+ new_text = (char *)text;
4911+
4912+ return new_text;
4913+}
4914+
4915+static struct argp_child argp_children[] = { { &sub_argp }, { 0 } };
4916+static struct argp argp = {
4917+ options, parse_opt, args_doc, doc, argp_children, help_filter
4918+};
4919+
4920+int
4921+main (int argc, char **argv)
4922+{
4923+ struct params params;
4924+ params.foonly = 0;
4925+ params.foonly_default = random ();
4926+ argp_parse (&argp, argc, argv, 0, 0, &params);
4927+ printf ("After parsing: foonly = %x\n", params.foonly);
4928+ return 0;
4929+}
4930Index: git/test/argp/bug-argp1.c
4931===================================================================
4932--- /dev/null
4933+++ git/test/argp/bug-argp1.c
4934@@ -0,0 +1,26 @@
4935+#include <argp.h>
4936+
4937+
4938+static const struct argp_option test_options[] =
4939+{
4940+ { NULL, 'a', NULL, OPTION_DOC, NULL },
4941+ { NULL, 'b', NULL, OPTION_DOC, NULL },
4942+ { NULL, 0, NULL, 0, NULL }
4943+};
4944+
4945+static struct argp test_argp =
4946+{
4947+ test_options
4948+};
4949+
4950+
4951+static int
4952+do_test (int argc, char *argv[])
4953+{
4954+ int i;
4955+ argp_parse (&test_argp, argc, argv, 0, &i, NULL);
4956+ return 0;
4957+}
4958+
4959+#define TEST_FUNCTION do_test (argc, argv)
4960+#include "../test-skeleton.c"
4961Index: git/test/argp/tst-argp1.c
4962===================================================================
4963--- /dev/null
4964+++ git/test/argp/tst-argp1.c
4965@@ -0,0 +1,118 @@
4966+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
4967+ This file is part of the GNU C Library.
4968+ Contributed by Ulrich Drepper <drepper at redhat.com>, 2002.
4969+
4970+ The GNU C Library is free software; you can redistribute it and/or
4971+ modify it under the terms of the GNU Lesser General Public
4972+ License as published by the Free Software Foundation; either
4973+ version 2.1 of the License, or (at your option) any later version.
4974+
4975+ The GNU C Library is distributed in the hope that it will be useful,
4976+ but WITHOUT ANY WARRANTY; without even the implied warranty of
4977+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4978+ Lesser General Public License for more details.
4979+
4980+ You should have received a copy of the GNU Lesser General Public
4981+ License along with the GNU C Library; if not, write to the Free
4982+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
4983+ 02111-1307 USA. */
4984+
4985+#include <argp.h>
4986+
4987+
4988+
4989+
4990+#define OPT_TO_THREAD 300
4991+#define OPT_TO_PROCESS 301
4992+#define OPT_SYNC_SIGNAL 302
4993+#define OPT_SYNC_JOIN 303
4994+#define OPT_TOPLEVEL 304
4995+
4996+
4997+static const struct argp_option test_options[] =
4998+ {
4999+ { NULL, 0, NULL, 0, "\
5000+This is a test for threads so we allow ther user to selection the number of \
5001+threads which are used at any one time. Independently the total number of \
5002+rounds can be selected. This is the total number of threads which will have \
5003+run when the process terminates:" },
5004+ { "threads", 't', "NUMBER", 0, "Number of threads used at once" },
5005+ { "starts", 's', "NUMBER", 0, "Total number of working threads" },
5006+ { "toplevel", OPT_TOPLEVEL, "NUMBER", 0,
5007+ "Number of toplevel threads which start the other threads; this \
5008+implies --sync-join" },
5009+
5010+ { NULL, 0, NULL, 0, "\
5011+Each thread can do one of two things: sleep or do work. The latter is 100% \
5012+CPU bound. The work load is the probability a thread does work. All values \
5013+from zero to 100 (inclusive) are valid. How often each thread repeats this \
5014+can be determined by the number of rounds. The work cost determines how long \
5015+each work session (not sleeping) takes. If it is zero a thread would \
5016+effectively nothing. By setting the number of rounds to zero the thread \
5017+does no work at all and pure thread creation times can be measured." },
5018+ { "workload", 'w', "PERCENT", 0, "Percentage of time spent working" },
5019+ { "workcost", 'c', "NUMBER", 0,
5020+ "Factor in the cost of each round of working" },
5021+ { "rounds", 'r', "NUMBER", 0, "Number of rounds each thread runs" },
5022+
5023+ { NULL, 0, NULL, 0, "\
5024+There are a number of different methods how thread creation can be \
5025+synchronized. Synchronization is necessary since the number of concurrently \
5026+running threads is limited." },
5027+ { "sync-signal", OPT_SYNC_SIGNAL, NULL, 0,
5028+ "Synchronize using a signal (default)" },
5029+ { "sync-join", OPT_SYNC_JOIN, NULL, 0, "Synchronize using pthread_join" },
5030+
5031+ { NULL, 0, NULL, 0, "\
5032+One parameter for each threads execution is the size of the stack. If this \
5033+parameter is not used the system's default stack size is used. If many \
5034+threads are used the stack size should be chosen quite small." },
5035+ { "stacksize", 'S', "BYTES", 0, "Size of threads stack" },
5036+ { "guardsize", 'g', "BYTES", 0,
5037+ "Size of stack guard area; must fit into the stack" },
5038+
5039+ { NULL, 0, NULL, 0, "Signal options:" },
5040+ { "to-thread", OPT_TO_THREAD, NULL, 0, "Send signal to main thread" },
5041+ { "to-process", OPT_TO_PROCESS, NULL, 0,
5042+ "Send signal to process (default)" },
5043+
5044+ { NULL, 0, NULL, 0, "Administrative options:" },
5045+ { "progress", 'p', NULL, 0, "Show signs of progress" },
5046+ { "timing", 'T', NULL, 0,
5047+ "Measure time from startup to the last thread finishing" },
5048+ { NULL, 0, NULL, 0, NULL }
5049+ };
5050+
5051+/* Prototype for option handler. */
5052+static error_t parse_opt (int key, char *arg, struct argp_state *state);
5053+
5054+/* Data structure to communicate with argp functions. */
5055+static struct argp argp =
5056+{
5057+ test_options, parse_opt
5058+};
5059+
5060+
5061+static int
5062+do_test (void)
5063+{
5064+ int argc = 2;
5065+ char *argv[3] = { (char *) "tst-argp1", (char *) "--help", NULL };
5066+ int remaining;
5067+
5068+ /* Parse and process arguments. */
5069+ argp_parse (&argp, argc, argv, 0, &remaining, NULL);
5070+
5071+ return 0;
5072+}
5073+
5074+
5075+/* Handle program arguments. */
5076+static error_t
5077+parse_opt (int key, char *arg, struct argp_state *state)
5078+{
5079+ return ARGP_ERR_UNKNOWN;
5080+}
5081+
5082+#define TEST_FUNCTION do_test ()
5083+#include "../test-skeleton.c"
5084Index: git/test/argp/tst-argp2.c
5085===================================================================
5086--- /dev/null
5087+++ git/test/argp/tst-argp2.c
5088@@ -0,0 +1,101 @@
5089+/* Copyright (C) 2007 Free Software Foundation, Inc.
5090+ This file is part of the GNU C Library.
5091+ Contributed by Jakub Jelinek <jakub at redhat.com>, 2007.
5092+
5093+ The GNU C Library is free software; you can redistribute it and/or
5094+ modify it under the terms of the GNU Lesser General Public
5095+ License as published by the Free Software Foundation; either
5096+ version 2.1 of the License, or (at your option) any later version.
5097+
5098+ The GNU C Library is distributed in the hope that it will be useful,
5099+ but WITHOUT ANY WARRANTY; without even the implied warranty of
5100+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5101+ Lesser General Public License for more details.
5102+
5103+ You should have received a copy of the GNU Lesser General Public
5104+ License along with the GNU C Library; if not, write to the Free
5105+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
5106+ 02111-1307 USA. */
5107+
5108+#include <argp.h>
5109+
5110+static const struct argp_option opt1[] =
5111+ {
5112+ { "opt1", '1', "NUMBER", 0, "Option 1" },
5113+ { NULL, 0, NULL, 0, NULL }
5114+ };
5115+
5116+static const struct argp_option opt2[] =
5117+ {
5118+ { "opt2", '2', "NUMBER", 0, "Option 2" },
5119+ { NULL, 0, NULL, 0, NULL }
5120+ };
5121+
5122+static const struct argp_option opt3[] =
5123+ {
5124+ { "opt3", '3', "NUMBER", 0, "Option 3" },
5125+ { NULL, 0, NULL, 0, NULL }
5126+ };
5127+
5128+static const struct argp_option opt4[] =
5129+ {
5130+ { "opt4", '4', "NUMBER", 0, "Option 4" },
5131+ { NULL, 0, NULL, 0, NULL }
5132+ };
5133+
5134+static const struct argp_option opt5[] =
5135+ {
5136+ { "opt5", '5', "NUMBER", 0, "Option 5" },
5137+ { NULL, 0, NULL, 0, NULL }
5138+ };
5139+
5140+static struct argp argp5 =
5141+ {
5142+ opt5, NULL, "args doc5", "doc5", NULL, NULL, NULL
5143+ };
5144+
5145+static struct argp argp4 =
5146+ {
5147+ opt4, NULL, "args doc4", "doc4", NULL, NULL, NULL
5148+ };
5149+
5150+static struct argp argp3 =
5151+ {
5152+ opt3, NULL, "args doc3", "doc3", NULL, NULL, NULL
5153+ };
5154+
5155+static struct argp_child children2[] =
5156+ {
5157+ { &argp4, 0, "child3", 3 },
5158+ { &argp5, 0, "child4", 4 },
5159+ { NULL, 0, NULL, 0 }
5160+ };
5161+
5162+static struct argp argp2 =
5163+ {
5164+ opt2, NULL, "args doc2", "doc2", children2, NULL, NULL
5165+ };
5166+
5167+static struct argp_child children1[] =
5168+ {
5169+ { &argp2, 0, "child1", 1 },
5170+ { &argp3, 0, "child2", 2 },
5171+ { NULL, 0, NULL, 0 }
5172+ };
5173+
5174+static struct argp argp1 =
5175+ {
5176+ opt1, NULL, "args doc1", "doc1", children1, NULL, NULL
5177+ };
5178+
5179+
5180+static int
5181+do_test (void)
5182+{
5183+ argp_help (&argp1, stdout, ARGP_HELP_LONG, (char *) "tst-argp2");
5184+ return 0;
5185+}
5186+
5187+
5188+#define TEST_FUNCTION do_test ()
5189+#include "../test-skeleton.c"
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/arm/uClibc.machine b/meta-oe/recipes-core/uclibc/uclibc-git/arm/uClibc.machine
deleted file mode 100644
index 293f38436..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/arm/uClibc.machine
+++ /dev/null
@@ -1,69 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Mon May 14 10:23:14 2007
4#
5# TARGET_alpha is not set
6TARGET_arm=y
7# TARGET_bfin is not set
8# TARGET_cris is not set
9# TARGET_e1 is not set
10# TARGET_frv is not set
11# TARGET_h8300 is not set
12# TARGET_hppa is not set
13# TARGET_i386 is not set
14# TARGET_i960 is not set
15# TARGET_ia64 is not set
16# TARGET_m68k is not set
17# TARGET_microblaze is not set
18# TARGET_mips is not set
19# TARGET_nios is not set
20# TARGET_nios2 is not set
21# TARGET_powerpc is not set
22# TARGET_sh is not set
23# TARGET_sh64 is not set
24# TARGET_sparc is not set
25# TARGET_v850 is not set
26# TARGET_vax is not set
27# TARGET_x86_64 is not set
28
29#
30# Target Architecture Features and Options
31#
32TARGET_ARCH="arm"
33FORCE_OPTIONS_FOR_ARCH=y
34# CONFIG_ARM_OABI is not set
35CONFIG_ARM_EABI=y
36USE_BX=y
37CONFIG_GENERIC_ARM=y
38# CONFIG_ARM610 is not set
39# CONFIG_ARM710 is not set
40# CONFIG_ARM7TDMI is not set
41# CONFIG_ARM720T is not set
42# CONFIG_ARM920T is not set
43# CONFIG_ARM922T is not set
44# CONFIG_ARM926T is not set
45# CONFIG_ARM10T is not set
46# CONFIG_ARM1136JF_S is not set
47# CONFIG_ARM1176JZ_S is not set
48# CONFIG_ARM1176JZF_S is not set
49# CONFIG_ARM_SA110 is not set
50# CONFIG_ARM_SA1100 is not set
51# CONFIG_ARM_XSCALE is not set
52# CONFIG_ARM_IWMMXT is not set
53TARGET_SUBARCH=""
54
55#
56# Using ELF file format
57#
58ARCH_ANY_ENDIAN=y
59ARCH_LITTLE_ENDIAN=y
60# ARCH_WANTS_BIG_ENDIAN is not set
61ARCH_WANTS_LITTLE_ENDIAN=y
62ARCH_HAS_MMU=y
63ARCH_USE_MMU=y
64UCLIBC_HAS_FLOATS=y
65# UCLIBC_HAS_FPU is not set
66UCLIBC_HAS_SOFT_FLOAT=y
67KERNEL_HEADERS="/usr/include"
68HAVE_DOT_CONFIG=y
69
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/armeb/uClibc.machine b/meta-oe/recipes-core/uclibc/uclibc-git/armeb/uClibc.machine
deleted file mode 100644
index 7a6ad8b5d..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/armeb/uClibc.machine
+++ /dev/null
@@ -1,53 +0,0 @@
1#
2# Automatically generated make config: don't edit
3#
4# TARGET_alpha is not set
5TARGET_arm=y
6# TARGET_bfin is not set
7# TARGET_cris is not set
8# TARGET_e1 is not set
9# TARGET_frv is not set
10# TARGET_h8300 is not set
11# TARGET_hppa is not set
12# TARGET_i386 is not set
13# TARGET_i960 is not set
14# TARGET_m68k is not set
15# TARGET_microblaze is not set
16# TARGET_mips is not set
17# TARGET_nios is not set
18# TARGET_nios2 is not set
19# TARGET_powerpc is not set
20# TARGET_sh is not set
21# TARGET_sh64 is not set
22# TARGET_sparc is not set
23# TARGET_v850 is not set
24# TARGET_x86_64 is not set
25
26#
27# Target Architecture Features and Options
28#
29TARGET_ARCH="arm"
30ARCH_SUPPORTS_BIG_ENDIAN=y
31ARCH_SUPPORTS_LITTLE_ENDIAN=y
32FORCE_OPTIONS_FOR_ARCH=y
33CONFIG_GENERIC_ARM=y
34# CONFIG_ARM610 is not set
35# CONFIG_ARM710 is not set
36# CONFIG_ARM720T is not set
37# CONFIG_ARM920T is not set
38# CONFIG_ARM922T is not set
39# CONFIG_ARM926T is not set
40# CONFIG_ARM1136JF_S is not set
41# CONFIG_ARM_SA110 is not set
42# CONFIG_ARM_SA1100 is not set
43# CONFIG_ARM_XSCALE is not set
44# ARCH_LITTLE_ENDIAN is not set
45ARCH_BIG_ENDIAN=y
46# ARCH_HAS_NO_MMU is not set
47ARCH_HAS_MMU=y
48UCLIBC_HAS_FLOATS=y
49UCLIBC_HAS_FPU=y
50DO_C99_MATH=y
51# UCLIBC_HAS_FENV is not set
52KERNEL_HEADERS="<path/to/kernel/headers>"
53HAVE_DOT_CONFIG=y
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/armv5te/uClibc.machine b/meta-oe/recipes-core/uclibc/uclibc-git/armv5te/uClibc.machine
deleted file mode 100644
index eb76f34c4..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/armv5te/uClibc.machine
+++ /dev/null
@@ -1,76 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Version: 0.9.32-git
4# Mon Jul 19 01:34:29 2010
5#
6# TARGET_alpha is not set
7TARGET_arm=y
8# TARGET_avr32 is not set
9# TARGET_bfin is not set
10# TARGET_cris is not set
11# TARGET_e1 is not set
12# TARGET_frv is not set
13# TARGET_h8300 is not set
14# TARGET_hppa is not set
15# TARGET_i386 is not set
16# TARGET_i960 is not set
17# TARGET_ia64 is not set
18# TARGET_m68k is not set
19# TARGET_microblaze is not set
20# TARGET_mips is not set
21# TARGET_nios is not set
22# TARGET_nios2 is not set
23# TARGET_powerpc is not set
24# TARGET_sh is not set
25# TARGET_sh64 is not set
26# TARGET_sparc is not set
27# TARGET_v850 is not set
28# TARGET_vax is not set
29# TARGET_x86_64 is not set
30# TARGET_xtensa is not set
31
32#
33# Target Architecture Features and Options
34#
35TARGET_ARCH="arm"
36FORCE_OPTIONS_FOR_ARCH=y
37# CONFIG_ARM_OABI is not set
38CONFIG_ARM_EABI=y
39USE_BX=y
40CONFIG_GENERIC_ARM=y
41# CONFIG_ARM610 is not set
42# CONFIG_ARM710 is not set
43# CONFIG_ARM7TDMI is not set
44# CONFIG_ARM720T is not set
45# CONFIG_ARM920T is not set
46# CONFIG_ARM922T is not set
47# CONFIG_ARM926T is not set
48# CONFIG_ARM10T is not set
49# CONFIG_ARM1136JF_S is not set
50# CONFIG_ARM1176JZ_S is not set
51# CONFIG_ARM1176JZF_S is not set
52# CONFIG_ARM_CORTEX_M3 is not set
53# CONFIG_ARM_CORTEX_M1 is not set
54# CONFIG_ARM_SA110 is not set
55# CONFIG_ARM_SA1100 is not set
56# CONFIG_ARM_XSCALE is not set
57# CONFIG_ARM_IWMMXT is not set
58TARGET_SUBARCH=""
59
60#
61# Using ELF file format
62#
63ARCH_ANY_ENDIAN=y
64ARCH_LITTLE_ENDIAN=y
65# ARCH_WANTS_BIG_ENDIAN is not set
66ARCH_WANTS_LITTLE_ENDIAN=y
67ARCH_HAS_MMU=y
68ARCH_USE_MMU=y
69UCLIBC_HAS_FLOATS=y
70# UCLIBC_HAS_FPU is not set
71UCLIBC_HAS_SOFT_FLOAT=y
72DO_C99_MATH=y
73# DO_XSI_MATH is not set
74# UCLIBC_HAS_FENV is not set
75KERNEL_HEADERS="/usr/include"
76HAVE_DOT_CONFIG=y
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/detect-bx-availibility.patch b/meta-oe/recipes-core/uclibc/uclibc-git/detect-bx-availibility.patch
deleted file mode 100644
index 43d19fcf1..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/detect-bx-availibility.patch
+++ /dev/null
@@ -1,75 +0,0 @@
1Delivered-To: raj.khem@gmail.com
2Received: by 10.90.86.4 with SMTP id j4cs313307agb;
3 Sat, 8 Jan 2011 16:45:20 -0800 (PST)
4Received: by 10.227.141.78 with SMTP id l14mr16920947wbu.128.1294533919168;
5 Sat, 08 Jan 2011 16:45:19 -0800 (PST)
6Return-Path: <yann.morin.1998@anciens.enib.fr>
7Received: from smtp.smtpout.orange.fr (smtp01.smtpout.orange.fr [80.12.242.123])
8 by mx.google.com with ESMTP id w30si33755908wbd.17.2011.01.08.16.45.18;
9 Sat, 08 Jan 2011 16:45:19 -0800 (PST)
10Received-SPF: neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) client-ip=80.12.242.123;
11Authentication-Results: mx.google.com; spf=neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) smtp.mail=yann.morin.1998@anciens.enib.fr
12Received: from roazhon.bzh.lan ([90.32.245.227])
13 by mwinf5d24 with ME
14 id tClC1f0024v5z3u03ClHDo; Sun, 09 Jan 2011 01:45:18 +0100
15From: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
16To: uclibc@uclibc.org
17Cc: Khem Raj <raj.khem@gmail.com>,
18 Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>,
19 Carmelo AMOROSO <carmelo.amoroso@st.com>
20Subject: [PATCH 6/7] ARM: detect BX availibility at build time
21Date: Sun, 9 Jan 2011 01:45:09 +0100
22Message-Id: <1294533910-19305-7-git-send-email-yann.morin.1998@anciens.enib.fr>
23X-Mailer: git-send-email 1.7.1
24In-Reply-To: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr>
25References: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr>
26
27The "use BX" option is now a suggestion that BX be used if available.
28Use a macro to detect if BX is available at build time. If so, and
29the user requested it be used, then use it. Otherwise, error out.
30
31Macro courtesy Khem RAJ:
32 http://lists.uclibc.org/pipermail/uclibc/2009-April/042301.html
33
34Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
35Cc: Khem Raj <raj.khem@gmail.com>
36Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
37Cc: Carmelo AMOROSO <carmelo.amoroso@st.com>
38---
39 extra/Configs/Config.arm | 4 +++-
40 libc/sysdeps/linux/arm/bits/arm_asm.h | 9 ++++++++-
41 2 files changed, 11 insertions(+), 2 deletions(-)
42
43diff --git a/extra/Configs/Config.arm b/extra/Configs/Config.arm
44index 227b90c..9aa9e56 100644
45--- a/extra/Configs/Config.arm
46+++ b/extra/Configs/Config.arm
47@@ -33,4 +33,6 @@ config COMPILE_IN_THUMB_MODE
48 config USE_BX
49 bool "Use BX in function return"
50 help
51- Use BX instruction for THUMB aware architectures.
52+ Say 'y' to use BX to return from functions on your thumb-aware
53+ processor. Say 'y' if you need to use interworking. Say 'n' if not.
54+ It is safe to say 'y' even if you're not doing interworking.
55diff --git a/libc/sysdeps/linux/arm/bits/arm_asm.h b/libc/sysdeps/linux/arm/bits/arm_asm.h
56index 1d87df6..921c9a3 100644
57--- a/libc/sysdeps/linux/arm/bits/arm_asm.h
58+++ b/libc/sysdeps/linux/arm/bits/arm_asm.h
59@@ -24,5 +24,12 @@
60 #define THUMB1_ONLY 1
61 #endif
62
63-#endif /* _ARM_ASM_H */
64+#if defined(__USE_BX__)
65+# if ( defined (__ARM_ARCH_2__) || defined (__ARM_ARCH_3__) \
66+ || defined (__ARM_ARCH_3M__) || defined (__ARM_ARCH_4__) \
67+ )
68+# error Use of BX was requested, but is not available on the target processor.
69+# endif /* ARCH level */
70+#endif /* __USE_BX__ */
71
72+#endif /* _ARM_ASM_H */
73--
741.7.1
75
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/efika/uClibc.machine b/meta-oe/recipes-core/uclibc/uclibc-git/efika/uClibc.machine
deleted file mode 100644
index 5ed7b517a..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/efika/uClibc.machine
+++ /dev/null
@@ -1,45 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Wed Dec 20 11:05:48 2006
4#
5# TARGET_alpha is not set
6# TARGET_arm is not set
7# TARGET_bfin is not set
8# TARGET_cris is not set
9# TARGET_e1 is not set
10# TARGET_frv is not set
11# TARGET_h8300 is not set
12# TARGET_hppa is not set
13# TARGET_i386 is not set
14# TARGET_i960 is not set
15# TARGET_ia64 is not set
16# TARGET_m68k is not set
17# TARGET_microblaze is not set
18# TARGET_mips is not set
19# TARGET_nios is not set
20# TARGET_nios2 is not set
21TARGET_powerpc=y
22# TARGET_sh is not set
23# TARGET_sh64 is not set
24# TARGET_sparc is not set
25# TARGET_v850 is not set
26# TARGET_vax is not set
27# TARGET_x86_64 is not set
28
29#
30# Target Architecture Features and Options
31#
32TARGET_ARCH="powerpc"
33FORCE_OPTIONS_FOR_ARCH=y
34ARCH_BIG_ENDIAN=y
35
36#
37# Using Big Endian
38#
39ARCH_HAS_MMU=y
40ARCH_USE_MMU=y
41UCLIBC_HAS_FLOATS=y
42UCLIBC_HAS_FPU=y
43DO_C99_MATH=y
44KERNEL_HEADERS="<path/to/kernel/headers>"
45HAVE_DOT_CONFIG=y
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/i386/uClibc.machine b/meta-oe/recipes-core/uclibc/uclibc-git/i386/uClibc.machine
deleted file mode 100644
index 3909ccc9e..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/i386/uClibc.machine
+++ /dev/null
@@ -1,59 +0,0 @@
1#
2# Automatically generated make config: don't edit
3#
4# TARGET_alpha is not set
5# TARGET_arm is not set
6# TARGET_bfin is not set
7# TARGET_cris is not set
8# TARGET_e1 is not set
9# TARGET_frv is not set
10# TARGET_h8300 is not set
11# TARGET_hppa is not set
12TARGET_i386=y
13# TARGET_i960 is not set
14# TARGET_m68k is not set
15# TARGET_microblaze is not set
16# TARGET_mips is not set
17# TARGET_nios is not set
18# TARGET_nios2 is not set
19# TARGET_powerpc is not set
20# TARGET_sh is not set
21# TARGET_sh64 is not set
22# TARGET_sparc is not set
23# TARGET_v850 is not set
24# TARGET_x86_64 is not set
25
26#
27# Target Architecture Features and Options
28#
29TARGET_ARCH="i386"
30# ARCH_SUPPORTS_BIG_ENDIAN is not set
31ARCH_SUPPORTS_LITTLE_ENDIAN=y
32FORCE_OPTIONS_FOR_ARCH=y
33# CONFIG_GENERIC_386 is not set
34# CONFIG_386 is not set
35# CONFIG_486 is not set
36# CONFIG_586 is not set
37# CONFIG_586MMX is not set
38# CONFIG_686 is not set
39# CONFIG_PENTIUMII is not set
40# CONFIG_PENTIUMIII is not set
41CONFIG_PENTIUM4=y
42# CONFIG_K6 is not set
43# CONFIG_K7 is not set
44# CONFIG_ELAN is not set
45# CONFIG_CRUSOE is not set
46# CONFIG_WINCHIPC6 is not set
47# CONFIG_WINCHIP2 is not set
48# CONFIG_CYRIXIII is not set
49# CONFIG_NEHEMIAH is not set
50ARCH_LITTLE_ENDIAN=y
51# ARCH_BIG_ENDIAN is not set
52# ARCH_HAS_NO_MMU is not set
53ARCH_HAS_MMU=y
54UCLIBC_HAS_FLOATS=y
55UCLIBC_HAS_FPU=y
56DO_C99_MATH=y
57# UCLIBC_HAS_FENV is not set
58KERNEL_HEADERS="<path/to/kernel/headers>"
59HAVE_DOT_CONFIG=y
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/i486/uClibc.machine b/meta-oe/recipes-core/uclibc/uclibc-git/i486/uClibc.machine
deleted file mode 100644
index 776e00d6d..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/i486/uClibc.machine
+++ /dev/null
@@ -1,62 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Fri Dec 22 23:09:11 2006
4#
5# TARGET_alpha is not set
6# TARGET_arm is not set
7# TARGET_bfin is not set
8# TARGET_cris is not set
9# TARGET_e1 is not set
10# TARGET_frv is not set
11# TARGET_h8300 is not set
12# TARGET_hppa is not set
13TARGET_i386=y
14# TARGET_i960 is not set
15# TARGET_ia64 is not set
16# TARGET_m68k is not set
17# TARGET_microblaze is not set
18# TARGET_mips is not set
19# TARGET_nios is not set
20# TARGET_nios2 is not set
21# TARGET_powerpc is not set
22# TARGET_sh is not set
23# TARGET_sh64 is not set
24# TARGET_sparc is not set
25# TARGET_v850 is not set
26# TARGET_vax is not set
27# TARGET_x86_64 is not set
28
29#
30# Target Architecture Features and Options
31#
32TARGET_ARCH="i386"
33FORCE_OPTIONS_FOR_ARCH=y
34# CONFIG_GENERIC_386 is not set
35# CONFIG_386 is not set
36CONFIG_486=y
37# CONFIG_586 is not set
38# CONFIG_586MMX is not set
39# CONFIG_686 is not set
40# CONFIG_PENTIUMII is not set
41# CONFIG_PENTIUMIII is not set
42# CONFIG_PENTIUM4 is not set
43# CONFIG_K6 is not set
44# CONFIG_K7 is not set
45# CONFIG_ELAN is not set
46# CONFIG_CRUSOE is not set
47# CONFIG_WINCHIPC6 is not set
48# CONFIG_WINCHIP2 is not set
49# CONFIG_CYRIXIII is not set
50# CONFIG_NEHEMIAH is not set
51ARCH_LITTLE_ENDIAN=y
52
53#
54# Using Little Endian
55#
56ARCH_HAS_MMU=y
57ARCH_USE_MMU=y
58UCLIBC_HAS_FLOATS=y
59UCLIBC_HAS_FPU=y
60DO_C99_MATH=y
61KERNEL_HEADERS="<path/to/kernel/headers>"
62HAVE_DOT_CONFIG=y
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/i586/uClibc.machine b/meta-oe/recipes-core/uclibc/uclibc-git/i586/uClibc.machine
deleted file mode 100644
index 2e98e5c7e..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/i586/uClibc.machine
+++ /dev/null
@@ -1,62 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Sat Feb 24 08:24:11 2007
4#
5# TARGET_alpha is not set
6# TARGET_arm is not set
7# TARGET_bfin is not set
8# TARGET_cris is not set
9# TARGET_e1 is not set
10# TARGET_frv is not set
11# TARGET_h8300 is not set
12# TARGET_hppa is not set
13TARGET_i386=y
14# TARGET_i960 is not set
15# TARGET_ia64 is not set
16# TARGET_m68k is not set
17# TARGET_microblaze is not set
18# TARGET_mips is not set
19# TARGET_nios is not set
20# TARGET_nios2 is not set
21# TARGET_powerpc is not set
22# TARGET_sh is not set
23# TARGET_sh64 is not set
24# TARGET_sparc is not set
25# TARGET_v850 is not set
26# TARGET_vax is not set
27# TARGET_x86_64 is not set
28
29#
30# Target Architecture Features and Options
31#
32TARGET_ARCH="i386"
33FORCE_OPTIONS_FOR_ARCH=y
34# CONFIG_GENERIC_386 is not set
35# CONFIG_386 is not set
36# CONFIG_486 is not set
37# CONFIG_586 is not set
38# CONFIG_586MMX is not set
39# CONFIG_686 is not set
40# CONFIG_PENTIUMII is not set
41CONFIG_PENTIUMIII=y
42# CONFIG_PENTIUM4 is not set
43# CONFIG_K6 is not set
44# CONFIG_K7 is not set
45# CONFIG_ELAN is not set
46# CONFIG_CRUSOE is not set
47# CONFIG_WINCHIPC6 is not set
48# CONFIG_WINCHIP2 is not set
49# CONFIG_CYRIXIII is not set
50# CONFIG_NEHEMIAH is not set
51ARCH_LITTLE_ENDIAN=y
52
53#
54# Using Little Endian
55#
56ARCH_HAS_MMU=y
57ARCH_USE_MMU=y
58UCLIBC_HAS_FLOATS=y
59UCLIBC_HAS_FPU=y
60DO_C99_MATH=y
61KERNEL_HEADERS="<path/to/kernel/headers>"
62HAVE_DOT_CONFIG=y
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/i686/uClibc.machine b/meta-oe/recipes-core/uclibc/uclibc-git/i686/uClibc.machine
deleted file mode 100644
index 3909ccc9e..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/i686/uClibc.machine
+++ /dev/null
@@ -1,59 +0,0 @@
1#
2# Automatically generated make config: don't edit
3#
4# TARGET_alpha is not set
5# TARGET_arm is not set
6# TARGET_bfin is not set
7# TARGET_cris is not set
8# TARGET_e1 is not set
9# TARGET_frv is not set
10# TARGET_h8300 is not set
11# TARGET_hppa is not set
12TARGET_i386=y
13# TARGET_i960 is not set
14# TARGET_m68k is not set
15# TARGET_microblaze is not set
16# TARGET_mips is not set
17# TARGET_nios is not set
18# TARGET_nios2 is not set
19# TARGET_powerpc is not set
20# TARGET_sh is not set
21# TARGET_sh64 is not set
22# TARGET_sparc is not set
23# TARGET_v850 is not set
24# TARGET_x86_64 is not set
25
26#
27# Target Architecture Features and Options
28#
29TARGET_ARCH="i386"
30# ARCH_SUPPORTS_BIG_ENDIAN is not set
31ARCH_SUPPORTS_LITTLE_ENDIAN=y
32FORCE_OPTIONS_FOR_ARCH=y
33# CONFIG_GENERIC_386 is not set
34# CONFIG_386 is not set
35# CONFIG_486 is not set
36# CONFIG_586 is not set
37# CONFIG_586MMX is not set
38# CONFIG_686 is not set
39# CONFIG_PENTIUMII is not set
40# CONFIG_PENTIUMIII is not set
41CONFIG_PENTIUM4=y
42# CONFIG_K6 is not set
43# CONFIG_K7 is not set
44# CONFIG_ELAN is not set
45# CONFIG_CRUSOE is not set
46# CONFIG_WINCHIPC6 is not set
47# CONFIG_WINCHIP2 is not set
48# CONFIG_CYRIXIII is not set
49# CONFIG_NEHEMIAH is not set
50ARCH_LITTLE_ENDIAN=y
51# ARCH_BIG_ENDIAN is not set
52# ARCH_HAS_NO_MMU is not set
53ARCH_HAS_MMU=y
54UCLIBC_HAS_FLOATS=y
55UCLIBC_HAS_FPU=y
56DO_C99_MATH=y
57# UCLIBC_HAS_FENV is not set
58KERNEL_HEADERS="<path/to/kernel/headers>"
59HAVE_DOT_CONFIG=y
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/include-arm-asm.h.patch b/meta-oe/recipes-core/uclibc/uclibc-git/include-arm-asm.h.patch
deleted file mode 100644
index 55c312e2c..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/include-arm-asm.h.patch
+++ /dev/null
@@ -1,65 +0,0 @@
1Delivered-To: raj.khem@gmail.com
2Received: by 10.90.86.4 with SMTP id j4cs313304agb;
3 Sat, 8 Jan 2011 16:45:19 -0800 (PST)
4Received: by 10.227.155.75 with SMTP id r11mr17188266wbw.3.1294533918432;
5 Sat, 08 Jan 2011 16:45:18 -0800 (PST)
6Return-Path: <yann.morin.1998@anciens.enib.fr>
7Received: from smtp.smtpout.orange.fr (smtp01.smtpout.orange.fr [80.12.242.123])
8 by mx.google.com with ESMTP id k3si33753340wbx.29.2011.01.08.16.45.17;
9 Sat, 08 Jan 2011 16:45:18 -0800 (PST)
10Received-SPF: neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) client-ip=80.12.242.123;
11Authentication-Results: mx.google.com; spf=neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) smtp.mail=yann.morin.1998@anciens.enib.fr
12Received: from roazhon.bzh.lan ([90.32.245.227])
13 by mwinf5d24 with ME
14 id tClC1f0024v5z3u03ClHDf; Sun, 09 Jan 2011 01:45:17 +0100
15From: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
16To: uclibc@uclibc.org
17Cc: Khem Raj <raj.khem@gmail.com>,
18 Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>,
19 Carmelo AMOROSO <carmelo.amoroso@st.com>
20Subject: [PATCH 5/7] ARM: #include <bits/arm_asm.h> where __USE_BX__ is used
21Date: Sun, 9 Jan 2011 01:45:08 +0100
22Message-Id: <1294533910-19305-6-git-send-email-yann.morin.1998@anciens.enib.fr>
23X-Mailer: git-send-email 1.7.1
24In-Reply-To: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr>
25References: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr>
26
27The check for __USE_BX__ will be available in bits/arm_asm.h,
28so the latter must be included wherever the former is used.
29
30Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
31Cc: Khem Raj <raj.khem@gmail.com>
32Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
33Cc: Carmelo AMOROSO <carmelo.amoroso@st.com>
34---
35 ldso/ldso/arm/dl-startup.h | 1 +
36 libc/sysdeps/linux/arm/sysdep.h | 1 +
37 2 files changed, 2 insertions(+), 0 deletions(-)
38
39diff --git a/ldso/ldso/arm/dl-startup.h b/ldso/ldso/arm/dl-startup.h
40index a95389d..2dfdaff 100644
41--- a/ldso/ldso/arm/dl-startup.h
42+++ b/ldso/ldso/arm/dl-startup.h
43@@ -7,6 +7,7 @@
44 */
45
46 #include <features.h>
47+#include <bits/arm_asm.h>
48
49 #if !defined(__thumb__)
50 __asm__(
51diff --git a/libc/sysdeps/linux/arm/sysdep.h b/libc/sysdeps/linux/arm/sysdep.h
52index 013f88c..e498695 100644
53--- a/libc/sysdeps/linux/arm/sysdep.h
54+++ b/libc/sysdeps/linux/arm/sysdep.h
55@@ -21,6 +21,7 @@
56 #define _LINUX_ARM_SYSDEP_H 1
57
58 #include <common/sysdep.h>
59+#include <bits/arm_asm.h>
60
61 #include <sys/syscall.h>
62 /* For Linux we can use the system call table in the header file
63--
641.7.1
65
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/ldso_use_arm_dl_linux_resolve_in_thumb_mode.patch b/meta-oe/recipes-core/uclibc/uclibc-git/ldso_use_arm_dl_linux_resolve_in_thumb_mode.patch
deleted file mode 100644
index cfa68ce52..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/ldso_use_arm_dl_linux_resolve_in_thumb_mode.patch
+++ /dev/null
@@ -1,21 +0,0 @@
1Index: uClibc/ldso/ldso/arm/resolve.S
2===================================================================
3--- uClibc.orig/ldso/ldso/arm/resolve.S 2009-03-20 12:03:32.000000000 -0700
4+++ uClibc/ldso/ldso/arm/resolve.S 2009-03-20 12:04:23.000000000 -0700
5@@ -97,7 +97,6 @@
6
7 .text
8 .align 4 @ 16 byte boundary and there are 32 bytes below (arm case)
9- #if !defined(__thumb__) || defined(__thumb2__)
10 .arm
11 .globl _dl_linux_resolve
12 .type _dl_linux_resolve,%function
13@@ -129,7 +128,7 @@
14 #else
15 mov pc,ip
16 #endif
17-#else
18+#if 0
19 @ In the thumb case _dl_linux_resolver is thumb. If a bl is used
20 @ from arm code the linker will insert a stub call which, with
21 @ binutils 2.16, is not PIC. Since this code is accessed by an
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/mips64/uClibc.machine b/meta-oe/recipes-core/uclibc/uclibc-git/mips64/uClibc.machine
deleted file mode 100644
index a68c7afe0..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/mips64/uClibc.machine
+++ /dev/null
@@ -1,63 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Wed Jul 9 13:37:36 2008
4#
5# TARGET_alpha is not set
6# TARGET_arm is not set
7# TARGET_avr32 is not set
8# TARGET_bfin is not set
9# TARGET_cris is not set
10# TARGET_e1 is not set
11# TARGET_frv is not set
12# TARGET_h8300 is not set
13# TARGET_hppa is not set
14# TARGET_i386 is not set
15# TARGET_i960 is not set
16# TARGET_ia64 is not set
17# TARGET_m68k is not set
18# TARGET_microblaze is not set
19TARGET_mips=y
20# TARGET_nios is not set
21# TARGET_nios2 is not set
22# TARGET_powerpc is not set
23# TARGET_sh is not set
24# TARGET_sh64 is not set
25# TARGET_sparc is not set
26# TARGET_v850 is not set
27# TARGET_vax is not set
28# TARGET_x86_64 is not set
29# TARGET_xtensa is not set
30
31#
32# Target Architecture Features and Options
33#
34TARGET_ARCH="mips"
35FORCE_OPTIONS_FOR_ARCH=y
36ARCH_CFLAGS="-mno-split-addresses"
37# CONFIG_MIPS_O32_ABI is not set
38# CONFIG_MIPS_N32_ABI is not set
39CONFIG_MIPS_N64_ABI=y
40# CONFIG_MIPS_ISA_1 is not set
41# CONFIG_MIPS_ISA_2 is not set
42# CONFIG_MIPS_ISA_3 is not set
43# CONFIG_MIPS_ISA_4 is not set
44# CONFIG_MIPS_ISA_MIPS32 is not set
45CONFIG_MIPS_ISA_MIPS64=y
46TARGET_SUBARCH=""
47
48#
49# Using ELF file format
50#
51ARCH_ANY_ENDIAN=y
52# ARCH_BIG_ENDIAN is not set
53ARCH_WANTS_BIG_ENDIAN=y
54# ARCH_WANTS_LITTLE_ENDIAN=y
55ARCH_HAS_MMU=y
56ARCH_USE_MMU=y
57UCLIBC_HAS_FLOATS=y
58UCLIBC_HAS_FPU=y
59# DO_C99_MATH is not set
60# UCLIBC_HAS_FENV is not set
61KERNEL_HEADERS="/usr/include"
62HAVE_DOT_CONFIG=y
63
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/mipsel/uClibc.machine b/meta-oe/recipes-core/uclibc/uclibc-git/mipsel/uClibc.machine
deleted file mode 100644
index e14845181..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/mipsel/uClibc.machine
+++ /dev/null
@@ -1,63 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Wed Jul 9 13:37:36 2008
4#
5# TARGET_alpha is not set
6# TARGET_arm is not set
7# TARGET_avr32 is not set
8# TARGET_bfin is not set
9# TARGET_cris is not set
10# TARGET_e1 is not set
11# TARGET_frv is not set
12# TARGET_h8300 is not set
13# TARGET_hppa is not set
14# TARGET_i386 is not set
15# TARGET_i960 is not set
16# TARGET_ia64 is not set
17# TARGET_m68k is not set
18# TARGET_microblaze is not set
19TARGET_mips=y
20# TARGET_nios is not set
21# TARGET_nios2 is not set
22# TARGET_powerpc is not set
23# TARGET_sh is not set
24# TARGET_sh64 is not set
25# TARGET_sparc is not set
26# TARGET_v850 is not set
27# TARGET_vax is not set
28# TARGET_x86_64 is not set
29# TARGET_xtensa is not set
30
31#
32# Target Architecture Features and Options
33#
34TARGET_ARCH="mips"
35FORCE_OPTIONS_FOR_ARCH=y
36ARCH_CFLAGS="-mno-split-addresses"
37CONFIG_MIPS_O32_ABI=y
38# CONFIG_MIPS_N32_ABI is not set
39# CONFIG_MIPS_N64_ABI is not set
40# CONFIG_MIPS_ISA_1 is not set
41# CONFIG_MIPS_ISA_2 is not set
42# CONFIG_MIPS_ISA_3 is not set
43# CONFIG_MIPS_ISA_4 is not set
44CONFIG_MIPS_ISA_MIPS32=y
45# CONFIG_MIPS_ISA_MIPS64 is not set
46TARGET_SUBARCH=""
47
48#
49# Using ELF file format
50#
51ARCH_ANY_ENDIAN=y
52# ARCH_BIG_ENDIAN is not set
53# ARCH_WANTS_BIG_ENDIAN is not set
54ARCH_WANTS_LITTLE_ENDIAN=y
55ARCH_HAS_MMU=y
56ARCH_USE_MMU=y
57UCLIBC_HAS_FLOATS=y
58UCLIBC_HAS_FPU=y
59# DO_C99_MATH is not set
60# UCLIBC_HAS_FENV is not set
61KERNEL_HEADERS="/usr/include"
62HAVE_DOT_CONFIG=y
63
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/nslu2be/uClibc.machine b/meta-oe/recipes-core/uclibc/uclibc-git/nslu2be/uClibc.machine
deleted file mode 100644
index f5aa13454..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/nslu2be/uClibc.machine
+++ /dev/null
@@ -1,73 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Sat May 12 22:07:03 2007
4#
5# TARGET_alpha is not set
6TARGET_arm=y
7# TARGET_bfin is not set
8# TARGET_cris is not set
9# TARGET_e1 is not set
10# TARGET_frv is not set
11# TARGET_h8300 is not set
12# TARGET_hppa is not set
13# TARGET_i386 is not set
14# TARGET_i960 is not set
15# TARGET_ia64 is not set
16# TARGET_m68k is not set
17# TARGET_microblaze is not set
18# TARGET_mips is not set
19# TARGET_nios is not set
20# TARGET_nios2 is not set
21# TARGET_powerpc is not set
22# TARGET_sh is not set
23# TARGET_sh64 is not set
24# TARGET_sparc is not set
25# TARGET_v850 is not set
26# TARGET_vax is not set
27# TARGET_x86_64 is not set
28
29#
30# Target Architecture Features and Options
31#
32TARGET_ARCH="arm"
33FORCE_OPTIONS_FOR_ARCH=y
34# CONFIG_ARM_OABI is not set
35CONFIG_ARM_EABI=y
36USE_BX=y
37# CONFIG_GENERIC_ARM is not set
38# CONFIG_ARM610 is not set
39# CONFIG_ARM710 is not set
40# CONFIG_ARM7TDMI is not set
41# CONFIG_ARM720T is not set
42# CONFIG_ARM920T is not set
43# CONFIG_ARM922T is not set
44# CONFIG_ARM926T is not set
45# CONFIG_ARM10T is not set
46# CONFIG_ARM1136JF_S is not set
47# CONFIG_ARM1176JZ_S is not set
48# CONFIG_ARM1176JZF_S is not set
49# CONFIG_ARM_SA110 is not set
50# CONFIG_ARM_SA1100 is not set
51CONFIG_ARM_XSCALE=y
52# CONFIG_ARM_CORTEX_M3 is not set
53# CONFIG_ARM_CORTEX_M1 is not set
54# CONFIG_ARM_IWMMXT is not set
55TARGET_SUBARCH=""
56
57#
58# Using ELF file format
59#
60ARCH_ANY_ENDIAN=y
61ARCH_BIG_ENDIAN=y
62ARCH_WANTS_BIG_ENDIAN=y
63# ARCH_WANTS_LITTLE_ENDIAN is not set
64ARCH_HAS_MMU=y
65ARCH_USE_MMU=y
66UCLIBC_HAS_FLOATS=y
67# UCLIBC_HAS_FPU is not set
68UCLIBC_HAS_SOFT_FLOAT=y
69DO_C99_MATH=y
70# DO_XSI_MATH is not set
71# UCLIBC_HAS_FENV is not set
72KERNEL_HEADERS="/usr/include"
73HAVE_DOT_CONFIG=y
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/powerpc/uClibc.machine b/meta-oe/recipes-core/uclibc/uclibc-git/powerpc/uClibc.machine
deleted file mode 100644
index d49bf6af5..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/powerpc/uClibc.machine
+++ /dev/null
@@ -1,46 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Tue Feb 6 19:17:06 2007
4#
5# TARGET_alpha is not set
6# TARGET_arm is not set
7# TARGET_bfin is not set
8# TARGET_cris is not set
9# TARGET_e1 is not set
10# TARGET_frv is not set
11# TARGET_h8300 is not set
12# TARGET_hppa is not set
13# TARGET_i386 is not set
14# TARGET_i960 is not set
15# TARGET_ia64 is not set
16# TARGET_m68k is not set
17# TARGET_microblaze is not set
18# TARGET_mips is not set
19# TARGET_nios is not set
20# TARGET_nios2 is not set
21TARGET_powerpc=y
22# TARGET_sh is not set
23# TARGET_sh64 is not set
24# TARGET_sparc is not set
25# TARGET_v850 is not set
26# TARGET_vax is not set
27# TARGET_x86_64 is not set
28
29#
30# Target Architecture Features and Options
31#
32TARGET_ARCH="powerpc"
33FORCE_OPTIONS_FOR_ARCH=y
34ARCH_BIG_ENDIAN=y
35
36#
37# Using Big Endian
38#
39ARCH_HAS_MMU=y
40ARCH_USE_MMU=y
41UCLIBC_HAS_FLOATS=y
42UCLIBC_HAS_FPU=y
43DO_C99_MATH=y
44KERNEL_HEADERS="/usr/include"
45HAVE_DOT_CONFIG=y
46
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/powerpc_copysignl.patch b/meta-oe/recipes-core/uclibc/uclibc-git/powerpc_copysignl.patch
deleted file mode 100644
index 339ce7f5c..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/powerpc_copysignl.patch
+++ /dev/null
@@ -1,107 +0,0 @@
1Index: git/libc/sysdeps/linux/powerpc/Makefile.arch
2===================================================================
3--- git.orig/libc/sysdeps/linux/powerpc/Makefile.arch
4+++ git/libc/sysdeps/linux/powerpc/Makefile.arch
5@@ -5,7 +5,7 @@
6 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
7 #
8
9-CSRC := __syscall_error.c pread_write.c ioctl.c
10+CSRC := __syscall_error.c pread_write.c ioctl.c copysignl.c
11
12 ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),y)
13 CSRC += posix_fadvise.c posix_fadvise64.c
14Index: git/libc/sysdeps/linux/powerpc/copysignl.c
15===================================================================
16--- /dev/null
17+++ git/libc/sysdeps/linux/powerpc/copysignl.c
18@@ -0,0 +1,89 @@
19+/* s_copysignl.c -- long double version of s_copysign.c.
20+ * Conversion to long double by Ulrich Drepper,
21+ * Cygnus Support, drepper@cygnus.com.
22+ */
23+
24+/*
25+ * ====================================================
26+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
27+ *
28+ * Developed at SunPro, a Sun Microsystems, Inc. business.
29+ * Permission to use, copy, modify, and distribute this
30+ * software is freely granted, provided that this notice
31+ * is preserved.
32+ * ====================================================
33+ */
34+
35+/*
36+ * copysignl(long double x, long double y)
37+ * copysignl(x,y) returns a value with the magnitude of x and
38+ * with the sign bit of y.
39+ */
40+
41+#include <endian.h>
42+#include <stdint.h>
43+
44+#if __FLOAT_WORD_ORDER == BIG_ENDIAN
45+
46+typedef union
47+{
48+ long double value;
49+ struct
50+ {
51+ int sign_exponent:16;
52+ unsigned int empty:16;
53+ uint32_t msw;
54+ uint32_t lsw;
55+ } parts;
56+} ieee_long_double_shape_type;
57+
58+#endif
59+
60+#if __FLOAT_WORD_ORDER == LITTLE_ENDIAN
61+
62+typedef union
63+{
64+ long double value;
65+ struct
66+ {
67+ uint32_t lsw;
68+ uint32_t msw;
69+ int sign_exponent:16;
70+ unsigned int empty:16;
71+ } parts;
72+} ieee_long_double_shape_type;
73+
74+#endif
75+
76+/* Get int from the exponent of a long double. */
77+
78+#define GET_LDOUBLE_EXP(exp,d) \
79+do { \
80+ ieee_long_double_shape_type ge_u; \
81+ ge_u.value = (d); \
82+ (exp) = ge_u.parts.sign_exponent; \
83+} while (0)
84+
85+/* Set exponent of a long double from an int. */
86+
87+#define SET_LDOUBLE_EXP(d,exp) \
88+do { \
89+ ieee_long_double_shape_type se_u; \
90+ se_u.value = (d); \
91+ se_u.parts.sign_exponent = (exp); \
92+ (d) = se_u.value; \
93+} while (0)
94+
95+long double copysignl(long double x, long double y);
96+libc_hidden_proto(copysignl);
97+
98+long double copysignl(long double x, long double y)
99+{
100+ uint32_t es1,es2;
101+ GET_LDOUBLE_EXP(es1,x);
102+ GET_LDOUBLE_EXP(es2,y);
103+ SET_LDOUBLE_EXP(x,(es1&0x7fff)|(es2&0x8000));
104+ return x;
105+}
106+
107+libc_hidden_def(copysignl);
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/qemuarm/uClibc.machine b/meta-oe/recipes-core/uclibc/uclibc-git/qemuarm/uClibc.machine
deleted file mode 100644
index 7154278f8..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/qemuarm/uClibc.machine
+++ /dev/null
@@ -1,76 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Version: 0.9.32-git
4# Mon Jul 19 01:34:29 2010
5#
6# TARGET_alpha is not set
7TARGET_arm=y
8# TARGET_avr32 is not set
9# TARGET_bfin is not set
10# TARGET_cris is not set
11# TARGET_e1 is not set
12# TARGET_frv is not set
13# TARGET_h8300 is not set
14# TARGET_hppa is not set
15# TARGET_i386 is not set
16# TARGET_i960 is not set
17# TARGET_ia64 is not set
18# TARGET_m68k is not set
19# TARGET_microblaze is not set
20# TARGET_mips is not set
21# TARGET_nios is not set
22# TARGET_nios2 is not set
23# TARGET_powerpc is not set
24# TARGET_sh is not set
25# TARGET_sh64 is not set
26# TARGET_sparc is not set
27# TARGET_v850 is not set
28# TARGET_vax is not set
29# TARGET_x86_64 is not set
30# TARGET_xtensa is not set
31
32#
33# Target Architecture Features and Options
34#
35TARGET_ARCH="arm"
36FORCE_OPTIONS_FOR_ARCH=y
37# CONFIG_ARM_OABI is not set
38CONFIG_ARM_EABI=y
39USE_BX=y
40# CONFIG_GENERIC_ARM is not set
41# CONFIG_ARM610 is not set
42# CONFIG_ARM710 is not set
43# CONFIG_ARM7TDMI is not set
44# CONFIG_ARM720T is not set
45# CONFIG_ARM920T is not set
46# CONFIG_ARM922T is not set
47CONFIG_ARM926T=y
48# CONFIG_ARM10T is not set
49# CONFIG_ARM1136JF_S is not set
50# CONFIG_ARM1176JZ_S is not set
51# CONFIG_ARM1176JZF_S is not set
52# CONFIG_ARM_CORTEX_M3 is not set
53# CONFIG_ARM_CORTEX_M1 is not set
54# CONFIG_ARM_SA110 is not set
55# CONFIG_ARM_SA1100 is not set
56# CONFIG_ARM_XSCALE is not set
57# CONFIG_ARM_IWMMXT is not set
58TARGET_SUBARCH=""
59
60#
61# Using ELF file format
62#
63ARCH_ANY_ENDIAN=y
64ARCH_LITTLE_ENDIAN=y
65# ARCH_WANTS_BIG_ENDIAN is not set
66ARCH_WANTS_LITTLE_ENDIAN=y
67ARCH_HAS_MMU=y
68ARCH_USE_MMU=y
69UCLIBC_HAS_FLOATS=y
70# UCLIBC_HAS_FPU is not set
71UCLIBC_HAS_SOFT_FLOAT=y
72DO_C99_MATH=y
73# DO_XSI_MATH is not set
74# UCLIBC_HAS_FENV is not set
75KERNEL_HEADERS="/usr/include"
76HAVE_DOT_CONFIG=y
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/qemumips/uClibc.machine b/meta-oe/recipes-core/uclibc/uclibc-git/qemumips/uClibc.machine
deleted file mode 100644
index 1cf1addca..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/qemumips/uClibc.machine
+++ /dev/null
@@ -1,63 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Wed Jul 9 13:37:36 2008
4#
5# TARGET_alpha is not set
6# TARGET_arm is not set
7# TARGET_avr32 is not set
8# TARGET_bfin is not set
9# TARGET_cris is not set
10# TARGET_e1 is not set
11# TARGET_frv is not set
12# TARGET_h8300 is not set
13# TARGET_hppa is not set
14# TARGET_i386 is not set
15# TARGET_i960 is not set
16# TARGET_ia64 is not set
17# TARGET_m68k is not set
18# TARGET_microblaze is not set
19TARGET_mips=y
20# TARGET_nios is not set
21# TARGET_nios2 is not set
22# TARGET_powerpc is not set
23# TARGET_sh is not set
24# TARGET_sh64 is not set
25# TARGET_sparc is not set
26# TARGET_v850 is not set
27# TARGET_vax is not set
28# TARGET_x86_64 is not set
29# TARGET_xtensa is not set
30
31#
32# Target Architecture Features and Options
33#
34TARGET_ARCH="mips"
35FORCE_OPTIONS_FOR_ARCH=y
36ARCH_CFLAGS="-mno-split-addresses"
37CONFIG_MIPS_O32_ABI=y
38# CONFIG_MIPS_N32_ABI is not set
39# CONFIG_MIPS_N64_ABI is not set
40# CONFIG_MIPS_ISA_1 is not set
41# CONFIG_MIPS_ISA_2 is not set
42# CONFIG_MIPS_ISA_3 is not set
43# CONFIG_MIPS_ISA_4 is not set
44CONFIG_MIPS_ISA_MIPS32=y
45# CONFIG_MIPS_ISA_MIPS64 is not set
46TARGET_SUBARCH=""
47
48#
49# Using ELF file format
50#
51ARCH_ANY_ENDIAN=y
52# ARCH_BIG_ENDIAN is not set
53ARCH_WANTS_BIG_ENDIAN=y
54# ARCH_WANTS_LITTLE_ENDIAN=y
55ARCH_HAS_MMU=y
56ARCH_USE_MMU=y
57UCLIBC_HAS_FLOATS=y
58UCLIBC_HAS_FPU=y
59# DO_C99_MATH is not set
60# UCLIBC_HAS_FENV is not set
61KERNEL_HEADERS="/usr/include"
62HAVE_DOT_CONFIG=y
63
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/qemux86/uClibc.machine b/meta-oe/recipes-core/uclibc/uclibc-git/qemux86/uClibc.machine
deleted file mode 100644
index 3909ccc9e..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/qemux86/uClibc.machine
+++ /dev/null
@@ -1,59 +0,0 @@
1#
2# Automatically generated make config: don't edit
3#
4# TARGET_alpha is not set
5# TARGET_arm is not set
6# TARGET_bfin is not set
7# TARGET_cris is not set
8# TARGET_e1 is not set
9# TARGET_frv is not set
10# TARGET_h8300 is not set
11# TARGET_hppa is not set
12TARGET_i386=y
13# TARGET_i960 is not set
14# TARGET_m68k is not set
15# TARGET_microblaze is not set
16# TARGET_mips is not set
17# TARGET_nios is not set
18# TARGET_nios2 is not set
19# TARGET_powerpc is not set
20# TARGET_sh is not set
21# TARGET_sh64 is not set
22# TARGET_sparc is not set
23# TARGET_v850 is not set
24# TARGET_x86_64 is not set
25
26#
27# Target Architecture Features and Options
28#
29TARGET_ARCH="i386"
30# ARCH_SUPPORTS_BIG_ENDIAN is not set
31ARCH_SUPPORTS_LITTLE_ENDIAN=y
32FORCE_OPTIONS_FOR_ARCH=y
33# CONFIG_GENERIC_386 is not set
34# CONFIG_386 is not set
35# CONFIG_486 is not set
36# CONFIG_586 is not set
37# CONFIG_586MMX is not set
38# CONFIG_686 is not set
39# CONFIG_PENTIUMII is not set
40# CONFIG_PENTIUMIII is not set
41CONFIG_PENTIUM4=y
42# CONFIG_K6 is not set
43# CONFIG_K7 is not set
44# CONFIG_ELAN is not set
45# CONFIG_CRUSOE is not set
46# CONFIG_WINCHIPC6 is not set
47# CONFIG_WINCHIP2 is not set
48# CONFIG_CYRIXIII is not set
49# CONFIG_NEHEMIAH is not set
50ARCH_LITTLE_ENDIAN=y
51# ARCH_BIG_ENDIAN is not set
52# ARCH_HAS_NO_MMU is not set
53ARCH_HAS_MMU=y
54UCLIBC_HAS_FLOATS=y
55UCLIBC_HAS_FPU=y
56DO_C99_MATH=y
57# UCLIBC_HAS_FENV is not set
58KERNEL_HEADERS="<path/to/kernel/headers>"
59HAVE_DOT_CONFIG=y
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/remove-eabi-oabi-selection.patch b/meta-oe/recipes-core/uclibc/uclibc-git/remove-eabi-oabi-selection.patch
deleted file mode 100644
index 8f3464e2e..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/remove-eabi-oabi-selection.patch
+++ /dev/null
@@ -1,91 +0,0 @@
1Delivered-To: raj.khem@gmail.com
2Received: by 10.90.86.4 with SMTP id j4cs313309agb;
3 Sat, 8 Jan 2011 16:45:20 -0800 (PST)
4Received: by 10.216.173.7 with SMTP id u7mr612034wel.50.1294533919433;
5 Sat, 08 Jan 2011 16:45:19 -0800 (PST)
6Return-Path: <yann.morin.1998@anciens.enib.fr>
7Received: from smtp.smtpout.orange.fr (smtp01.smtpout.orange.fr [80.12.242.123])
8 by mx.google.com with ESMTP id e10si33752027wer.68.2011.01.08.16.45.19;
9 Sat, 08 Jan 2011 16:45:19 -0800 (PST)
10Received-SPF: neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) client-ip=80.12.242.123;
11Authentication-Results: mx.google.com; spf=neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) smtp.mail=yann.morin.1998@anciens.enib.fr
12Received: from roazhon.bzh.lan ([90.32.245.227])
13 by mwinf5d24 with ME
14 id tClC1f0024v5z3u03ClJDu; Sun, 09 Jan 2011 01:45:18 +0100
15From: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
16To: uclibc@uclibc.org
17Cc: Khem Raj <raj.khem@gmail.com>,
18 Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>,
19 Carmelo AMOROSO <carmelo.amoroso@st.com>
20Subject: [PATCH 7/7] ARM: remove EABI/OABI selection
21Date: Sun, 9 Jan 2011 01:45:10 +0100
22Message-Id: <1294533910-19305-8-git-send-email-yann.morin.1998@anciens.enib.fr>
23X-Mailer: git-send-email 1.7.1
24In-Reply-To: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr>
25References: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr>
26
27Rely on the compiler to be properly setup for the default ABI.
28
29When installing-headers, there are two cases:
30- NPTL: no issue, a cross-compiler is already expected
31- LinuxThreads: no issue, EABI/OABI has no impact on installed headers.
32
33Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
34Cc: Khem Raj <raj.khem@gmail.com>
35Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
36Cc: Carmelo AMOROSO <carmelo.amoroso@st.com>
37---
38 extra/Configs/Config.arm | 11 -----------
39 libc/sysdeps/linux/arm/Makefile.arch | 9 +++++++--
40 libc/sysdeps/linux/arm/bits/huge_val.h | 4 ++--
41 3 files changed, 9 insertions(+), 15 deletions(-)
42
43Index: git/libc/sysdeps/linux/arm/Makefile.arch
44===================================================================
45--- git.orig/libc/sysdeps/linux/arm/Makefile.arch
46+++ git/libc/sysdeps/linux/arm/Makefile.arch
47@@ -24,7 +24,12 @@ ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),y)
48 CSRC += posix_fadvise.c posix_fadvise64.c
49 endif
50
51-ifeq ($(CONFIG_ARM_EABI),y)
52+# Is our compiler set up for EABI ?
53+IS_EABI:=$(shell $(CC) $(CFLAGS) -x c - -E -dM </dev/null 2>/dev/null \
54+ |sed -r -e '/^\#[[:space:]]*define[[:space:]]+__ARM_EABI__([[:space:]]+1)?$$/!d; s/.+/y/;' \
55+ )
56+
57+ifeq ($(IS_EABI),y)
58 CSRC += aeabi_assert.c aeabi_atexit.c aeabi_errno_addr.c \
59 aeabi_localeconv.c aeabi_memclr.c aeabi_memcpy.c \
60 aeabi_memmove.c aeabi_memset.c find_exidx.c
61@@ -37,7 +42,7 @@ else
62 CSRC += syscall.c
63 endif
64
65-ifeq ($(CONFIG_ARM_EABI),y)
66+ifeq ($(IS_EABI),y)
67 libc-static-y += $(ARCH_OUT)/aeabi_lcsts.o $(ARCH_OUT)/aeabi_math.o \
68 $(ARCH_OUT)/aeabi_sighandlers.o
69 libc-nonshared-y += $(ARCH_OUT)/aeabi_lcsts.os $(ARCH_OUT)/aeabi_math.os \
70Index: git/libc/sysdeps/linux/arm/bits/huge_val.h
71===================================================================
72--- git.orig/libc/sysdeps/linux/arm/bits/huge_val.h
73+++ git/libc/sysdeps/linux/arm/bits/huge_val.h
74@@ -32,7 +32,7 @@
75 # define HUGE_VAL (__extension__ 0x1.0p2047)
76 #elif defined __GNUC__
77
78-#ifndef __CONFIG_ARM_EABI__
79+#ifndef __ARM_EABI__
80 # define HUGE_VAL \
81 (__extension__ \
82 ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; }) \
83@@ -50,7 +50,7 @@
84
85 typedef union { unsigned char __c[8]; double __d; } __huge_val_t;
86
87-#ifndef __CONFIG_ARM_EABI__
88+#ifndef __ARM_EABI__
89 # if __BYTE_ORDER == __BIG_ENDIAN
90 # define __HUGE_VAL_bytes { 0, 0, 0, 0, 0x7f, 0xf0, 0, 0 }
91 # endif
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/remove-sub-arch-variants.patch b/meta-oe/recipes-core/uclibc/uclibc-git/remove-sub-arch-variants.patch
deleted file mode 100644
index 920a66900..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/remove-sub-arch-variants.patch
+++ /dev/null
@@ -1,215 +0,0 @@
1Delivered-To: raj.khem@gmail.com
2Received: by 10.90.86.4 with SMTP id j4cs313303agb;
3 Sat, 8 Jan 2011 16:45:18 -0800 (PST)
4Received: by 10.227.98.158 with SMTP id q30mr1255804wbn.151.1294533917314;
5 Sat, 08 Jan 2011 16:45:17 -0800 (PST)
6Return-Path: <yann.morin.1998@anciens.enib.fr>
7Received: from smtp.smtpout.orange.fr (smtp01.smtpout.orange.fr [80.12.242.123])
8 by mx.google.com with ESMTP id r3si33749838wbr.54.2011.01.08.16.45.16;
9 Sat, 08 Jan 2011 16:45:17 -0800 (PST)
10Received-SPF: neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) client-ip=80.12.242.123;
11Authentication-Results: mx.google.com; spf=neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) smtp.mail=yann.morin.1998@anciens.enib.fr
12Received: from roazhon.bzh.lan ([90.32.245.227])
13 by mwinf5d24 with ME
14 id tClC1f0024v5z3u03ClGDS; Sun, 09 Jan 2011 01:45:16 +0100
15From: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
16To: uclibc@uclibc.org
17Cc: Khem Raj <raj.khem@gmail.com>,
18 Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>,
19 Carmelo AMOROSO <carmelo.amoroso@st.com>
20Subject: [PATCH 3/7] ARM: remove sub-arch/variants selection from menuconfig
21Date: Sun, 9 Jan 2011 01:45:06 +0100
22Message-Id: <1294533910-19305-4-git-send-email-yann.morin.1998@anciens.enib.fr>
23X-Mailer: git-send-email 1.7.1
24In-Reply-To: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr>
25References: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr>
26
27Rely on the compiler to be correctly set up to generate
28appropriate code for the target variant.
29
30This exposes the Thumb option, as it is no longer auto-selected.
31The "Use BX" no longer depends on supported CPU to be selected,
32so it now defaults to 'n' as it shall work by default on CPUs
33that do not have BX.
34
35Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
36Cc: Khem Raj <raj.khem@gmail.com>
37Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
38Cc: Carmelo AMOROSO <carmelo.amoroso@st.com>
39---
40 Rules.mak | 19 -------
41 extra/Configs/Config.arm | 125 ++--------------------------------------------
42 2 files changed, 5 insertions(+), 139 deletions(-)
43
44diff --git a/Rules.mak b/Rules.mak
45index 2a16908..09741a6 100644
46--- a/Rules.mak
47+++ b/Rules.mak
48@@ -332,25 +332,6 @@ ifeq ($(TARGET_ARCH),arm)
49 OPTIMIZATION+=-fstrict-aliasing
50 CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN)+=-mlittle-endian
51 CPU_CFLAGS-$(ARCH_BIG_ENDIAN)+=-mbig-endian
52- CPU_CFLAGS-$(CONFIG_GENERIC_ARM)+=
53- CPU_CFLAGS-$(CONFIG_ARM610)+=-mtune=arm610 -march=armv3
54- CPU_CFLAGS-$(CONFIG_ARM710)+=-mtune=arm710 -march=armv3
55- CPU_CFLAGS-$(CONFIG_ARM7TDMI)+=-mtune=arm7tdmi -march=armv4t
56- CPU_CFLAGS-$(CONFIG_ARM720T)+=-mtune=arm7tdmi -march=armv4t
57- CPU_CFLAGS-$(CONFIG_ARM920T)+=-mtune=arm9tdmi -march=armv4t
58- CPU_CFLAGS-$(CONFIG_ARM922T)+=-mtune=arm9tdmi -march=armv4t
59- CPU_CFLAGS-$(CONFIG_ARM926T)+=-mtune=arm9e -march=armv5te
60- CPU_CFLAGS-$(CONFIG_ARM10T)+=-mtune=arm10tdmi -march=armv5t
61- CPU_CFLAGS-$(CONFIG_ARM1136JF_S)+=-mtune=arm1136jf-s -march=armv6
62- CPU_CFLAGS-$(CONFIG_ARM1176JZ_S)+=-mtune=arm1176jz-s -march=armv6
63- CPU_CFLAGS-$(CONFIG_ARM1176JZF_S)+=-mtune=arm1176jzf-s -march=armv6
64- CPU_CFLAGS-$(CONFIG_ARM_SA110)+=-mtune=strongarm110 -march=armv4
65- CPU_CFLAGS-$(CONFIG_ARM_SA1100)+=-mtune=strongarm1100 -march=armv4
66- CPU_CFLAGS-$(CONFIG_ARM_XSCALE)+=$(call check_gcc,-mtune=xscale,-mtune=strongarm110)
67- CPU_CFLAGS-$(CONFIG_ARM_XSCALE)+=-march=armv5te -Wa,-mcpu=xscale
68- CPU_CFLAGS-$(CONFIG_ARM_IWMMXT)+=-march=iwmmxt -Wa,-mcpu=iwmmxt -mabi=iwmmxt
69- CPU_CFLAGS-$(CONFIG_ARM_CORTEX_M3)+=-mcpu=cortex-m3
70- CPU_CFLAGS-$(CONFIG_ARM_CORTEX_M1)+=-mcpu=cortex-m1
71 CPU_CFLAGS-$(COMPILE_IN_THUMB_MODE)+=-mthumb
72 endif
73
74diff --git a/extra/Configs/Config.arm b/extra/Configs/Config.arm
75index c9c40d4..6c75a00 100644
76--- a/extra/Configs/Config.arm
77+++ b/extra/Configs/Config.arm
78@@ -30,129 +30,14 @@ config CONFIG_ARM_EABI
79
80 endchoice
81
82-choice
83- prompt "Target Processor Type"
84- default CONFIG_GENERIC_ARM
85- help
86- This is the processor type of your CPU. This information is used for
87- optimizing purposes. To build a library that will run on all ARMCPU
88- types (albeit not optimally fast), you can specify "Generic Arm" here.
89- If you pick anything other than "Generic Arm", there is no guarantee
90- that uClibc will even run on anything other than the selected
91- processor type.
92-
93- Here are the settings recommended for greatest speed:
94- - "Generic Arm" select this if your compiler is already setup to
95- optimize things properly, or if you want to run on pretty much
96- everything, or you just don't much care.
97- - For anything else, pick the ARM core type that best matches the
98- cpu you will be using on your device.
99-
100- If you don't know what to do, choose "Generic Arm".
101-
102-config CONFIG_GENERIC_ARM
103- bool "Generic Arm"
104-
105-config CONFIG_ARM610
106- bool "Arm 610"
107- select ARCH_HAS_MMU
108-
109-config CONFIG_ARM710
110- bool "Arm 710"
111- select ARCH_HAS_MMU
112-
113-config CONFIG_ARM7TDMI
114- bool "Arm 7TDMI"
115- select ARCH_HAS_NO_MMU
116- select HAS_THUMB
117-
118-config CONFIG_ARM720T
119- bool "Arm 720T"
120- select ARCH_HAS_MMU
121- select HAS_THUMB
122-
123-config CONFIG_ARM920T
124- bool "Arm 920T"
125- select ARCH_HAS_MMU
126- select HAS_THUMB
127-
128-config CONFIG_ARM922T
129- bool "Arm 922T"
130- select ARCH_HAS_MMU
131- select HAS_THUMB
132-
133-config CONFIG_ARM926T
134- bool "Arm 926T"
135- select ARCH_HAS_MMU
136- select HAS_THUMB
137-
138-config CONFIG_ARM10T
139- bool "Arm 10T"
140- select ARCH_HAS_MMU
141- select HAS_THUMB
142-
143-config CONFIG_ARM1136JF_S
144- bool "Arm 1136JF-S"
145- select ARCH_HAS_MMU
146- select HAS_THUMB
147-
148-config CONFIG_ARM1176JZ_S
149- bool "Arm 1176JZ-S"
150- select ARCH_HAS_MMU
151- select HAS_THUMB
152-
153-config CONFIG_ARM1176JZF_S
154- bool "Arm 1176JZF-S"
155- select ARCH_HAS_MMU
156- select HAS_THUMB
157-
158-config CONFIG_ARM_CORTEX_M3
159- bool "Arm Cortex-M3"
160- select ARCH_HAS_NO_MMU
161- select FORCE_THUMB
162-
163-config CONFIG_ARM_CORTEX_M1
164- bool "Arm Cortex-M1"
165- select ARCH_HAS_NO_MMU
166- select FORCE_THUMB
167-
168-config CONFIG_ARM_SA110
169- bool "Intel StrongArm SA-110"
170- select ARCH_HAS_MMU
171- select HAS_THUMB
172-
173-config CONFIG_ARM_SA1100
174- bool "Intel StrongArm SA-1100"
175- select ARCH_HAS_MMU
176- select HAS_THUMB
177-
178-config CONFIG_ARM_XSCALE
179- bool "Intel Xscale"
180- select ARCH_HAS_MMU
181- select HAS_THUMB
182-
183-config CONFIG_ARM_IWMMXT
184- bool "Intel Xscale With WMMX PXA27x"
185- select ARCH_HAS_MMU
186- select HAS_THUMB
187-
188-endchoice
189-
190-config HAS_THUMB
191- bool
192-
193-config FORCE_THUMB
194- bool
195- select HAS_THUMB
196- select COMPILE_IN_THUMB_MODE
197- select USE_BX
198-
199 config COMPILE_IN_THUMB_MODE
200- bool
201+ bool "Build using Thumb mode"
202+ select USE_BX
203+ help
204+ Say 'y' here to force building uClibc in thumb mode.
205+ Say 'n' to use your compiler's default mode.
206
207 config USE_BX
208 bool "Use BX in function return"
209- default y
210- depends on HAS_THUMB
211 help
212 Use BX instruction for THUMB aware architectures.
213--
2141.7.1
215
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/remove_attribute_optimize_Os.patch b/meta-oe/recipes-core/uclibc/uclibc-git/remove_attribute_optimize_Os.patch
deleted file mode 100644
index 193038326..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/remove_attribute_optimize_Os.patch
+++ /dev/null
@@ -1,186 +0,0 @@
1Index: git/include/features.h
2===================================================================
3--- git.orig/include/features.h
4+++ git/include/features.h
5@@ -186,7 +186,6 @@
6 # define __need_uClibc_config_h
7 # include <bits/uClibc_config.h>
8 # undef __need_uClibc_config_h
9-
10 /* For uClibc, always optimize for size -- this should disable
11 * a lot of expensive inlining...
12 * TODO: this is wrong! __OPTIMIZE_SIZE__ is an indicator of
13Index: git/libpthread/nptl/pthread_mutex_timedlock.c
14===================================================================
15--- git.orig/libpthread/nptl/pthread_mutex_timedlock.c
16+++ git/libpthread/nptl/pthread_mutex_timedlock.c
17@@ -29,7 +29,9 @@
18 * error: can't find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
19 */
20 int
21+#ifndef __OPTIMIZE__
22 attribute_optimize("Os")
23+#endif
24 pthread_mutex_timedlock (
25 pthread_mutex_t *mutex,
26 const struct timespec *abstime)
27Index: git/libc/sysdeps/linux/powerpc/bits/mathinline.h
28===================================================================
29--- git.orig/libc/sysdeps/linux/powerpc/bits/mathinline.h
30+++ git/libc/sysdeps/linux/powerpc/bits/mathinline.h
31@@ -27,7 +27,7 @@
32 #ifdef __cplusplus
33 # define __MATH_INLINE __inline
34 #else
35-# define __MATH_INLINE extern __inline
36+# define __MATH_INLINE __extern_inline
37 #endif /* __cplusplus */
38
39 #if defined __GNUC__ && !defined _SOFT_FLOAT
40Index: git/libc/sysdeps/linux/alpha/bits/mathinline.h
41===================================================================
42--- git.orig/libc/sysdeps/linux/alpha/bits/mathinline.h
43+++ git/libc/sysdeps/linux/alpha/bits/mathinline.h
44@@ -25,7 +25,7 @@
45 #ifdef __cplusplus
46 # define __MATH_INLINE __inline
47 #else
48-# define __MATH_INLINE extern __inline
49+# define __MATH_INLINE __extern_inline
50 #endif
51
52 #if defined __USE_ISOC99 && defined __GNUC__ && !__GNUC_PREREQ(3,0)
53Index: git/libc/sysdeps/linux/common/bits/socket.h
54===================================================================
55--- git.orig/libc/sysdeps/linux/common/bits/socket.h
56+++ git/libc/sysdeps/linux/common/bits/socket.h
57@@ -302,7 +302,7 @@ extern struct cmsghdr *__cmsg_nxthdr (st
58 libc_hidden_proto(__cmsg_nxthdr)
59 #ifdef __USE_EXTERN_INLINES
60 # ifndef _EXTERN_INLINE
61-# define _EXTERN_INLINE extern __inline
62+# define _EXTERN_INLINE __extern_inline
63 # endif
64 _EXTERN_INLINE struct cmsghdr *
65 __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg))
66Index: git/libc/sysdeps/linux/i386/bits/mathinline.h
67===================================================================
68--- git.orig/libc/sysdeps/linux/i386/bits/mathinline.h
69+++ git/libc/sysdeps/linux/i386/bits/mathinline.h
70@@ -26,7 +26,7 @@
71 #ifdef __cplusplus
72 # define __MATH_INLINE __inline
73 #else
74-# define __MATH_INLINE extern __inline
75+# define __MATH_INLINE __extern_inline
76 #endif
77
78
79Index: git/libc/sysdeps/linux/ia64/bits/mathinline.h
80===================================================================
81--- git.orig/libc/sysdeps/linux/ia64/bits/mathinline.h
82+++ git/libc/sysdeps/linux/ia64/bits/mathinline.h
83@@ -24,7 +24,7 @@
84 #ifdef __cplusplus
85 # define __MATH_INLINE __inline
86 #else
87-# define __MATH_INLINE extern __inline
88+# define __MATH_INLINE __extern_inline
89 #endif
90
91 #if defined __USE_ISOC99 && defined __GNUC__ && __GNUC__ >= 2
92Index: git/libc/sysdeps/linux/m68k/bits/mathinline.h
93===================================================================
94--- git.orig/libc/sysdeps/linux/m68k/bits/mathinline.h
95+++ git/libc/sysdeps/linux/m68k/bits/mathinline.h
96@@ -92,7 +92,7 @@
97 # ifdef __cplusplus
98 # define __m81_inline __inline
99 # else
100-# define __m81_inline extern __inline
101+# define __m81_inline __extern_inline
102 # endif
103 # define __M81_MATH_INLINES 1
104 #endif
105@@ -351,14 +351,14 @@ __inline_functions (long double,l)
106 /* Note that there must be no whitespace before the argument passed for
107 NAME, to make token pasting work correctly with -traditional. */
108 # define __inline_forward_c(rettype, name, args1, args2) \
109-extern __inline rettype __attribute__((__const__)) \
110+__extern_inline rettype __attribute__((__const__)) \
111 name args1 \
112 { \
113 return __CONCAT(__,name) args2; \
114 }
115
116 # define __inline_forward(rettype, name, args1, args2) \
117-extern __inline rettype name args1 \
118+__extern_inline rettype name args1 \
119 { \
120 return __CONCAT(__,name) args2; \
121 }
122Index: git/libc/sysdeps/linux/mips/bits/socket.h
123===================================================================
124--- git.orig/libc/sysdeps/linux/mips/bits/socket.h
125+++ git/libc/sysdeps/linux/mips/bits/socket.h
126@@ -307,7 +307,7 @@ extern struct cmsghdr *__cmsg_nxthdr (st
127 libc_hidden_proto(__cmsg_nxthdr)
128 #ifdef __USE_EXTERN_INLINES
129 # ifndef _EXTERN_INLINE
130-# define _EXTERN_INLINE extern __inline
131+# define _EXTERN_INLINE __extern_inline
132 # endif
133 _EXTERN_INLINE struct cmsghdr *
134 __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg))
135Index: git/libc/sysdeps/linux/mips/sys/tas.h
136===================================================================
137--- git.orig/libc/sysdeps/linux/mips/sys/tas.h
138+++ git/libc/sysdeps/linux/mips/sys/tas.h
139@@ -30,7 +30,7 @@ extern int _test_and_set (int *p, int v)
140 #ifdef __USE_EXTERN_INLINES
141
142 # ifndef _EXTERN_INLINE
143-# define _EXTERN_INLINE extern __inline
144+# define _EXTERN_INLINE __extern_inline
145 # endif
146
147 _EXTERN_INLINE int
148Index: git/libc/sysdeps/linux/sparc/bits/mathinline.h
149===================================================================
150--- git.orig/libc/sysdeps/linux/sparc/bits/mathinline.h
151+++ git/libc/sysdeps/linux/sparc/bits/mathinline.h
152@@ -131,7 +131,7 @@
153 # ifdef __cplusplus
154 # define __MATH_INLINE __inline
155 # else
156-# define __MATH_INLINE extern __inline
157+# define __MATH_INLINE __extern_inline
158 # endif /* __cplusplus */
159
160 /* The gcc, version 2.7 or below, has problems with all this inlining
161Index: git/libc/sysdeps/linux/sparc/bits/socket.h
162===================================================================
163--- git.orig/libc/sysdeps/linux/sparc/bits/socket.h
164+++ git/libc/sysdeps/linux/sparc/bits/socket.h
165@@ -292,7 +292,7 @@ extern struct cmsghdr *__cmsg_nxthdr (st
166 libc_hidden_proto(__cmsg_nxthdr)
167 #ifdef __USE_EXTERN_INLINES
168 # ifndef _EXTERN_INLINE
169-# define _EXTERN_INLINE extern __inline
170+# define _EXTERN_INLINE __extern_inline
171 # endif
172 _EXTERN_INLINE struct cmsghdr *
173 __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg))
174Index: git/libc/sysdeps/linux/x86_64/bits/mathinline.h
175===================================================================
176--- git.orig/libc/sysdeps/linux/x86_64/bits/mathinline.h
177+++ git/libc/sysdeps/linux/x86_64/bits/mathinline.h
178@@ -25,7 +25,7 @@
179 #ifdef __cplusplus
180 # define __MATH_INLINE __inline
181 #else
182-# define __MATH_INLINE extern __inline
183+# define __MATH_INLINE __extern_inline
184 #endif
185
186
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/reorder-use-BX.patch b/meta-oe/recipes-core/uclibc/uclibc-git/reorder-use-BX.patch
deleted file mode 100644
index d780b4c54..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/reorder-use-BX.patch
+++ /dev/null
@@ -1,72 +0,0 @@
1Delivered-To: raj.khem@gmail.com
2Received: by 10.90.86.4 with SMTP id j4cs313299agb;
3 Sat, 8 Jan 2011 16:45:16 -0800 (PST)
4Received: by 10.227.134.5 with SMTP id h5mr1312651wbt.75.1294533915992;
5 Sat, 08 Jan 2011 16:45:15 -0800 (PST)
6Return-Path: <yann.morin.1998@anciens.enib.fr>
7Received: from smtp.smtpout.orange.fr (smtp01.smtpout.orange.fr [80.12.242.123])
8 by mx.google.com with ESMTP id m42si33753731wej.65.2011.01.08.16.45.15;
9 Sat, 08 Jan 2011 16:45:15 -0800 (PST)
10Received-SPF: neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) client-ip=80.12.242.123;
11Authentication-Results: mx.google.com; spf=neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) smtp.mail=yann.morin.1998@anciens.enib.fr
12Received: from roazhon.bzh.lan ([90.32.245.227])
13 by mwinf5d24 with ME
14 id tClC1f0024v5z3u03ClEDA; Sun, 09 Jan 2011 01:45:15 +0100
15From: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
16To: uclibc@uclibc.org
17Cc: Khem Raj <raj.khem@gmail.com>,
18 Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>,
19 Carmelo AMOROSO <carmelo.amoroso@st.com>
20Subject: [PATCH 1/7] ARM: reorder "Use BX" option
21Date: Sun, 9 Jan 2011 01:45:04 +0100
22Message-Id: <1294533910-19305-2-git-send-email-yann.morin.1998@anciens.enib.fr>
23X-Mailer: git-send-email 1.7.1
24In-Reply-To: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr>
25References: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr>
26
27"Use BX" is not available on all CPUs, so the option depends on
28a correct CPU to be chosen . It is weird that e BX" then appears
29_above_ the CPU selection, not below.
30
31Move the "Use BX" after the CPU selection.
32
33Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
34Cc: Khem Raj <raj.khem@gmail.com>
35Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
36Cc: Carmelo AMOROSO <carmelo.amoroso@st.com>
37---
38 extra/Configs/Config.arm | 14 +++++++-------
39 1 files changed, 7 insertions(+), 7 deletions(-)
40
41diff --git a/extra/Configs/Config.arm b/extra/Configs/Config.arm
42index b060ace..3b90e67 100644
43--- a/extra/Configs/Config.arm
44+++ b/extra/Configs/Config.arm
45@@ -30,13 +30,6 @@ config CONFIG_ARM_EABI
46
47 endchoice
48
49-config USE_BX
50- bool "Use BX in function return"
51- default y
52- depends on !CONFIG_GENERIC_ARM && !CONFIG_ARM610 && !CONFIG_ARM710
53- help
54- Use BX instruction for THUMB aware architectures.
55-
56 choice
57 prompt "Target Processor Type"
58 default CONFIG_GENERIC_ARM
59@@ -131,3 +124,10 @@ config CONFIG_ARM_IWMMXT
60 select ARCH_HAS_MMU
61
62 endchoice
63+
64+config USE_BX
65+ bool "Use BX in function return"
66+ default y
67+ depends on !CONFIG_GENERIC_ARM && !CONFIG_ARM610 && !CONFIG_ARM710
68+ help
69+ Use BX instruction for THUMB aware architectures.
70--
711.7.1
72
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/select-force-thumb.patch b/meta-oe/recipes-core/uclibc/uclibc-git/select-force-thumb.patch
deleted file mode 100644
index b19408f1b..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/select-force-thumb.patch
+++ /dev/null
@@ -1,172 +0,0 @@
1Delivered-To: raj.khem@gmail.com
2Received: by 10.90.86.4 with SMTP id j4cs313301agb;
3 Sat, 8 Jan 2011 16:45:17 -0800 (PST)
4Received: by 10.216.186.82 with SMTP id v60mr20017574wem.56.1294533916559;
5 Sat, 08 Jan 2011 16:45:16 -0800 (PST)
6Return-Path: <yann.morin.1998@anciens.enib.fr>
7Received: from smtp.smtpout.orange.fr (smtp01.smtpout.orange.fr [80.12.242.123])
8 by mx.google.com with ESMTP id o13si33755824wee.56.2011.01.08.16.45.16;
9 Sat, 08 Jan 2011 16:45:16 -0800 (PST)
10Received-SPF: neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) client-ip=80.12.242.123;
11Authentication-Results: mx.google.com; spf=neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) smtp.mail=yann.morin.1998@anciens.enib.fr
12Received: from roazhon.bzh.lan ([90.32.245.227])
13 by mwinf5d24 with ME
14 id tClC1f0024v5z3u03ClFDL; Sun, 09 Jan 2011 01:45:16 +0100
15From: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
16To: uclibc@uclibc.org
17Cc: Khem Raj <raj.khem@gmail.com>,
18 Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>,
19 Carmelo AMOROSO <carmelo.amoroso@st.com>
20Subject: [PATCH 2/7] ARM: introduce blind options to select & force THUMB mode
21Date: Sun, 9 Jan 2011 01:45:05 +0100
22Message-Id: <1294533910-19305-3-git-send-email-yann.morin.1998@anciens.enib.fr>
23X-Mailer: git-send-email 1.7.1
24In-Reply-To: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr>
25References: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr>
26
27Add three new blind options to set use of Thumb mode:
28- COMPILE_IN_THUMB_MODE
29 - if set, CFLAGS will contain -mthumb
30 - if unset, the compiler's default is used
31- HAS_THUMB
32 - CPUS with Thumb instruction set can select this
33 - use of BX depends on this
34- FORCE_THUMB
35 - CPUs that are Thumb-only must select this
36 - this selects: HAS_THUMB, COMPILE_IN_THUMB_MODE and USE_BX
37
38Also, remove leading space in Rules.mak.
39
40Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
41Cc: Khem Raj <raj.khem@gmail.com>
42Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
43Cc: Carmelo AMOROSO <carmelo.amoroso@st.com>
44---
45 Rules.mak | 7 ++++---
46 extra/Configs/Config.arm | 31 ++++++++++++++++++++++++++++---
47 2 files changed, 32 insertions(+), 6 deletions(-)
48
49diff --git a/Rules.mak b/Rules.mak
50index eecdc64..2a16908 100644
51--- a/Rules.mak
52+++ b/Rules.mak
53@@ -348,9 +348,10 @@ ifeq ($(TARGET_ARCH),arm)
54 CPU_CFLAGS-$(CONFIG_ARM_SA1100)+=-mtune=strongarm1100 -march=armv4
55 CPU_CFLAGS-$(CONFIG_ARM_XSCALE)+=$(call check_gcc,-mtune=xscale,-mtune=strongarm110)
56 CPU_CFLAGS-$(CONFIG_ARM_XSCALE)+=-march=armv5te -Wa,-mcpu=xscale
57- CPU_CFLAGS-$(CONFIG_ARM_IWMMXT)+=-march=iwmmxt -Wa,-mcpu=iwmmxt -mabi=iwmmxt
58- CPU_CFLAGS-$(CONFIG_ARM_CORTEX_M3)+=-mcpu=cortex-m3 -mthumb
59- CPU_CFLAGS-$(CONFIG_ARM_CORTEX_M1)+=-mcpu=cortex-m1 -mthumb
60+ CPU_CFLAGS-$(CONFIG_ARM_IWMMXT)+=-march=iwmmxt -Wa,-mcpu=iwmmxt -mabi=iwmmxt
61+ CPU_CFLAGS-$(CONFIG_ARM_CORTEX_M3)+=-mcpu=cortex-m3
62+ CPU_CFLAGS-$(CONFIG_ARM_CORTEX_M1)+=-mcpu=cortex-m1
63+ CPU_CFLAGS-$(COMPILE_IN_THUMB_MODE)+=-mthumb
64 endif
65
66 ifeq ($(TARGET_ARCH),mips)
67diff --git a/extra/Configs/Config.arm b/extra/Configs/Config.arm
68index 3b90e67..c9c40d4 100644
69--- a/extra/Configs/Config.arm
70+++ b/extra/Configs/Config.arm
71@@ -64,70 +64,95 @@ config CONFIG_ARM710
72 config CONFIG_ARM7TDMI
73 bool "Arm 7TDMI"
74 select ARCH_HAS_NO_MMU
75+ select HAS_THUMB
76
77 config CONFIG_ARM720T
78 bool "Arm 720T"
79 select ARCH_HAS_MMU
80+ select HAS_THUMB
81
82 config CONFIG_ARM920T
83 bool "Arm 920T"
84 select ARCH_HAS_MMU
85+ select HAS_THUMB
86
87 config CONFIG_ARM922T
88 bool "Arm 922T"
89 select ARCH_HAS_MMU
90+ select HAS_THUMB
91
92 config CONFIG_ARM926T
93 bool "Arm 926T"
94 select ARCH_HAS_MMU
95+ select HAS_THUMB
96
97 config CONFIG_ARM10T
98 bool "Arm 10T"
99 select ARCH_HAS_MMU
100+ select HAS_THUMB
101
102 config CONFIG_ARM1136JF_S
103 bool "Arm 1136JF-S"
104 select ARCH_HAS_MMU
105+ select HAS_THUMB
106
107 config CONFIG_ARM1176JZ_S
108 bool "Arm 1176JZ-S"
109 select ARCH_HAS_MMU
110+ select HAS_THUMB
111
112 config CONFIG_ARM1176JZF_S
113 bool "Arm 1176JZF-S"
114 select ARCH_HAS_MMU
115+ select HAS_THUMB
116
117 config CONFIG_ARM_CORTEX_M3
118 bool "Arm Cortex-M3"
119 select ARCH_HAS_NO_MMU
120- select USE_BX
121+ select FORCE_THUMB
122
123 config CONFIG_ARM_CORTEX_M1
124 bool "Arm Cortex-M1"
125 select ARCH_HAS_NO_MMU
126- select USE_BX
127+ select FORCE_THUMB
128
129 config CONFIG_ARM_SA110
130 bool "Intel StrongArm SA-110"
131 select ARCH_HAS_MMU
132+ select HAS_THUMB
133
134 config CONFIG_ARM_SA1100
135 bool "Intel StrongArm SA-1100"
136 select ARCH_HAS_MMU
137+ select HAS_THUMB
138
139 config CONFIG_ARM_XSCALE
140 bool "Intel Xscale"
141 select ARCH_HAS_MMU
142+ select HAS_THUMB
143
144 config CONFIG_ARM_IWMMXT
145 bool "Intel Xscale With WMMX PXA27x"
146 select ARCH_HAS_MMU
147+ select HAS_THUMB
148
149 endchoice
150
151+config HAS_THUMB
152+ bool
153+
154+config FORCE_THUMB
155+ bool
156+ select HAS_THUMB
157+ select COMPILE_IN_THUMB_MODE
158+ select USE_BX
159+
160+config COMPILE_IN_THUMB_MODE
161+ bool
162+
163 config USE_BX
164 bool "Use BX in function return"
165 default y
166- depends on !CONFIG_GENERIC_ARM && !CONFIG_ARM610 && !CONFIG_ARM710
167+ depends on HAS_THUMB
168 help
169 Use BX instruction for THUMB aware architectures.
170--
1711.7.1
172
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/sh4/uClibc.machine b/meta-oe/recipes-core/uclibc/uclibc-git/sh4/uClibc.machine
deleted file mode 100644
index 65f1c4c3c..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/sh4/uClibc.machine
+++ /dev/null
@@ -1,48 +0,0 @@
1#
2# Automatically generated make config: don't edit
3#
4# TARGET_alpha is not set
5# TARGET_arm is not set
6# TARGET_bfin is not set
7# TARGET_cris is not set
8# TARGET_e1 is not set
9# TARGET_frv is not set
10# TARGET_h8300 is not set
11# TARGET_hppa is not set
12# TARGET_i386 is not set
13# TARGET_i960 is not set
14# TARGET_m68k is not set
15# TARGET_microblaze is not set
16# TARGET_mips is not set
17# TARGET_nios is not set
18# TARGET_nios2 is not set
19# TARGET_powerpc is not set
20TARGET_sh=y
21# TARGET_sh64 is not set
22# TARGET_sparc is not set
23# TARGET_v850 is not set
24# TARGET_x86_64 is not set
25
26#
27# Target Architecture Features and Options
28#
29TARGET_ARCH="sh"
30ARCH_SUPPORTS_BIG_ENDIAN=y
31ARCH_SUPPORTS_LITTLE_ENDIAN=y
32FORCE_OPTIONS_FOR_ARCH=y
33# CONFIG_SH2A is not set
34# CONFIG_SH2 is not set
35# CONFIG_SH3 is not set
36CONFIG_SH4=y
37ARCH_LITTLE_ENDIAN=y
38# ARCH_BIG_ENDIAN is not set
39ARCH_WANTS_LITTLE_ENDIAN=y
40# ARCH_WANTS_BIG_ENDIAN is not set
41# ARCH_HAS_NO_MMU is not set
42ARCH_HAS_MMU=y
43UCLIBC_HAS_FLOATS=y
44UCLIBC_HAS_FPU=y
45DO_C99_MATH=y
46# UCLIBC_HAS_FENV is not set
47KERNEL_HEADERS="<path/to/kernel/headers>"
48HAVE_DOT_CONFIG=y
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/transform-eabi-oabi-choice.patch b/meta-oe/recipes-core/uclibc/uclibc-git/transform-eabi-oabi-choice.patch
deleted file mode 100644
index 82970ca45..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/transform-eabi-oabi-choice.patch
+++ /dev/null
@@ -1,71 +0,0 @@
1Delivered-To: raj.khem@gmail.com
2Received: by 10.90.86.4 with SMTP id j4cs313305agb;
3 Sat, 8 Jan 2011 16:45:19 -0800 (PST)
4Received: by 10.216.153.210 with SMTP id f60mr573848wek.114.1294533918335;
5 Sat, 08 Jan 2011 16:45:18 -0800 (PST)
6Return-Path: <yann.morin.1998@anciens.enib.fr>
7Received: from smtp.smtpout.orange.fr (smtp01.smtpout.orange.fr [80.12.242.123])
8 by mx.google.com with ESMTP id n4si33737071wej.152.2011.01.08.16.45.17;
9 Sat, 08 Jan 2011 16:45:18 -0800 (PST)
10Received-SPF: neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) client-ip=80.12.242.123;
11Authentication-Results: mx.google.com; spf=neutral (google.com: 80.12.242.123 is neither permitted nor denied by best guess record for domain of yann.morin.1998@anciens.enib.fr) smtp.mail=yann.morin.1998@anciens.enib.fr
12Received: from roazhon.bzh.lan ([90.32.245.227])
13 by mwinf5d24 with ME
14 id tClC1f0024v5z3u03ClGDX; Sun, 09 Jan 2011 01:45:17 +0100
15From: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
16To: uclibc@uclibc.org
17Cc: Khem Raj <raj.khem@gmail.com>,
18 Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>,
19 Carmelo AMOROSO <carmelo.amoroso@st.com>
20Subject: [PATCH 4/7] ARM: transform the EABI/OABI choice into a boolean
21Date: Sun, 9 Jan 2011 01:45:07 +0100
22Message-Id: <1294533910-19305-5-git-send-email-yann.morin.1998@anciens.enib.fr>
23X-Mailer: git-send-email 1.7.1
24In-Reply-To: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr>
25References: <1294533910-19305-1-git-send-email-yann.morin.1998@anciens.enib.fr>
26
27The CONFIG_ARM_OABI option is never used.
28
29Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
30Cc: Khem Raj <raj.khem@gmail.com>
31Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
32Cc: Carmelo AMOROSO <carmelo.amoroso@st.com>
33---
34 extra/Configs/Config.arm | 23 ++++++++---------------
35 1 files changed, 8 insertions(+), 15 deletions(-)
36
37Index: git/extra/Configs/Config.arm
38===================================================================
39--- git.orig/extra/Configs/Config.arm
40+++ git/extra/Configs/Config.arm
41@@ -12,23 +12,16 @@ config FORCE_OPTIONS_FOR_ARCH
42 default y
43 select ARCH_ANY_ENDIAN
44
45-choice
46- prompt "Target ABI"
47- default CONFIG_ARM_EABI
48+config CONFIG_ARM_EABI
49+ bool "Build for EABI"
50 help
51- If you choose "EABI" here, functions and constants required by the
52- ARM EABI will be built into the library. You should choose "EABI"
53+ If you say 'y' here, functions and constants required by the
54+ ARM EABI will be built into the library. You should say 'y'
55 if your compiler uses the ARM EABI, in which case you will also
56- need a kernel supporting the EABI system call interface, or "OABI"
57- for a compiler using the old Linux ABI.
58-
59-config CONFIG_ARM_OABI
60- bool "OABI"
61-
62-config CONFIG_ARM_EABI
63- bool "EABI"
64+ need a kernel supporting the EABI system call interface.
65
66-endchoice
67+ If you say 'n' here, then the library will be built for the
68+ old Linux ABI.
69
70 config COMPILE_IN_THUMB_MODE
71 bool "Build using Thumb mode"
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/uClibc.config b/meta-oe/recipes-core/uclibc/uclibc-git/uClibc.config
deleted file mode 100644
index e69de29bb..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/uClibc.config
+++ /dev/null
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/uClibc.distro b/meta-oe/recipes-core/uclibc/uclibc-git/uClibc.distro
deleted file mode 100644
index a1b7813a0..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/uClibc.distro
+++ /dev/null
@@ -1,160 +0,0 @@
1#
2# General Library Settings
3#
4# HAVE_NO_PIC is not set
5# DOPIC is not set
6# HAVE_NO_SHARED is not set
7# ARCH_HAS_NO_LDSO is not set
8HAVE_SHARED=y
9# FORCE_SHAREABLE_TEXT_SEGMENTS is not set
10LDSO_LDD_SUPPORT=y
11LDSO_CACHE_SUPPORT=y
12# LDSO_PRELOAD_FILE_SUPPORT is not set
13LDSO_BASE_FILENAME="ld.so"
14# UCLIBC_STATIC_LDCONFIG is not set
15LDSO_RUNPATH=y
16UCLIBC_CTOR_DTOR=y
17LDSO_GNU_HASH_SUPPORT=y
18# HAS_NO_THREADS is not set
19UCLIBC_HAS_THREADS=y
20UCLIBC_HAS_THREADS_NATIVE=y
21PTHREADS_DEBUG_SUPPORT=y
22# LINUXTHREADS_OLD is not set
23UCLIBC_HAS_LFS=y
24# MALLOC is not set
25# MALLOC_SIMPLE is not set
26MALLOC_STANDARD=y
27MALLOC_GLIBC_COMPAT=y
28UCLIBC_DYNAMIC_ATEXIT=y
29COMPAT_ATEXIT=y
30UCLIBC_SUSV3_LEGACY=y
31UCLIBC_SUSV3_LEGACY_MACROS=y
32UCLIBC_SUSV4_LEGACY=y
33UCLIBC_HAS_SHADOW=y
34UCLIBC_HAS_PROGRAM_INVOCATION_NAME=y
35UCLIBC_HAS___PROGNAME=y
36UNIX98PTY_ONLY=y
37ASSUME_DEVPTS=y
38UCLIBC_HAS_LIBUTIL=y
39UCLIBC_HAS_TM_EXTENSIONS=y
40UCLIBC_HAS_TZ_CACHING=y
41UCLIBC_HAS_TZ_FILE=y
42UCLIBC_HAS_TZ_FILE_READ_MANY=y
43UCLIBC_TZ_FILE_PATH="/etc/TZ"
44
45#
46# Advanced Library Settings
47#
48UCLIBC_PWD_BUFFER_SIZE=256
49UCLIBC_GRP_BUFFER_SIZE=256
50
51#
52# Networking Support
53#
54UCLIBC_HAS_IPV6=y
55UCLIBC_HAS_RPC=y
56UCLIBC_HAS_FULL_RPC=y
57# UCLIBC_HAS_REENTRANT_RPC is not set
58UCLIBC_USE_NETLINK=y
59UCLIBC_SUPPORT_AI_ADDRCONFIG=y
60
61UCLIBC_HAS_BSD_RES_CLOSE=y
62UCLIBC_HAS_LIBRESOLV_STUB=y
63UCLIBC_HAS_LIBNSL_STUB=y
64
65#
66# String and Stdio Support
67#
68UCLIBC_HAS_STRING_GENERIC_OPT=y
69UCLIBC_HAS_STRING_ARCH_OPT=y
70UCLIBC_HAS_CTYPE_TABLES=y
71UCLIBC_HAS_CTYPE_SIGNED=y
72# UCLIBC_HAS_CTYPE_UNSAFE is not set
73UCLIBC_HAS_CTYPE_CHECKED=y
74# UCLIBC_HAS_CTYPE_ENFORCED is not set
75UCLIBC_HAS_WCHAR=y
76# UCLIBC_HAS_LOCALE is not set
77UCLIBC_HAS_HEXADECIMAL_FLOATS=y
78UCLIBC_HAS_GLIBC_CUSTOM_PRINTF=y
79UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9
80UCLIBC_HAS_SCANF_GLIBC_A_FLAG=y
81# UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set
82UCLIBC_HAS_STDIO_BUFSIZ_256=y
83# UCLIBC_HAS_STDIO_BUFSIZ_512 is not set
84# UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set
85# UCLIBC_HAS_STDIO_BUFSIZ_2048 is not set
86# UCLIBC_HAS_STDIO_BUFSIZ_4096 is not set
87# UCLIBC_HAS_STDIO_BUFSIZ_8192 is not set
88UCLIBC_HAS_STDIO_BUILTIN_BUFFER_NONE=y
89# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_4 is not set
90# UCLIBC_HAS_STDIO_BUILTIN_BUFFER_8 is not set
91# UCLIBC_HAS_STDIO_SHUTDOWN_ON_ABORT is not set
92UCLIBC_HAS_STDIO_GETC_MACRO=y
93UCLIBC_HAS_STDIO_PUTC_MACRO=y
94UCLIBC_HAS_STDIO_AUTO_RW_TRANSITION=y
95# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set
96UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE=y
97UCLIBC_HAS_GLIBC_CUSTOM_STREAMS=y
98UCLIBC_HAS_PRINTF_M_SPEC=y
99UCLIBC_HAS_ERRNO_MESSAGES=y
100# UCLIBC_HAS_SYS_ERRLIST is not set
101UCLIBC_HAS_SIGNUM_MESSAGES=y
102# UCLIBC_HAS_SYS_SIGLIST is not set
103UCLIBC_HAS_GNU_GETOPT=y
104UCLIBC_HAS_GNU_GETSUBOPT=y
105
106#
107# Big and Tall
108#
109UCLIBC_HAS_REGEX=y
110# UCLIBC_HAS_REGEX_OLD is not set
111UCLIBC_HAS_FNMATCH=y
112# UCLIBC_HAS_FNMATCH_OLD is not set
113UCLIBC_HAS_WORDEXP=y
114UCLIBC_HAS_NFTW=y
115UCLIBC_HAS_FTW=y
116UCLIBC_HAS_FTS=y
117UCLIBC_HAS_GLOB=y
118UCLIBC_HAS_GNU_GLOB=y
119
120#
121# Library Installation Options
122#
123SHARED_LIB_LOADER_PREFIX="/lib"
124RUNTIME_PREFIX="/"
125DEVEL_PREFIX="//usr"
126
127#
128# Security options
129#
130# UCLIBC_BUILD_PIE is not set
131# UCLIBC_HAS_ARC4RANDOM is not set
132# HAVE_NO_SSP is not set
133# UCLIBC_HAS_SSP is not set
134UCLIBC_BUILD_RELRO=y
135UCLIBC_BUILD_NOW=y
136UCLIBC_BUILD_NOEXECSTACK=y
137
138#
139# uClibc development/debugging options
140#
141CROSS_COMPILER_PREFIX=""
142UCLIBC_EXTRA_CFLAGS=""
143# DODEBUG is not set
144# DODEBUG_PT is not set
145# DOSTRIP is not set
146# DOASSERTS is not set
147# SUPPORT_LD_DEBUG is not set
148# SUPPORT_LD_DEBUG_EARLY is not set
149# UCLIBC_MALLOC_DEBUGGING is not set
150UCLIBC_HAS_BACKTRACE=y
151WARNINGS="-Wall"
152# EXTRA_WARNINGS is not set
153# DOMULTI is not set
154# UCLIBC_MJN3_ONLY is not set
155
156# math stuff for perl
157DO_C99_MATH=y
158UCLIBC_HAS_LONG_DOUBLE_MATH=y
159UCLIBC_HAS_FENV=y
160
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/uclibc-arm-ftruncate64.patch b/meta-oe/recipes-core/uclibc/uclibc-git/uclibc-arm-ftruncate64.patch
deleted file mode 100644
index 504d37bcd..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/uclibc-arm-ftruncate64.patch
+++ /dev/null
@@ -1,13 +0,0 @@
1Index: uclibc-0.9.29/libc/sysdeps/linux/arm/bits/uClibc_arch_features.h
2===================================================================
3--- uclibc-0.9.29.orig/libc/sysdeps/linux/arm/bits/uClibc_arch_features.h
4+++ uclibc-0.9.29/libc/sysdeps/linux/arm/bits/uClibc_arch_features.h
5@@ -38,4 +38,8 @@
6 /* define if target supports IEEE signed zero floats */
7 #define __UCLIBC_HAVE_SIGNED_ZERO__
8
9+#ifdef __ARM_EABI__
10+# define __UCLIBC_TRUNCATE64_HAS_4_ARGS__
11+#endif
12+
13 #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/uclibc_enable_log2_test.patch b/meta-oe/recipes-core/uclibc/uclibc-git/uclibc_enable_log2_test.patch
deleted file mode 100644
index f8f3a7d1a..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/uclibc_enable_log2_test.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1Index: uClibc/test/math/libm-test.inc
2===================================================================
3--- uClibc/test/math/libm-test.inc (revision 23784)
4+++ uClibc/test/math/libm-test.inc (working copy)
5@@ -3414,7 +3414,6 @@
6 }
7
8
9-#if 0
10 static void
11 log2_test (void)
12 {
13@@ -3444,7 +3443,6 @@
14
15 END (log2);
16 }
17-#endif
18
19
20 static void
21@@ -4967,9 +4965,7 @@
22 log_test ();
23 log10_test ();
24 log1p_test ();
25-#if 0
26 log2_test ();
27-#endif
28 logb_test ();
29 modf_test ();
30 ilogb_test ();
diff --git a/meta-oe/recipes-core/uclibc/uclibc-git/x86_64/uClibc.machine b/meta-oe/recipes-core/uclibc/uclibc-git/x86_64/uClibc.machine
deleted file mode 100644
index ac50da060..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-git/x86_64/uClibc.machine
+++ /dev/null
@@ -1,42 +0,0 @@
1#
2# Automatically generated make config: don't edit
3#
4# TARGET_alpha is not set
5# TARGET_arm is not set
6# TARGET_bfin is not set
7# TARGET_cris is not set
8# TARGET_e1 is not set
9# TARGET_frv is not set
10# TARGET_h8300 is not set
11# TARGET_hppa is not set
12# TARGET_i386 is not set
13# TARGET_i960 is not set
14# TARGET_m68k is not set
15# TARGET_microblaze is not set
16# TARGET_mips is not set
17# TARGET_nios is not set
18# TARGET_nios2 is not set
19# TARGET_powerpc is not set
20# TARGET_sh is not set
21# TARGET_sh64 is not set
22# TARGET_sparc is not set
23# TARGET_v850 is not set
24TARGET_x86_64=y
25
26#
27# Target Architecture Features and Options
28#
29TARGET_ARCH="x86_64"
30# ARCH_SUPPORTS_BIG_ENDIAN is not set
31ARCH_SUPPORTS_LITTLE_ENDIAN=y
32FORCE_OPTIONS_FOR_ARCH=y
33ARCH_LITTLE_ENDIAN=y
34# ARCH_BIG_ENDIAN is not set
35# ARCH_HAS_NO_MMU is not set
36ARCH_HAS_MMU=y
37UCLIBC_HAS_FLOATS=y
38UCLIBC_HAS_FPU=y
39DO_C99_MATH=y
40# UCLIBC_HAS_FENV is not set
41KERNEL_HEADERS="<path/to/kernel/headers>"
42HAVE_DOT_CONFIG=y
diff --git a/meta-oe/recipes-core/uclibc/uclibc-initial_git.bb b/meta-oe/recipes-core/uclibc/uclibc-initial_git.bb
deleted file mode 100644
index 8e5c25121..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc-initial_git.bb
+++ /dev/null
@@ -1,39 +0,0 @@
1SECTION = "base"
2require uclibc_git.bb
3
4DEPENDS = "linux-libc-headers ncurses-native virtual/${TARGET_PREFIX}gcc-initial"
5PROVIDES = "virtual/${TARGET_PREFIX}libc-initial"
6
7PACKAGES = ""
8PACKAGES_DYNAMIC = ""
9
10STAGINGCC = "gcc-cross-initial"
11STAGINGCC_virtclass-nativesdk = "gcc-crosssdk-initial"
12
13do_install() {
14 # Install initial headers into the cross dir
15 make PREFIX=${D} DEVEL_PREFIX=${prefix}/ RUNTIME_PREFIX=/ \
16 install_headers install_startfiles
17 ${CC} -nostdlib -nostartfiles -shared -x c /dev/null \
18 -o lib/libc.so
19 ${CC} -nostdlib -nostartfiles -shared -x c /dev/null \
20 -o lib/libm.so
21 install -d ${D}${libdir}
22 install -m 755 lib/lib[cm].so ${D}${libdir}
23 # add links to linux-libc-headers: gcc-{cross,crossdk}-intermediate need this.
24 for t in linux asm asm-generic; do
25 if [ -d ${D}${includedir}/$t ]; then
26 rm -rf ${D}${includedir}/$t
27 fi
28 ln -sf ${STAGING_DIR_TARGET}${includedir}/$t ${D}${includedir}/
29 done
30}
31do_compile() {
32 :
33}
34
35do_siteconfig () {
36 :
37}
38
39do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_TCBOOTSTRAP}"
diff --git a/meta-oe/recipes-core/uclibc/uclibc.inc b/meta-oe/recipes-core/uclibc/uclibc.inc
deleted file mode 100644
index e7d884673..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc.inc
+++ /dev/null
@@ -1,215 +0,0 @@
1SUMMARY = "C library for embedded systems"
2DESCRIPTION = "The name uClibc is an abbreviation for 'the \
3microcontroller C library'. For simplicity, uClibc is pronounced \
4'yew-see-lib-see'. The goal of uClibc is to provide as much \
5functionality as possible in a small amount of space, and it is intended \
6primarily for embedded use. It is also highly configurable in supported \
7features, at the cost of ABI differences for different configurations. \
8uClibc has been designed from the ground up to be a C library for \
9embedded Linux. It is NOT compatible with binaries linked against glibc."
10
11LICENSE = "LGPL"
12SECTION = "libs"
13PRIORITY = "required"
14LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=a6f89e2100d9b6cdffcea4f398e37343 \
15 file://COPYING.LIB.boilerplate;md5=aaddeadcddeb918297e0e4afc52ce46f \
16file://${S}/test/regex/testregex.c;startline=1;endline=31;md5=234efb227d0a40677f895e4a1e26e960"
17INC_PR = "r2"
18
19require uclibc-config.inc
20STAGINGCC = "gcc-cross-intermediate"
21STAGINGCC_virtclass-nativesdk = "gcc-crosssdk-intermediate"
22PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:"
23
24TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
25
26# siteconfig.bbclass runs configure which needs a working compiler
27# For the compiler to work we need a working libc yet libc isn't
28# in the sysroots directory at this point. This means the libc.so
29# linker script won't work as the --sysroot setting isn't correct.
30# Here we create a hacked up libc linker script and pass in the right
31# flags to let configure work. Ugly.
32EXTRASITECONFIG = "CFLAGS='${CFLAGS} -Wl,-L${WORKDIR}/site_config_libc -L${WORKDIR}/site_config_libc -L${SYSROOT_DESTDIR}${libdir} -L${SYSROOT_DESTDIR}${base_libdir} -Wl,-L${SYSROOT_DESTDIR}${libdir} -Wl,-L${SYSROOT_DESTDIR}${base_libdir}'"
33siteconfig_do_siteconfig_gencache_prepend = " \
34mkdir -p ${WORKDIR}/site_config_libc; \
35cp ${SYSROOT_DESTDIR}${libdir}/libc.so ${WORKDIR}/site_config_libc; \
36sed -i -e 's# ${base_libdir}# ${SYSROOT_DESTDIR}${base_libdir}#g' -e 's# ${libdir}# ${SYSROOT_DESTDIR}${libdir}#g' ${WORKDIR}/site_config_libc/libc.so; \
37"
38
39#
40# For now, we will skip building of a gcc package if it is a uclibc one
41# and our build is not a uclibc one, and we skip a glibc one if our build
42# is a uclibc build.
43#
44# See the note in gcc/gcc_3.4.0.oe
45#
46
47python __anonymous () {
48 import bb, re
49 uc_os = (re.match('.*uclibc*', bb.data.getVar('TARGET_OS', d, 1)) != None)
50 if not uc_os:
51 raise bb.parse.SkipPackage("incompatible with target %s" %
52 bb.data.getVar('TARGET_OS', d, 1))
53}
54PROVIDES += "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc"
55DEPENDS = "virtual/${TARGET_PREFIX}binutils \
56 virtual/${TARGET_PREFIX}gcc-intermediate \
57 linux-libc-headers ncurses-native"
58RDEPENDS_${PN}-dev = "linux-libc-headers-dev"
59
60INHIBIT_DEFAULT_DEPS = "1"
61
62PACKAGES =+ "ldd uclibc-utils-dbg uclibc-utils uclibc-gconv uclibc-thread-db uclibc-argp uclibc-backtrace"
63
64LEAD_SONAME = "libc.so"
65
66# The last line (gdb and lib1) is for uclinux-uclibc builds
67uclibc_baselibs = "${base_libdir}/libcrypt*.so.* ${base_libdir}/libcrypt-*.so \
68 ${base_libdir}/libintl*.so.* ${base_libdir}/libintl-*.so \
69 ${base_libdir}/libnsl*.so.* ${base_libdir}/libnsl-*.so \
70 ${base_libdir}/libresolv*.so.* ${base_libdir}/libresolv-*.so \
71 ${base_libdir}/ld*.so.* ${base_libdir}/ld*.so \
72 ${base_libdir}/libc*.so.* ${base_libdir}/libuClibc-*.so \
73 ${base_libdir}/libdl*.so.* ${base_libdir}/libdl-*.so \
74 ${base_libdir}/libm*.so.* ${base_libdir}/libm-*.so \
75 ${base_libdir}/libutil*.so.* ${base_libdir}/libutil-*.so \
76 ${base_libdir}/libpthread*.so.* ${base_libdir}/libpthread-*.so \
77 ${base_libdir}/librt*.so.* ${base_libdir}/librt-*.so \
78 ${libdir}/libc.gdb ${libdir}/libc ${base_libdir}/lib1.so \
79 "
80FILES_${PN} = "${sysconfdir} ${uclibc_baselibs} /sbin/ldconfig \
81 ${libexecdir} ${datadir}/zoneinfo ${libdir}/locale"
82FILES_ldd = "${bindir}/ldd"
83FILES_uclibc-dev_append = "\
84 ${libdir}/lib*.so \
85 ${libdir}/*_nonshared.a \
86 ${libdir}/[S]*crt[1in].o \
87 ${libdir}/crtreloc*.o \
88 ${libdir}/lib*.a \
89 ${includedir}/*.h ${includedir}/*/*.h \
90 "
91FILES_uclibc-utils = "${bindir} ${sbindir}"
92FILES_uclibc-utils-dbg += "${bindir}/.debug ${sbindir}/.debug"
93FILES_uclibc-gconv = "${libdir}/gconv"
94FILES_uclibc-thread-db = "${base_libdir}/libthread_db*"
95FILES_uclibc-argp = "${base_libdir}/libuargp-*.so ${base_libdir}/libuargp*.so.*"
96FILES_uclibc-backtrace = "${base_libdir}/libubacktrace-*.so ${base_libdir}/libubacktrace*.so.*"
97
98RPROVIDES_uclibc-dev += "libc-dev virtual-libc-dev"
99# uclibc does not really have libsegfault but then using the one from glibc is also not
100# going to work. So we pretend that we have it to make bitbake not pull other recipes
101# to satisfy this dependency for the images/tasks
102RPROVIDES_${PN} += "libsegfault"
103
104SRC_URI = "\
105 http://www.uclibc.org/downloads/uClibc-${PV}.tar.bz2;name=uClibc-${PV} \
106 "
107
108# do_stage barfs on a CC with whitespace, therefore put the 'HOST_CC_ARCH' in
109# the CFLAGS (when building the utils).
110OEMAKE_NO_CC = "'STRIPTOOL=true' 'LD=${LD}'"
111EXTRA_OEMAKE = "${OEMAKE_NO_CC} \
112 'HOSTCC=${BUILD_CC}' \
113 'HOST_CFLAGS=${BUILD_CFLAGS}' \
114 'CC=${CC}' \
115 ARCH=${UCLIBC_ARCH}"
116
117EXTRA_OEMAKE_task_do_package = "${OEMAKE_NO_CC}"
118
119# enable verbose output:
120export V="2"
121
122# -O<n> -fno-omit-frame-pointer ends up with GCC ICE on thumb as reported
123# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44860
124#
125CFLAGS_arm := "${@oe_filter_out('-fno-omit-frame-pointer', '${CFLAGS}', d)}"
126UCLIBC_EXTRA_CFLAGS := "${@oe_filter_out('(-I\S+|-i\S+)', '${CFLAGS}', d)}"
127UCLIBC_EXTRA_LDFLAGS := "${@oe_filter_out('(-L\S+|-l\S+)', '${LDFLAGS}', d)}"
128do_compile_prepend () {
129 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
130}
131
132configmangle = '/^KERNEL_HEADERS/d; \
133 /^RUNTIME_PREFIX/d; \
134 /^DEVEL_PREFIX/d; \
135 /^SHARED_LIB_LOADER_PREFIX/d; \
136 /^UCLIBC_EXTRA_CFLAGS/d; \
137 s,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g; \
138 ${@["","s,.*UCLIBC_HAS_LOCALE.*,UCLIBC_HAS_LOCALE=y,;"][bb.data.getVar("USE_NLS", d, 1) == "yes"]} \
139 ${@["","s,.*LDSO_GNU_HASH_SUPPORT.*,# LDSO_GNU_HASH_SUPPORT is not set,;"][bb.data.getVar("TARGET_ARCH", d, 1) in ['mips', 'mipsel', 'mips64', 'mips64el', 'avr32']]} \
140 /^CROSS/d; \
141 /^TARGET_ARCH=/d; \
142 /^TARGET_/s,^\([^=]*\).*,# \1 is not set,g; \
143 s,^DOSTRIP.*,# DOSTRIP is not set,g; \
144 /_[EO]*ABI/d; \
145 /HAS_FPU/d; \
146 '
147OE_FEATURES := "${@features_to_uclibc_conf(d)}"
148OE_DEL := "${@features_to_uclibc_del(d)}"
149python () {
150 if "${OE_DEL}":
151 bb.data.setVar('configmangle_append', "${OE_DEL}" + "\n", d)
152 if "${OE_FEATURES}":
153 bb.data.setVar('configmangle_append',
154 "/^### DISTRO FEATURES$/a\\\n%s\n\n" %
155 ("\\n".join((bb.data.expand("${OE_FEATURES}", d).split("\n")))),
156 d)
157 bb.data.setVar('configmangle_append',
158 "/^### CROSS$/a\\\n%s\n" %
159 ("\\n".join(["CROSS_COMPILER_PREFIX=\"${TARGET_PREFIX}\"",
160 "UCLIBC_EXTRA_CFLAGS=\"${UCLIBC_EXTRA_CFLAGS}\"",
161 "KERNEL_HEADERS=\"${STAGING_INCDIR}\"",
162 "RUNTIME_PREFIX=\"/\"",
163 "DEVEL_PREFIX=\"/${prefix}\"",
164 "SHARED_LIB_LOADER_PREFIX=\"/lib\"",
165 ])
166 ),
167 d)
168 bb.data.setVar('configmangle_append',
169 "/^### TGT$/a\\\nTARGET_ARCH=\"%s\"\\nTARGET_%s=y\n" %
170 ("${UCLIBC_ARCH}", "${UCLIBC_ARCH}"),
171 d)
172 bb.data.setVar('configmangle_append',
173 "/^### FPU$/a\\\n%s\n\n" % (["UCLIBC_HAS_FPU=y","# UCLIBC_HAS_FPU is not set"][bb.data.getVar('TARGET_FPU', d, 1) in [ 'soft' ]]), d)
174 if "${UCLIBC_ENDIAN}":
175 bb.data.setVar('configmangle_append',
176 "/^### ABI$/a\\\nARCH_%s_ENDIAN=y\n\n" % ("${UCLIBC_ENDIAN}"),
177 d)
178 if "${UCLIBC_ABI}":
179 bb.data.setVar('configmangle_append',
180 "/^### ABI$/a\\\nCONFIG_%s=y\n\n" % ("${UCLIBC_ABI}"),
181 d)
182}
183
184do_patch_append() {
185 os.system("ln -sf ${STAGING_INCDIR}/linux ${S}/include/linux")
186 os.system("ln -sf ${STAGING_INCDIR}/asm ${S}/include/asm")
187}
188
189do_configure() {
190 rm -f ${S}/.config
191
192 # OpenEmbedded splits the uClibc.config in two parts:
193 # uClibc.machine, uClibc.distro
194 echo "### uClibc.machine ###" >${S}/merged.config
195 cat ${WORKDIR}/uClibc.machine >>${S}/merged.config
196 echo "### uClibc.distro ###" >>${S}/merged.config
197 cat ${WORKDIR}/uClibc.distro >>${S}/merged.config
198 echo "### CROSS" >>${S}/merged.config
199 echo "### TGT" >>${S}/merged.config
200 echo "### MMU" >>${S}/merged.config
201 echo "### FPU" >>${S}/merged.config
202 echo "### ABI" >>${S}/merged.config
203 echo "### DISTRO FEATURES" >>${S}/merged.config
204 cp ${S}/merged.config ${S}/.config
205
206 # Mangle the resulting .config depending on OE variables
207 sed -i -e '${configmangle}' ${S}/.config
208
209 oe_runmake oldconfig
210}
211
212do_install() {
213 oe_runmake PREFIX=${D} install
214 oe_runmake PREFIX=${D} "SSP_ALL_CFLAGS=${TARGET_LINK_HASH_STYLE}" install_utils
215}
diff --git a/meta-oe/recipes-core/uclibc/uclibc_git.bb b/meta-oe/recipes-core/uclibc/uclibc_git.bb
deleted file mode 100644
index 18619cd40..000000000
--- a/meta-oe/recipes-core/uclibc/uclibc_git.bb
+++ /dev/null
@@ -1,31 +0,0 @@
1SRCREV="71d63ed75648da9b0b71afabb9c60aaad792c55c"
2
3require uclibc.inc
4PV = "0.9.31+0.9.32rc3"
5PR = "${INC_PR}.1"
6PROVIDES += "virtual/${TARGET_PREFIX}libc-for-gcc"
7
8#recent versions uclibc require real kernel headers
9PACKAGE_ARCH = "${MACHINE_ARCH}"
10FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/uclibc-git' ], d)}"
11
12SRC_URI = "git://uclibc.org/uClibc.git;branch=master;protocol=git \
13 file://uClibc.config \
14 file://uClibc.machine \
15 file://uClibc.distro \
16 file://uclibc-arm-ftruncate64.patch \
17 file://uclibc_enable_log2_test.patch \
18 file://ldso_use_arm_dl_linux_resolve_in_thumb_mode.patch \
19 file://reorder-use-BX.patch \
20 file://select-force-thumb.patch \
21 file://remove-sub-arch-variants.patch \
22 file://transform-eabi-oabi-choice.patch \
23 file://include-arm-asm.h.patch \
24 file://detect-bx-availibility.patch \
25 file://remove-eabi-oabi-selection.patch \
26 file://powerpc_copysignl.patch \
27 file://argp-support.patch \
28 file://argp-headers.patch \
29 file://remove_attribute_optimize_Os.patch \
30 "
31S = "${WORKDIR}/git"