X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=include%2Fgetopt.h;h=583d4f6d054cd0e4acdb1d6fb9ba9c1d7a957fa1;hb=f16a9783c5f085443d806646074e9c06fdee9a88;hp=fb30719a8602a3b800bc55af73c39ab64ce4c6f6;hpb=5b64ad42d36e6d487e1f7287d37fbc243a178e72;p=deliverable%2Fbinutils-gdb.git diff --git a/include/getopt.h b/include/getopt.h index fb30719a86..583d4f6d05 100644 --- a/include/getopt.h +++ b/include/getopt.h @@ -1,5 +1,5 @@ /* Declarations for getopt. - Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc. + Copyright (C) 1989-2019 Free Software Foundation, Inc. NOTE: The canonical source of this file is maintained with the GNU C Library. Bugs can be reported to bug-glibc@gnu.org. @@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _GETOPT_H @@ -99,14 +99,24 @@ 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 !HAVE_DECL_GETOPT +#if defined (__GNU_LIBRARY__) || defined (HAVE_DECL_GETOPT) /* Many other libraries have conflicting prototypes for getopt, with - differences in the consts, in stdlib.h. To avoid compilation + differences in the consts, in unistd.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__ */ +#else +#ifndef __cplusplus extern int getopt (); -#endif /* __GNU_LIBRARY__ */ +#endif /* __cplusplus */ +#endif +#endif /* !HAVE_DECL_GETOPT */ + extern int getopt_long (int argc, char *const *argv, const char *shortopts, const struct option *longopts, int *longind); extern int getopt_long_only (int argc, char *const *argv,