Check for getopt/getopt_long
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@6606 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
@@ -20,9 +20,12 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
#include <usb.h>
|
||||
|
||||
#ifdef HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
# undef _
|
||||
@@ -914,8 +917,12 @@ main(int argc, char ** argv)
|
||||
short force=0;
|
||||
uint16_t property=0;
|
||||
char* value=NULL;
|
||||
/* parse options */
|
||||
|
||||
/* parse options */
|
||||
#ifdef HAVE_GETOPT
|
||||
int option_index = 0,opt;
|
||||
char *optstr = "hlpfrs:D:B:v::";
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
static struct option loptions[] = {
|
||||
{"help",0,0,'h'},
|
||||
{"bus",1,0,'B'},
|
||||
@@ -930,9 +937,16 @@ main(int argc, char ** argv)
|
||||
{"verbose",2,0,'v'},
|
||||
{0,0,0,0}
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
while(1) {
|
||||
opt = getopt_long (argc, argv, "hlpfrs:D:B:v::", loptions, &option_index);
|
||||
#ifdef HAVE_GETOPT
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
opt = getopt_long (argc, argv, optstr, loptions, &option_index);
|
||||
#else
|
||||
opt = getopt (argc, argv, optstr);
|
||||
#endif
|
||||
if (opt==-1) break;
|
||||
|
||||
switch (opt) {
|
||||
|
||||
@@ -95,7 +95,7 @@ dnl Checks for header files.
|
||||
dnl ---------------------------------------------------------------------------
|
||||
AC_HEADER_DIRENT
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(unistd.h mcheck.h)
|
||||
AC_CHECK_HEADERS(getopt.h unistd.h mcheck.h)
|
||||
AC_INLINE
|
||||
AC_CONST
|
||||
|
||||
@@ -134,7 +134,7 @@ dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_TYPE_SIZE_T
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_CHECK_FUNCS(mkdir strdup strncpy strcpy snprintf sprintf vsnprintf)
|
||||
AC_CHECK_FUNCS([getopt getopt_long mkdir strdup strncpy strcpy snprintf sprintf vsnprintf])
|
||||
|
||||
dnl Find out how to get struct tm
|
||||
AC_STRUCT_TM
|
||||
|
||||
Reference in New Issue
Block a user