changeset 12118:ef31ab094483

getopt: avoid clash with FreeBSD _getopt_internal * lib/getopt.in.h (_getopt_internal): Override the name. * lib/getopt_int.h (includes): Pick up any overrides. Reported by Reuben Thomas. Signed-off-by: Eric Blake <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Mon, 05 Oct 2009 14:34:25 -0600
parents fa148b84c9fd
children 05827892a9c4
files ChangeLog lib/getopt.in.h lib/getopt_int.h
diffstat 3 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2009-10-05  Eric Blake  <ebb9@byu.net>
 
+	getopt: avoid clash with FreeBSD _getopt_internal
+	* lib/getopt.in.h (_getopt_internal): Override the name.
+	* lib/getopt_int.h (includes): Pick up any overrides.
+	Reported by Reuben Thomas.
+
 	hash: allow C89 compilation
 	* lib/hash.c (check_tuning): Move declaration before statement.
 	Reported by Reuben Thomas.
--- a/lib/getopt.in.h
+++ b/lib/getopt.in.h
@@ -68,6 +68,7 @@
 # define optind __GETOPT_ID (optind)
 # define optopt __GETOPT_ID (optopt)
 # define option __GETOPT_ID (option)
+# define _getopt_internal __GETOPT_ID (getopt_internal)
 #endif
 
 /* Standalone applications get correct prototypes for getopt_long and
--- a/lib/getopt_int.h
+++ b/lib/getopt_int.h
@@ -1,5 +1,5 @@
 /* Internal declarations for getopt.
-   Copyright (C) 1989-1994,1996-1999,2001,2003,2004
+   Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2009
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -19,6 +19,8 @@
 #ifndef _GETOPT_INT_H
 #define _GETOPT_INT_H	1
 
+#include <getopt.h>
+
 extern int _getopt_internal (int ___argc, char **___argv,
 			     const char *__shortopts,
 		             const struct option *__longopts, int *__longind,