configure: Check for getopt_long_only instead of getopt_long.

Some platforms have the latter but not the former.
This commit is contained in:
Alexandre Julliard 2012-11-08 00:04:13 +01:00
parent 3050f11f47
commit 551077ab73
5 changed files with 10 additions and 42 deletions

2
configure vendored
View File

@ -13017,7 +13017,7 @@ for ac_func in \
futimesat \
getattrlist \
getdirentries \
getopt_long \
getopt_long_only \
getpagesize \
getpwuid \
gettimeofday \

View File

@ -2019,7 +2019,7 @@ AC_CHECK_FUNCS(\
futimesat \
getattrlist \
getdirentries \
getopt_long \
getopt_long_only \
getpagesize \
getpwuid \
gettimeofday \

View File

@ -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

View File

@ -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,

View File

@ -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);
}