Invert check for getopt: NEED_GETOPT_H -> HAVE_GETOPT_H

Rename getopt.[ch] -> wsgetopt.[ch] to avoid name collision.


git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@30370 f5534014-38df-0310-8fa8-9805f1628bb7
This commit is contained in:
stig 2009-10-06 16:01:18 +00:00
parent bce3c61126
commit 72676c1263
17 changed files with 71 additions and 64 deletions

View File

@ -1,5 +1,4 @@
# todo: result for NEED_... is wrong (inverted), at least
# in the case of getopt
# todo: result for NEED_... is wrong (inverted)
#check system for includes
include(CheckIncludeFile)
@ -9,7 +8,7 @@ check_include_file("direct.h" HAVE_DIRECT_H)
check_include_file("dirent.h" HAVE_DIRENT_H)
check_include_file("dlfcn.h" HAVE_DLFCN_H)
check_include_file("fcntl.h" HAVE_FCNTL_H)
check_include_file("getopt.h" NEED_GETOPT_H)
check_include_file("getopt.h" HAVE_GETOPT_H)
check_include_file("grp.h" HAVE_GRP_H)
check_include_file("g_ascii_strtoull.h" NEED_G_ASCII_STRTOULL_H)
check_include_file("inet/aton.h" NEED_INET_ATON_H)

View File

@ -122,7 +122,7 @@ TSHARK_TAP_SRC = \
# helpers already available on some platforms (and on others not)
EXTRA_wireshark_SOURCES = \
getopt.c \
wsgetopt.c \
inet_ntop.c \
inet_pton.c \
strerror.c \
@ -131,7 +131,7 @@ EXTRA_wireshark_SOURCES = \
# corresponding headers
EXTRA_wireshark_INCLUDES = \
getopt.h \
wsgetopt.h \
inet_v6defs.h \
strerror.h \
strptime.h

View File

@ -73,7 +73,7 @@ dumpcap_OBJECTS = $(dumpcap_SOURCES:.c=.obj)
randpkt_OBJECTS = $(randpkt_SOURCES:.c=.obj)
EXTRA_OBJECTS = \
getopt.obj \
wsgetopt.obj \
inet_ntop.obj \
inet_pton.obj \
strptime.obj
@ -244,28 +244,28 @@ $(RESOURCES): image
wiretap\wiretap-$(WTAP_VERSION).lib: image $(ZLIB_DLL) wiretap
wireshark.exe : $(LIBS_CHECK) config.h svnversion.h $(wireshark_OBJECTS) getopt.obj inet_ntop.obj inet_pton.obj codecs epan gtk image\wireshark.res wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib codecs\codecs.lib gtk\libui.lib plugins
wireshark.exe : $(LIBS_CHECK) config.h svnversion.h $(wireshark_OBJECTS) wsgetopt.obj inet_ntop.obj inet_pton.obj codecs epan gtk image\wireshark.res wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib codecs\codecs.lib gtk\libui.lib plugins
@echo Linking $@
$(LINK) @<<
/OUT:wireshark.exe $(guiflags) $(guilibsdll) $(LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:windows $(wireshark_LIBS) getopt.obj inet_ntop.obj inet_pton.obj $(GTK_LIBS) codecs\codecs.lib gtk\libui.lib $(wireshark_OBJECTS) image\wireshark.res
/OUT:wireshark.exe $(guiflags) $(guilibsdll) $(LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:windows $(wireshark_LIBS) wsgetopt.obj inet_ntop.obj inet_pton.obj $(GTK_LIBS) codecs\codecs.lib gtk\libui.lib $(wireshark_OBJECTS) image\wireshark.res
<<
!IF $(MSC_VER_REQUIRED) >= 1400
mt.exe -nologo -manifest "wireshark.exe.manifest" -outputresource:wireshark.exe;1
!ENDIF
tshark.exe : $(LIBS_CHECK) config.h svnversion.h $(tshark_OBJECTS) getopt.obj inet_ntop.obj epan image\tshark.res wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib plugins
tshark.exe : $(LIBS_CHECK) config.h svnversion.h $(tshark_OBJECTS) wsgetopt.obj inet_ntop.obj epan image\tshark.res wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib plugins
@echo Linking $@
$(LINK) @<<
/OUT:tshark.exe $(conflags) $(conlibsdll) $(LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console $(tshark_LIBS) $(tshark_OBJECTS) getopt.obj inet_ntop.obj image\tshark.res
/OUT:tshark.exe $(conflags) $(conlibsdll) $(LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console $(tshark_LIBS) $(tshark_OBJECTS) wsgetopt.obj inet_ntop.obj image\tshark.res
<<
!IF $(MSC_VER_REQUIRED) >= 1400
mt.exe -nologo -manifest "tshark.exe.manifest" -outputresource:tshark.exe;1
!ENDIF
rawshark.exe : $(LIBS_CHECK) config.h svnversion.h $(rawshark_OBJECTS) getopt.obj inet_ntop.obj epan image\rawshark.res wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib plugins
rawshark.exe : $(LIBS_CHECK) config.h svnversion.h $(rawshark_OBJECTS) wsgetopt.obj inet_ntop.obj epan image\rawshark.res wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib plugins
@echo Linking $@
$(LINK) @<<
/OUT:rawshark.exe $(conflags) $(conlibsdll) $(LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console $(rawshark_LIBS) $(rawshark_OBJECTS) getopt.obj inet_ntop.obj image\rawshark.res
/OUT:rawshark.exe $(conflags) $(conlibsdll) $(LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:console $(rawshark_LIBS) $(rawshark_OBJECTS) wsgetopt.obj inet_ntop.obj image\rawshark.res
<<
!IF $(MSC_VER_REQUIRED) >= 1400
mt.exe -nologo -manifest "rawshark.exe.manifest" -outputresource:rawshark.exe;1
@ -273,10 +273,10 @@ rawshark.exe : $(LIBS_CHECK) config.h svnversion.h $(rawshark_OBJECTS) getopt.ob
# XXX: This makefile does not properly handle doing a 'nmake ... capinfos.exe' directly since some of the .objs
# (e.g. epan\plugins.obj) must be built first using epan\Makefile.nmake (which happens for 'nmake ... all').
capinfos.exe : $(LIBS_CHECK) config.h $(capinfos_OBJECTS) getopt.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\capinfos.res
capinfos.exe : $(LIBS_CHECK) config.h $(capinfos_OBJECTS) wsgetopt.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\capinfos.res
@echo Linking $@
$(LINK) @<<
/OUT:capinfos.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(capinfos_OBJECTS) getopt.obj $(capinfos_LIBS) image\capinfos.res
/OUT:capinfos.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(capinfos_OBJECTS) wsgetopt.obj $(capinfos_LIBS) image\capinfos.res
<<
!IF $(MSC_VER_REQUIRED) >= 1400
mt.exe -nologo -manifest "capinfos.exe.manifest" -outputresource:capinfos.exe;1
@ -284,28 +284,28 @@ capinfos.exe : $(LIBS_CHECK) config.h $(capinfos_OBJECTS) getopt.obj wsutil\libw
# XXX: This makefile does not properly handle doing a 'nmake ... editcap.exe' directly since some of the .objs
# (e.g. epan\plugins.obj) must be built first using epan\Makefile.nmake (which happens for 'nmake ... all').
editcap.exe : $(LIBS_CHECK) config.h $(editcap_OBJECTS) getopt.obj strptime.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\editcap.res
editcap.exe : $(LIBS_CHECK) config.h $(editcap_OBJECTS) wsgetopt.obj strptime.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\editcap.res
@echo Linking $@
$(LINK) @<<
/OUT:editcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(editcap_OBJECTS) getopt.obj strptime.obj $(editcap_LIBS) image\editcap.res
/OUT:editcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(editcap_OBJECTS) wsgetopt.obj strptime.obj $(editcap_LIBS) image\editcap.res
<<
!IF $(MSC_VER_REQUIRED) >= 1400
mt.exe -nologo -manifest "editcap.exe.manifest" -outputresource:editcap.exe;1
!ENDIF
mergecap.exe : $(LIBS_CHECK) config.h svnversion.h mergecap.obj merge.obj getopt.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\mergecap.res
mergecap.exe : $(LIBS_CHECK) config.h svnversion.h mergecap.obj merge.obj wsgetopt.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\mergecap.res
@echo Linking $@
$(LINK) @<<
/OUT:mergecap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console mergecap.obj merge.obj getopt.obj $(mergecap_LIBS) image\mergecap.res
/OUT:mergecap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console mergecap.obj merge.obj wsgetopt.obj $(mergecap_LIBS) image\mergecap.res
<<
!IF $(MSC_VER_REQUIRED) >= 1400
mt.exe -nologo -manifest "mergecap.exe.manifest" -outputresource:mergecap.exe;1
!ENDIF
text2pcap.exe : $(LIBS_CHECK) config.h text2pcap.obj text2pcap-scanner.obj getopt.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib strptime.obj image\text2pcap.res
text2pcap.exe : $(LIBS_CHECK) config.h text2pcap.obj text2pcap-scanner.obj wsgetopt.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib strptime.obj image\text2pcap.res
@echo Linking $@
$(LINK) @<<
/OUT:text2pcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console text2pcap.obj text2pcap-scanner.obj getopt.obj $(text2pcap_LIBS) strptime.obj image\text2pcap.res
/OUT:text2pcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console text2pcap.obj text2pcap-scanner.obj wsgetopt.obj $(text2pcap_LIBS) strptime.obj image\text2pcap.res
<<
!IF $(MSC_VER_REQUIRED) >= 1400
mt.exe -nologo -manifest "text2pcap.exe.manifest" -outputresource:text2pcap.exe;1
@ -320,19 +320,19 @@ dftest.exe : $(dftest_OBJECTS) epan
mt.exe -nologo -manifest "dftest.exe.manifest" -outputresource:dftest.exe;1
!ENDIF
randpkt.exe : $(randpkt_OBJECTS) getopt.obj
randpkt.exe : $(randpkt_OBJECTS) wsgetopt.obj
@echo Linking $@
$(LINK) @<<
/OUT:randpkt.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(randpkt_LIBS) $(randpkt_OBJECTS) getopt.obj
/OUT:randpkt.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(randpkt_LIBS) $(randpkt_OBJECTS) wsgetopt.obj
<<
!IF $(MSC_VER_REQUIRED) >= 1400
mt.exe -nologo -manifest "randpkt.exe.manifest" -outputresource:randpkt.exe;1
!ENDIF
dumpcap.exe : $(LIBS_CHECK) config.h svnversion.h $(dumpcap_OBJECTS) getopt.obj inet_ntop.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\dumpcap.res
dumpcap.exe : $(LIBS_CHECK) config.h svnversion.h $(dumpcap_OBJECTS) wsgetopt.obj inet_ntop.obj wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib image\dumpcap.res
@echo Linking $@
$(LINK) @<<
/OUT:dumpcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(dumpcap_LIBS) $(dumpcap_OBJECTS) getopt.obj inet_ntop.obj image\dumpcap.res
/OUT:dumpcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(dumpcap_LIBS) $(dumpcap_OBJECTS) wsgetopt.obj inet_ntop.obj image\dumpcap.res
<<
!IF $(MSC_VER_REQUIRED) >= 1400
mt.exe -nologo -manifest "dumpcap.exe.manifest" -outputresource:dumpcap.exe;1

View File

@ -51,8 +51,10 @@
#include "wtap.h"
#include <wsutil/privileges.h>
#ifdef NEED_GETOPT_H
#include "getopt.h"
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#else
#include "wsgetopt.h"
#endif
static gboolean cap_file_type = FALSE; /* Do not report capture type */

View File

@ -39,6 +39,9 @@
/* Define to 1 if you have the <fcntl.h> header file. */
#cmakedefine HAVE_FCNTL_H 1
/* Define to 1 if you have the <getopt.h> header file. */
#cmakedefine HAVE_GETOPT_H 1
/* Define to 1 if you have the `chown' function. */
#cmakedefine HAVE_CHOWN 1
@ -276,9 +279,6 @@
/* Note: always defines PRI[doxu]64 macros so inttypes.h becomes useless.*/
#cmakedefine INTTYPES_H_DEFINES_FORMATS 1
/* Define if getopt.h needs to be included */
#cmakedefine NEED_GETOPT_H 1
/* Define if g_ascii_strtoull.h needs to be included */
#cmakedefine NEED_G_ASCII_STRTOULL_H 1

View File

@ -203,7 +203,6 @@
#define NEED_INET_ATON_H 1
#define NEED_INET_V6DEFS_H 1
#define NEED_GETOPT_H 1
#define NEED_STRPTIME_H 1
#ifndef WIN32

View File

@ -1421,13 +1421,15 @@ AC_PROG_GCC_TRADITIONAL
GETOPT_C=""
GETOPT_O=""
AC_CHECK_FUNC(getopt, GETOPT_O="",
[GETOPT_O="getopt.o"
AC_DEFINE(NEED_GETOPT_H, 1, [Define if getopt.h needs to be included])
])
AC_CHECK_FUNC(getopt,
[GETOPT_O=""
AC_DEFINE(HAVE_GETOPT_H, 1, [Define to 1 if you have the <getopt.h> header file.])
],
GETOPT_O="wsgetopt.o"
)
if test "$ac_cv_func_getopt" = no ; then
GETOPT_C="getopt.c"
GETOPT_O="getopt.o"
GETOPT_C="wsgetopt.c"
GETOPT_O="wsgetopt.o"
fi
AC_SUBST(GETOPT_C)
AC_SUBST(GETOPT_O)

View File

@ -51,8 +51,10 @@
#include <signal.h>
#include <errno.h>
#ifdef NEED_GETOPT_H
#include "getopt.h"
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#else
#include "wsgetopt.h"
#endif
#ifdef HAVE_NETDB_H
@ -2543,7 +2545,6 @@ int
main(int argc, char *argv[])
{
int opt;
extern char *optarg;
gboolean arg_error = FALSE;
#ifdef _WIN32

View File

@ -42,8 +42,10 @@
#include "wtap.h"
#ifdef NEED_GETOPT_H
#include "getopt.h"
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#else
#include "wsgetopt.h"
#endif
#ifdef _WIN32
@ -672,8 +674,6 @@ main(int argc, char *argv[])
wtap *wth;
int i, j, err;
gchar *err_info;
extern char *optarg;
extern int optind;
int opt;
char *p;
unsigned int snaplen = 0; /* No limit */

View File

@ -45,8 +45,10 @@
#include "strerror.h"
#endif
#ifdef NEED_GETOPT_H
#include "getopt.h"
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#else
#include "wsgetopt.h"
#endif
#ifdef _WIN32 /* Needed for console I/O */
@ -1816,7 +1818,6 @@ main(int argc, char *argv[])
char *init_progfile_dir_error;
char *s;
int opt;
extern char *optarg;
gboolean arg_error = FALSE;
extern int splash_register_freq; /* Found in about_dlg.c */

View File

@ -27,8 +27,10 @@
#include <string.h>
#include "wtap.h"
#ifdef NEED_GETOPT_H
#include "getopt.h"
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#else
#include "wsgetopt.h"
#endif
#include "svnversion.h"
@ -140,8 +142,6 @@ static void list_encap_types(void) {
int
main(int argc, char *argv[])
{
extern char *optarg;
extern int optind;
int opt;
gboolean do_append = FALSE;
gboolean verbose = FALSE;

View File

@ -27,8 +27,10 @@
#include "config.h"
#endif
#ifdef NEED_GETOPT_H
#include "getopt.h"
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#else
#include "wsgetopt.h"
#endif
#ifdef HAVE_UNISTD_H
@ -500,9 +502,6 @@ main(int argc, char **argv)
guint8 buffer[65536];
int opt;
extern char *optarg;
extern int optind;
int produce_count = 1000; /* number of pkts to produce */
int produce_type = PKT_ETHERNET;
char *produce_filename = NULL;

View File

@ -65,8 +65,10 @@
#include "strerror.h"
#endif
#ifdef NEED_GETOPT_H
#include "getopt.h"
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#else
#include "wsgetopt.h"
#endif
#include <glib.h>
@ -428,7 +430,6 @@ main(int argc, char *argv[])
{
char *init_progfile_dir_error;
int opt, i;
extern char *optarg;
gboolean arg_error = FALSE;
#ifdef _WIN32

View File

@ -125,8 +125,10 @@
#include <errno.h>
#include <assert.h>
#ifdef NEED_GETOPT_H
# include "getopt.h"
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#else
#include "wsgetopt.h"
#endif
#ifdef NEED_STRPTIME_H

View File

@ -55,8 +55,10 @@
#include "strerror.h"
#endif
#ifdef NEED_GETOPT_H
#include "getopt.h"
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#else
#include "wsgetopt.h"
#endif
#include <glib.h>
@ -733,7 +735,6 @@ main(int argc, char *argv[])
{
char *init_progfile_dir_error;
int opt;
extern char *optarg;
gboolean arg_error = FALSE;
#ifdef _WIN32

View File

@ -83,7 +83,7 @@
GNU application programs can use a third alternative mode in which
they can distinguish the relative order of options and other arguments. */
#include "getopt.h"
#include "wsgetopt.h"
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,