summaryrefslogtreecommitdiff
path: root/Build/source/texk/kpathsea/getopt.h
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2012-03-01 09:05:59 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2012-03-01 09:05:59 +0000
commitb4b997286ed025b673f3ba4698d0075952cc7896 (patch)
tree43ef3fb43263e6c2d4c0db62d588eb59d1a6c66a /Build/source/texk/kpathsea/getopt.h
parenta15743669eec9a2ab5c7c49ffead9fa786103502 (diff)
getopt
git-svn-id: svn://tug.org/texlive/trunk@25547 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/kpathsea/getopt.h')
-rw-r--r--Build/source/texk/kpathsea/getopt.h39
1 files changed, 17 insertions, 22 deletions
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 */