Alexandre Julliard : configure: Check for getopt_long_only instead of getopt_long.

Alexandre Julliard julliard at winehq.org
Thu Nov 8 15:39:54 CST 2012


Module: wine
Branch: master
Commit: 551077ab73ae0ff5ae8d92a5a0264787230813fb
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=551077ab73ae0ff5ae8d92a5a0264787230813fb

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Nov  8 00:04:13 2012 +0100

configure: Check for getopt_long_only instead of getopt_long.

Some platforms have the latter but not the former.

---

 configure           |    2 +-
 configure.ac        |    2 +-
 include/config.h.in |    4 ++--
 libs/port/getopt.c  |   28 +++-------------------------
 libs/port/getopt1.c |   16 +++-------------
 5 files changed, 10 insertions(+), 42 deletions(-)

diff --git a/configure b/configure
index bc31918..4f020cf 100755
--- a/configure
+++ b/configure
@@ -13017,7 +13017,7 @@ for ac_func in \
 	futimesat \
 	getattrlist \
 	getdirentries \
-	getopt_long \
+	getopt_long_only \
 	getpagesize \
 	getpwuid \
 	gettimeofday \
diff --git a/configure.ac b/configure.ac
index 1adb6fd..b1e479d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2019,7 +2019,7 @@ AC_CHECK_FUNCS(\
 	futimesat \
 	getattrlist \
 	getdirentries \
-	getopt_long \
+	getopt_long_only \
 	getpagesize \
 	getpwuid \
 	gettimeofday \
diff --git a/include/config.h.in b/include/config.h.in
index 8dc812b..6822052 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -206,8 +206,8 @@
 /* Define to 1 if you have the <getopt.h> header file. */
 #undef HAVE_GETOPT_H
 
-/* Define to 1 if you have the `getopt_long' function. */
-#undef HAVE_GETOPT_LONG
+/* Define to 1 if you have the `getopt_long_only' function. */
+#undef HAVE_GETOPT_LONG_ONLY
 
 /* Define to 1 if you have the `getpagesize' function. */
 #undef HAVE_GETPAGESIZE
diff --git a/libs/port/getopt.c b/libs/port/getopt.c
index eeb64a6..e38d137 100644
--- a/libs/port/getopt.c
+++ b/libs/port/getopt.c
@@ -33,7 +33,7 @@
 # include <config.h>
 #endif
 
-#ifdef HAVE_GETOPT_LONG
+#ifdef HAVE_GETOPT_LONG_ONLY
 #define ELIDE_CODE
 #endif
 
@@ -218,26 +218,7 @@ static char *posixly_correct;
 #  include <strings.h>
 # endif
 
-/* Avoid depending on library functions or files
-   whose names are inconsistent.  */
-
-#ifndef getenv
-extern char *getenv ();
-#endif
-
-static char *
-my_index (str, chr)
-     const char *str;
-     int chr;
-{
-  while (*str)
-    {
-      if (*str == chr)
-	return (char *) str;
-      str++;
-    }
-  return 0;
-}
+# define my_index strchr
 
 /* If using GCC, we can safely declare strlen this way.
    If not using GCC, it is ok not to declare it.  */
@@ -1196,10 +1177,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
 }
 
 int
-getopt (argc, argv, optstring)
-     int argc;
-     char *const *argv;
-     const char *optstring;
+getopt (int argc, char * const *argv, const char *optstring)
 {
   return _getopt_internal (argc, argv, optstring,
 			   NULL,
diff --git a/libs/port/getopt1.c b/libs/port/getopt1.c
index 37249b6..5cf9f01 100644
--- a/libs/port/getopt1.c
+++ b/libs/port/getopt1.c
@@ -24,7 +24,7 @@
 #include <config.h>
 #endif
 
-#ifdef HAVE_GETOPT_LONG
+#ifdef HAVE_GETOPT_LONG_ONLY
 #define ELIDE_CODE
 #endif
 
@@ -74,12 +74,7 @@
 #endif
 
 int
-getopt_long (argc, argv, options, long_options, opt_index)
-     int argc;
-     char *const *argv;
-     const char *options;
-     const struct option *long_options;
-     int *opt_index;
+getopt_long (int argc, char * const *argv, const char *options, const struct option *long_options, int *opt_index)
 {
   return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
 }
@@ -90,12 +85,7 @@ getopt_long (argc, argv, options, long_options, opt_index)
    instead.  */
 
 int
-getopt_long_only (argc, argv, options, long_options, opt_index)
-     int argc;
-     char *const *argv;
-     const char *options;
-     const struct option *long_options;
-     int *opt_index;
+getopt_long_only (int argc, char * const *argv, const char *options, const struct option *long_options, int *opt_index)
 {
   return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
 }




More information about the wine-cvs mailing list