Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5608 :
authormorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 9 Aug 2011 21:02:10 +0000 (21:02 +0000)
committermorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>
Tue, 9 Aug 2011 21:02:10 +0000 (21:02 +0000)
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.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@38437 f5534014-38df-0310-8fa8-9805f1628bb7

capinfos.c
configure.in
dumpcap.c
editcap.c
gtk/main.c
mergecap.c
randpkt.c
rawshark.c
text2pcap.c
tshark.c

index 36c1dccf093940cd1bd844f762c0b42d28a41a59..831f48120e165e4e2173ea54b786a4d3f105dcd8 100644 (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
 
index 5ba873fadc6c614ce32285db2fa923e82fa2f511..d59ff6f7d2c1e8cb9febd72f4b3198a5a4094f6b 100644 (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"
 )
index 319c419507b68462ba83ec052fabef470e4c702d..71e3a6cec8128cf0fe841826429644096239e1cb 100644 (file)
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -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
 
index 517e94d23bbb06e2848eee31f7824d0d48a6e7ca..e74946ec822a5627091d3aca1d34cf0d349a7f40 100644 (file)
--- a/editcap.c
+++ b/editcap.c
@@ -42,9 +42,7 @@
 
 #include "wtap.h"
 
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#else
+#ifndef HAVE_GETOPT
 #include "wsutil/wsgetopt.h"
 #endif
 
index a936329e50fb042774f84f146f8cd2b118c196aa..5290829d40f2e9a55c6e1bf7cccf761f7e95aa70 100644 (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
 
index 70b4b58ff76d67cb1271ebd8a8257dff550437c7..99a9cf26f2d4c4151e29766d0d0910de735cfd20 100644 (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
 
index c1f58f0bf53d9af3343f9c34551c6afeb33111c4..b6a8c86a54d35affad6b7ce9c2e2ceb6a30b7976 100644 (file)
--- a/randpkt.c
+++ b/randpkt.c
 #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
index df30037b8995ac76c1183e7b47a3516d9fd0f0d6..ce0e2323394428677ede85ba78abddf6024b974b 100644 (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
 
index daf1dacece82c6683efeb3a3240d7cc464cc20c1..c2d5f7f532c34715bd1236eeee7085b2c8ef9bf7 100644 (file)
 #include <errno.h>
 #include <assert.h>
 
-#ifdef HAVE_GETOPT_H
-#include <getopt.h>
-#else
+#ifndef HAVE_GETOPT
 #include "wsutil/wsgetopt.h"
 #endif
 
index 473a6898ec890f43f272873fcf2f93298fd97096..af1b2560266e2f5d2455920b3bde07365ae1a329 100644 (file)
--- a/tshark.c
+++ b/tshark.c
@@ -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