summaryrefslogtreecommitdiff
path: root/include/getopt.h
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-23 17:42:19 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-23 17:42:19 +0000
commit07c927cb9ef632d1c55c3a87d4c1e9e41ab299ef (patch)
tree2d8c701cdb99568d7922c37d21a7fda0f8ea9913 /include/getopt.h
parente8f79093d0b9c14a499799f2ee0d8479931e8b43 (diff)
downloadgcc-07c927cb9ef632d1c55c3a87d4c1e9e41ab299ef.tar.gz
include:
* getopt.h (getopt): Also check HAVE_DECL_* when prototyping. * libiberty.h (basename): Likewise. gcc: * aclocal.m4 (gcc_AC_CHECK_DECL, gcc_AC_CHECK_DECLS): New macros rewritten from the internals of gcc_AC_NEED_DECLARATION{S}. * configure.in (gcc_AC_CHECK_DECLS): Call this instead of gcc_AC_NEED_DECLARATIONS. * dwarfout.c: Don't prototype time(). * gcc.c: Check HAVE_DECL_* instead of NEED_DECLARATION_*. * system.h: Likewise. * toplev.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34108 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'include/getopt.h')
-rw-r--r--include/getopt.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/getopt.h b/include/getopt.h
index fb30719a860..9620fc70637 100644
--- a/include/getopt.h
+++ b/include/getopt.h
@@ -99,13 +99,20 @@ struct option
#define optional_argument 2
#if defined (__STDC__) && __STDC__
-#ifdef __GNU_LIBRARY__
+/* HAVE_DECL_* is a three-state macro: undefined, 0 or 1. If it is
+ undefined, we haven't run the autoconf check so provide the
+ declaration without arguments. If it is 0, we checked and failed
+ to find the declaration so provide a fully prototyped one. If it
+ is 1, we found it so don't provide any declaration at all. */
+#if defined (__GNU_LIBRARY__) || (defined (HAVE_DECL_GETOPT) && !HAVE_DECL_GETOPT)
/* 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 int getopt (int argc, char *const *argv, const char *shortopts);
#else /* not __GNU_LIBRARY__ */
+# if !defined (HAVE_DECL_GETOPT)
extern int getopt ();
+# endif
#endif /* __GNU_LIBRARY__ */
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
const struct option *longopts, int *longind);