getopt() can/should normally be found in unistd.h, so:

- When testing for getopt(), define that we HAVE_GETOPT instead of
  HAVE_GETOPT_H (to avoid confusion).
- Don't attempt to include getopt.h: not all OS's have it (for example,
  Solaris 9 does not).
- (All the places which need getopt already include unistd.h (if we have it).)

If this breaks things on some OS, we might need (a real) HAVE_GETOPT_H check.

svn path=/trunk/; revision=38437
This commit is contained in:
Jeff Morriss 2011-08-09 21:02:10 +00:00
parent a60d91018f
commit bf95c7b5e4
10 changed files with 13 additions and 31 deletions

View File

@ -88,9 +88,7 @@
#include <wsutil/file_util.h>
#endif
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#else
#ifndef HAVE_GETOPT
#include "wsutil/wsgetopt.h"
#endif

View File

@ -1742,7 +1742,7 @@ AC_PROG_GCC_TRADITIONAL
GETOPT_LO=""
AC_CHECK_FUNC(getopt,
[GETOPT_LO=""
AC_DEFINE(HAVE_GETOPT_H, 1, [Define to 1 if you have the <getopt.h> header file.])
AC_DEFINE(HAVE_GETOPT, 1, [Define to 1 if you have the getopt function.])
],
GETOPT_LO="wsgetopt.lo"
)

View File

@ -59,9 +59,7 @@
#include <signal.h>
#include <errno.h>
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#else
#ifndef HAVE_GETOPT
#include "wsutil/wsgetopt.h"
#endif

View File

@ -42,9 +42,7 @@
#include "wtap.h"
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#else
#ifndef HAVE_GETOPT
#include "wsutil/wsgetopt.h"
#endif

View File

@ -45,9 +45,7 @@
#include <unistd.h>
#endif
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#else
#ifndef HAVE_GETOPT
#include "wsutil/wsgetopt.h"
#endif

View File

@ -27,9 +27,7 @@
#include <string.h>
#include "wtap.h"
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#else
#ifndef HAVE_GETOPT
#include "wsutil/wsgetopt.h"
#endif

View File

@ -27,16 +27,14 @@
#include "config.h"
#endif
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#else
#include "wsutil/wsgetopt.h"
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifndef HAVE_GETOPT
#include "wsutil/wsgetopt.h"
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif

View File

@ -61,9 +61,7 @@
# include <sys/stat.h>
#endif
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#else
#ifndef HAVE_GETOPT
#include "wsutil/wsgetopt.h"
#endif

View File

@ -125,9 +125,7 @@
#include <errno.h>
#include <assert.h>
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#else
#ifndef HAVE_GETOPT
#include "wsutil/wsgetopt.h"
#endif

View File

@ -51,9 +51,7 @@
# include <sys/stat.h>
#endif
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#else
#ifndef HAVE_GETOPT
#include "wsutil/wsgetopt.h"
#endif