summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/kpathsea/ChangeLog10
-rw-r--r--Build/source/texk/kpathsea/c-unistd.h3
-rw-r--r--Build/source/texk/kpathsea/getopt.c14
-rw-r--r--Build/source/texk/kpathsea/getopt.h39
-rw-r--r--Build/source/utils/chktex/ChangeLog7
-rw-r--r--Build/source/utils/chktex/getopt.c14
-rw-r--r--Build/source/utils/chktex/getopt.h39
7 files changed, 54 insertions, 72 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog
index aadc7b9b3fa..261715995fb 100644
--- a/Build/source/texk/kpathsea/ChangeLog
+++ b/Build/source/texk/kpathsea/ChangeLog
@@ -1,3 +1,13 @@
+2012-03-01 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * c-unistd.h: Declare getopt() (via <kpathsea/getopt.h>) but
+ not getopt_long().
+
+ * getopt.h: With __need_getopt declare only getopt() but not
+ getopt_long() (with 'struct option').
+
+ * getopt.[ch]: Drop pre-ANSI C non-prototype declarations.
+
2012-02-27 Peter Breitenlohner <peb@mppmu.mpg.de>
* c-unistd.h [CYGWIN]: Explicitly #include <kpathsea/getopt.h>
diff --git a/Build/source/texk/kpathsea/c-unistd.h b/Build/source/texk/kpathsea/c-unistd.h
index 9447544bf64..a8c49ba09c1 100644
--- a/Build/source/texk/kpathsea/c-unistd.h
+++ b/Build/source/texk/kpathsea/c-unistd.h
@@ -24,9 +24,8 @@
#include <kpathsea/systypes.h>
#if HAVE_UNISTD_H
-#ifdef __CYGWIN__
+# define __need_getopt
#include <kpathsea/getopt.h>
-#endif
#include <unistd.h>
#endif
diff --git a/Build/source/texk/kpathsea/getopt.c b/Build/source/texk/kpathsea/getopt.c
index 2f6984e263d..d1fc9864de5 100644
--- a/Build/source/texk/kpathsea/getopt.c
+++ b/Build/source/texk/kpathsea/getopt.c
@@ -1,6 +1,6 @@
/* Getopt for GNU.
- Copyright 2008, 2009, 2010, 2011 Karl Berry.
+ Copyright 2008-2012 Karl Berry.
Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 2000, 2010
Free Software Foundation, Inc.
@@ -221,18 +221,6 @@ static char *my_index(const char *str, int chr)
return 0;
}
-/* If using GCC, we can safely declare strlen this way.
- If not using GCC, it is ok not to declare it. */
-#ifdef __GNUC__
-/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
- That was relevant to code that was here before. */
-#if !defined (__STDC__) || !__STDC__
-/* gcc with -traditional declares the built-in strlen to return int,
- and has done so at least since version 2.4.5. -- rms. */
-extern int strlen (const char *);
-#endif /* not __STDC__ */
-#endif /* __GNUC__ */
-
#endif /* not __GNU_LIBRARY__ */
/* Handle permutation of arguments. */
diff --git a/Build/source/texk/kpathsea/getopt.h b/Build/source/texk/kpathsea/getopt.h
index c9ca5e720a7..c899189bebc 100644
--- a/Build/source/texk/kpathsea/getopt.h
+++ b/Build/source/texk/kpathsea/getopt.h
@@ -22,7 +22,10 @@
along with this library; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _GETOPT_H
+
+#ifndef __need_getopt
#define _GETOPT_H 1
+#endif
#if defined (WIN32) && !defined (__MINGW32__) && !defined (NO_KPSE_DLL)
#define KPSE_DLL 1
@@ -75,6 +78,7 @@ extern KPSEDLL int opterr;
extern KPSEDLL int optopt;
+#ifndef __need_getopt
/* Describe the long-named options requested by the application.
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
of `struct option' terminated by an element containing a name which is
@@ -111,23 +115,21 @@ struct option
#define no_argument 0
#define required_argument 1
#define optional_argument 2
+#endif /* need getopt */
-#if defined (__CYGWIN__) && !defined ( __GETOPT_H__)
-#define __GETOPT_H__
-extern KPSEDLL int getopt (int argc, char *const *argv, const char *shortopts);
-#endif
-
-#if defined (__STDC__) && __STDC__
-#ifdef __GNU_LIBRARY__
+#if defined(__GNU_LIBRARY__) || defined (WIN32) || defined (__CYGWIN__)
/* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */
extern KPSEDLL int getopt (int argc, char *const *argv, const char *shortopts);
-#else /* not __GNU_LIBRARY__ */
-#if !defined (__cplusplus) && !defined (__CYGWIN__)
+#if defined (__MINGW32__) || defined (__CYGWIN__)
+#define __GETOPT_H__ /* Avoid that <unistd.h> redeclares the getopt API. */
+#endif
+#elif !defined (__cplusplus)
extern KPSEDLL int getopt ();
-#endif /* not __cplusplus and not __CYGWIN__ */
-#endif /* __GNU_LIBRARY__ */
+#endif
+
+#ifndef __need_getopt
extern KPSEDLL int getopt_long (int argc, char *const *argv, const char *shortopts,
const struct option *longopts, int *longind);
extern KPSEDLL int getopt_long_only (int argc, char *const *argv,
@@ -143,20 +145,13 @@ extern int _getopt_internal (int argc, char *const *argv,
int long_only);
#endif /* MAKE_KPSE_DLL || NO_KPSE_DLL */
-#else /* not __STDC__ */
-extern KPSEDLL int getopt ();
-extern KPSEDLL int getopt_long ();
-extern KPSEDLL int getopt_long_only ();
-
-#if defined (MAKE_KPSE_DLL) || defined (NO_KPSE_DLL) /* libkpathsea internal only */
-
-extern int _getopt_internal ();
-
-#endif /* MAKE_KPSE_DLL || NO_KPSE_DLL */
-#endif /* __STDC__ */
+#endif /* need getopt */
#ifdef __cplusplus
}
#endif
+/* Make sure we later can get all the definitions and declarations. */
+#undef __need_getopt
+
#endif /* _GETOPT_H */
diff --git a/Build/source/utils/chktex/ChangeLog b/Build/source/utils/chktex/ChangeLog
index f1740c8cc64..5b6b7b51981 100644
--- a/Build/source/utils/chktex/ChangeLog
+++ b/Build/source/utils/chktex/ChangeLog
@@ -1,3 +1,10 @@
+2012-03-01 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * getopt.h: With __need_getopt declare only getopt() but not
+ getopt_long() (with 'struct option').
+
+ * getopt.[ch]: Drop pre-ANSI C non-prototype declarations.
+
2012-02-27 Ken Brown <kbrow1i@gmail.com>
* getopt.h: Cygwin requires getopt() prototype.
diff --git a/Build/source/utils/chktex/getopt.c b/Build/source/utils/chktex/getopt.c
index 2f6984e263d..d1fc9864de5 100644
--- a/Build/source/utils/chktex/getopt.c
+++ b/Build/source/utils/chktex/getopt.c
@@ -1,6 +1,6 @@
/* Getopt for GNU.
- Copyright 2008, 2009, 2010, 2011 Karl Berry.
+ Copyright 2008-2012 Karl Berry.
Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 2000, 2010
Free Software Foundation, Inc.
@@ -221,18 +221,6 @@ static char *my_index(const char *str, int chr)
return 0;
}
-/* If using GCC, we can safely declare strlen this way.
- If not using GCC, it is ok not to declare it. */
-#ifdef __GNUC__
-/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
- That was relevant to code that was here before. */
-#if !defined (__STDC__) || !__STDC__
-/* gcc with -traditional declares the built-in strlen to return int,
- and has done so at least since version 2.4.5. -- rms. */
-extern int strlen (const char *);
-#endif /* not __STDC__ */
-#endif /* __GNUC__ */
-
#endif /* not __GNU_LIBRARY__ */
/* Handle permutation of arguments. */
diff --git a/Build/source/utils/chktex/getopt.h b/Build/source/utils/chktex/getopt.h
index c9ca5e720a7..c899189bebc 100644
--- a/Build/source/utils/chktex/getopt.h
+++ b/Build/source/utils/chktex/getopt.h
@@ -22,7 +22,10 @@
along with this library; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _GETOPT_H
+
+#ifndef __need_getopt
#define _GETOPT_H 1
+#endif
#if defined (WIN32) && !defined (__MINGW32__) && !defined (NO_KPSE_DLL)
#define KPSE_DLL 1
@@ -75,6 +78,7 @@ extern KPSEDLL int opterr;
extern KPSEDLL int optopt;
+#ifndef __need_getopt
/* Describe the long-named options requested by the application.
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
of `struct option' terminated by an element containing a name which is
@@ -111,23 +115,21 @@ struct option
#define no_argument 0
#define required_argument 1
#define optional_argument 2
+#endif /* need getopt */
-#if defined (__CYGWIN__) && !defined ( __GETOPT_H__)
-#define __GETOPT_H__
-extern KPSEDLL int getopt (int argc, char *const *argv, const char *shortopts);
-#endif
-
-#if defined (__STDC__) && __STDC__
-#ifdef __GNU_LIBRARY__
+#if defined(__GNU_LIBRARY__) || defined (WIN32) || defined (__CYGWIN__)
/* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */
extern KPSEDLL int getopt (int argc, char *const *argv, const char *shortopts);
-#else /* not __GNU_LIBRARY__ */
-#if !defined (__cplusplus) && !defined (__CYGWIN__)
+#if defined (__MINGW32__) || defined (__CYGWIN__)
+#define __GETOPT_H__ /* Avoid that <unistd.h> redeclares the getopt API. */
+#endif
+#elif !defined (__cplusplus)
extern KPSEDLL int getopt ();
-#endif /* not __cplusplus and not __CYGWIN__ */
-#endif /* __GNU_LIBRARY__ */
+#endif
+
+#ifndef __need_getopt
extern KPSEDLL int getopt_long (int argc, char *const *argv, const char *shortopts,
const struct option *longopts, int *longind);
extern KPSEDLL int getopt_long_only (int argc, char *const *argv,
@@ -143,20 +145,13 @@ extern int _getopt_internal (int argc, char *const *argv,
int long_only);
#endif /* MAKE_KPSE_DLL || NO_KPSE_DLL */
-#else /* not __STDC__ */
-extern KPSEDLL int getopt ();
-extern KPSEDLL int getopt_long ();
-extern KPSEDLL int getopt_long_only ();
-
-#if defined (MAKE_KPSE_DLL) || defined (NO_KPSE_DLL) /* libkpathsea internal only */
-
-extern int _getopt_internal ();
-
-#endif /* MAKE_KPSE_DLL || NO_KPSE_DLL */
-#endif /* __STDC__ */
+#endif /* need getopt */
#ifdef __cplusplus
}
#endif
+/* Make sure we later can get all the definitions and declarations. */
+#undef __need_getopt
+
#endif /* _GETOPT_H */