[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
getopt sync from gnulib
From: |
Paul Eggert |
Subject: |
getopt sync from gnulib |
Date: |
Thu, 19 Aug 2004 19:17:02 -0700 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
I installed this to sync the 'getopt' module from gnulib.
The biggest change is that lib/getopt.h got renamed to lib/getopt_.h,
so that the system <getopt.h> is used if it suffices.
Index: lib/ChangeLog
===================================================================
RCS file: /home/eggert/coreutils/cu/lib/ChangeLog,v
retrieving revision 1.817
diff -p -u -r1.817 ChangeLog
--- lib/ChangeLog 19 Aug 2004 20:07:22 -0000 1.817
+++ lib/ChangeLog 20 Aug 2004 02:05:18 -0000
@@ -1,3 +1,14 @@
+2004-08-19 Paul Eggert <address@hidden>
+
+ * getopt.c, getopt1.c: Sync from gnulib.
+ * getopt_.h: Renamed from getopt.h (this syncs from gnulib).
+ * Makefile.am (libfetish_a_SOURCES): Remove getopt.c, getopt.h,
+ getopt1.c, getopt_int.h.
+ (BUILT_SOURCES, EXTRA_DIST, all-local, $(lib_OBJECTS), getopt.h,
+ MOSTLYCLEANFILES): Add current gnulib snippet for getopt.
+ * .cppi-disable: Add getopt_.h, getopt_int.h.
+ * .cvsignore: Add getopt.h.
+
2004-08-18 Paul Eggert <address@hidden>
* userspec.c: Don't use <alloca.h>, so that we don't use alloca on
Index: lib/.cppi-disable
===================================================================
RCS file: /home/eggert/coreutils/cu/lib/.cppi-disable,v
retrieving revision 1.30
diff -p -u -r1.30 .cppi-disable
--- lib/.cppi-disable 5 Aug 2004 23:01:05 -0000 1.30
+++ lib/.cppi-disable 20 Aug 2004 01:59:32 -0000
@@ -9,6 +9,8 @@ getndelim2.h
getopt.c
getopt.h
getopt1.c
+getopt_.h
+getopt_int.h
getpagesize.h
gettext.h
localcharset.h
Index: lib/.cvsignore
===================================================================
RCS file: /home/eggert/coreutils/cu/lib/.cvsignore,v
retrieving revision 1.24
diff -p -u -r1.24 .cvsignore
--- lib/.cvsignore 18 Aug 2004 20:48:50 -0000 1.24
+++ lib/.cvsignore 20 Aug 2004 02:04:08 -0000
@@ -4,6 +4,7 @@ alloca.h
charset.alias
getdate.c
getdate.tab.c
+getopt.h
fnmatch.h
fts.h
lstat.c
Index: lib/Makefile.am
===================================================================
RCS file: /home/eggert/coreutils/cu/lib/Makefile.am,v
retrieving revision 1.194
diff -p -u -r1.194 Makefile.am
--- lib/Makefile.am 10 Aug 2004 05:43:11 -0000 1.194
+++ lib/Makefile.am 19 Aug 2004 23:46:34 -0000
@@ -33,7 +33,6 @@ libfetish_a_SOURCES = \
posixtm.c posixtm.h \
posixver.c posixver.h \
strftime.c strftime.h \
- getopt.c getopt.h getopt1.c getopt_int.h \
hash.c hash.h \
hash-pjw.c hash-pjw.h \
__fpending.h \
@@ -239,3 +238,14 @@ fnmatch.h: fnmatch_.h
cp $(srcdir)/fnmatch_.h address@hidden
mv address@hidden $@
MOSTLYCLEANFILES += fnmatch.h fnmatch.h-t
+
+BUILT_SOURCES += $(GETOPT_H)
+EXTRA_DIST += getopt_.h getopt_int.h
+
+# We need the following in order to create an <getopt.h> when the system
+# doesn't have one that works with the given compiler.
+all-local $(lib_OBJECTS): $(GETOPT_H)
+getopt.h: getopt_.h
+ cp $(srcdir)/getopt_.h address@hidden
+ mv address@hidden $@
+MOSTLYCLEANFILES += getopt.h getopt.h-t
Index: lib/getopt.c
===================================================================
RCS file: /home/eggert/coreutils/cu/lib/getopt.c,v
retrieving revision 1.42
diff -p -u -r1.42 getopt.c
--- lib/getopt.c 23 Mar 2004 18:04:35 -0000 1.42
+++ lib/getopt.c 20 Aug 2004 01:59:56 -0000
@@ -3,7 +3,7 @@
"Keep this file name-space clean" means, talk to address@hidden
before changing it!
Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004
- Free Software Foundation, Inc.
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
@@ -32,25 +32,6 @@
#include <stdio.h>
-/* Comment out all this code if we are using the GNU C Library, and are not
- actually compiling the library itself. This code is part of the GNU C
- Library, but also included in many other GNU distributions. Compiling
- and linking in this code is a waste when using the GNU C library
- (especially if it is a shared library). Rather than having every GNU
- program understand `configure --with-gnu-libc' and omit the object files,
- it is simpler to just do this in the source for each such file. */
-
-#define GETOPT_INTERFACE_VERSION 2
-#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
-# include <gnu-versions.h>
-# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
-# define ELIDE_CODE
-# endif
-#endif
-
-#ifndef ELIDE_CODE
-
-
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
#ifdef __GNU_LIBRARY__
@@ -1181,7 +1162,6 @@ getopt (int argc, char *const *argv, con
0);
}
-#endif /* Not ELIDE_CODE. */
#ifdef TEST
Index: lib/getopt1.c
===================================================================
RCS file: /home/eggert/coreutils/cu/lib/getopt1.c,v
retrieving revision 1.17
diff -p -u -r1.17 getopt1.c
--- lib/getopt1.c 23 Mar 2004 17:33:25 -0000 1.17
+++ lib/getopt1.c 19 Aug 2004 23:35:36 -0000
@@ -30,25 +30,6 @@
#include <stdio.h>
-/* Comment out all this code if we are using the GNU C Library, and are not
- actually compiling the library itself. This code is part of the GNU C
- Library, but also included in many other GNU distributions. Compiling
- and linking in this code is a waste when using the GNU C library
- (especially if it is a shared library). Rather than having every GNU
- program understand `configure --with-gnu-libc' and omit the object files,
- it is simpler to just do this in the source for each such file. */
-
-#define GETOPT_INTERFACE_VERSION 2
-#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
-#include <gnu-versions.h>
-#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
-#define ELIDE_CODE
-#endif
-#endif
-
-#ifndef ELIDE_CODE
-
-
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
#ifdef __GNU_LIBRARY__
@@ -96,7 +77,6 @@ _getopt_long_only_r (int argc, char *con
1, d);
}
-#endif /* Not ELIDE_CODE. */
#ifdef TEST
Index: lib/getopt_int.h
===================================================================
RCS file: /home/eggert/coreutils/cu/lib/getopt_int.h,v
retrieving revision 1.1
diff -p -u -r1.1 getopt_int.h
--- lib/getopt_int.h 23 Mar 2004 17:32:11 -0000 1.1
+++ lib/getopt_int.h 20 Aug 2004 02:00:04 -0000
@@ -18,7 +18,7 @@
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef _GETOPT_INT_H
-# define _GETOPT_INT_H 1
+#define _GETOPT_INT_H 1
extern int _getopt_internal (int ___argc, char *const *___argv,
const char *__shortopts,
@@ -100,7 +100,7 @@ struct _getopt_data
int __first_nonopt;
int __last_nonopt;
-# if defined _LIBC && defined USE_NONOPTION_FLAGS
+#if defined _LIBC && defined USE_NONOPTION_FLAGS
int __nonoption_flags_max_len;
int __nonoption_flags_len;
# endif
@@ -108,7 +108,7 @@ struct _getopt_data
/* The initializer is necessary to set OPTIND and OPTERR to their
default values and to clear the initialization flag. */
-# define _GETOPT_DATA_INITIALIZER { 1, 1 }
+#define _GETOPT_DATA_INITIALIZER { 1, 1 }
extern int _getopt_internal_r (int ___argc, char *const *___argv,
const char *__shortopts,
Index: m4/ChangeLog
===================================================================
RCS file: /home/eggert/coreutils/cu/m4/ChangeLog,v
retrieving revision 1.607
diff -p -u -r1.607 ChangeLog
--- m4/ChangeLog 11 Aug 2004 22:26:23 -0000 1.607
+++ m4/ChangeLog 19 Aug 2004 23:40:35 -0000
@@ -1,3 +1,7 @@
+2004-08-19 Paul Eggert <address@hidden>
+
+ * getopt.m4: Sync from gnulib.
+
2004-08-11 Paul Eggert <address@hidden>
* obstack.m4 (gl_PREREQ_OBSTACK): Require
Index: m4/getopt.m4
===================================================================
RCS file: /home/eggert/coreutils/cu/m4/getopt.m4,v
retrieving revision 1.2
diff -p -u -r1.2 getopt.m4
--- m4/getopt.m4 13 Sep 2003 06:32:47 -0000 1.2
+++ m4/getopt.m4 19 Aug 2004 23:34:54 -0000
@@ -1,13 +1,47 @@
-# getopt.m4 serial 2
-dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+# getopt.m4 serial 3
+dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
+# The getopt module assume you want GNU getopt, with getopt_long etc,
+# rather than vanilla POSIX getopt. This means your your code should
+# always include <getopt.h> for the getopt prototypes.
+
+AC_DEFUN([gl_GETOPT_SUBSTITUTE],
+[
+ GETOPT_H=getopt.h
+ AC_LIBOBJ([getopt])
+ AC_LIBOBJ([getopt1])
+ AC_DEFINE([optarg], [rpl_optarg],
+ [Define to rpl_optarg if the replacement variable should be used.])
+ AC_DEFINE([optind], [rpl_optind],
+ [Define to rpl_optind if the replacement variable should be used.])
+ AC_DEFINE([optopt], [rpl_optopt],
+ [Define to rpl_optopt if the replacement variable should be used.])
+ AC_DEFINE([getopt], [rpl_getopt],
+ [Define to rpl_getopt if the replacement function should be used.])
+ AC_DEFINE([getopt_long], [rpl_getopt_long],
+ [Define to rpl_getopt_long if the replacement function should be used.])
+ AC_DEFINE([getopt_long_only], [rpl_getopt_long_only],
+ [Define to rpl_getopt_long_only if the replacement function should be
used.])
+ AC_SUBST([GETOPT_H])
+])
+
AC_DEFUN([gl_GETOPT],
[
- dnl Prerequisites of lib/getopt.c.
- :
+ gl_PREREQ_GETOPT
+
+ GETOPT_H=
+ AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h])
+ AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h])
+
+ if test -n "$GETOPT_H"; then
+ gl_GETOPT_SUBSTITUTE
+ fi
])
+
+# Prerequisites of lib/getopt*.
+AC_DEFUN([gl_PREREQ_GETOPT], [:])
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- getopt sync from gnulib,
Paul Eggert <=