forked from osmocom/wireshark
Check for getopt_long(), not getopt().
We support three types of platforms: 1) UN*Xes that have both getopt() and getopt_long(); 2) UN*Xes that have getopt() but not getopt_long(); 3) Windows, which has neither. Checking for getopt_long() lets us distinguish between 1) and 2) and build getopt_long() for them. Change-Id: Iaf0f142f9bebaa2eed2128d544ec9786711def45 Reviewed-on: https://code.wireshark.org/review/6045 Reviewed-by: Guy Harris <guy@alum.mit.edu>daniel/osmux
parent
b6f70ed3f8
commit
20503c7047
|
@ -77,7 +77,7 @@ cmake_pop_check_state()
|
|||
#
|
||||
check_symbol_exists("floorl" "math.h" HAVE_FLOORL)
|
||||
check_function_exists("gethostbyname2" HAVE_GETHOSTBYNAME2)
|
||||
check_function_exists("getopt" HAVE_GETOPT)
|
||||
check_function_exists("getopt_long" HAVE_GETOPT_LONG)
|
||||
check_function_exists("getprotobynumber" HAVE_GETPROTOBYNUMBER)
|
||||
check_function_exists("inet_aton" HAVE_INET_ATON)
|
||||
check_function_exists("inet_ntop" HAVE_INET_NTOP_PROTO)
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
#include <wsutil/wsgcrypt.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETOPT
|
||||
#ifndef HAVE_GETOPT_LONG
|
||||
#include "wsutil/wsgetopt.h"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
#include <wsutil/unicode-utils.h>
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#ifndef HAVE_GETOPT
|
||||
#ifndef HAVE_GETOPT_LONG
|
||||
#include "wsutil/wsgetopt.h"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -72,8 +72,8 @@
|
|||
/* Define to 1 if you have the `gethostbyname2' function. */
|
||||
#cmakedefine HAVE_GETHOSTBYNAME2 1
|
||||
|
||||
/* Define to 1 if you have the getopt function. */
|
||||
#cmakedefine HAVE_GETOPT 1
|
||||
/* Define to 1 if you have the getopt_long function. */
|
||||
#cmakedefine HAVE_GETOPT_LONG 1
|
||||
|
||||
/* Define to 1 if you have the <getopt.h> header file. */
|
||||
#cmakedefine HAVE_GETOPT_H 1
|
||||
|
|
|
@ -2665,10 +2665,10 @@ AC_C_BIGENDIAN
|
|||
# XXX - do we need this?
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
|
||||
AC_CHECK_FUNC(getopt,
|
||||
AC_CHECK_FUNC(getopt_long,
|
||||
[
|
||||
GETOPT_LO=""
|
||||
AC_DEFINE(HAVE_GETOPT, 1, [Define to 1 if you have the getopt function.])
|
||||
AC_DEFINE(HAVE_GETOPT_LONG, 1, [Define to 1 if you have the getopt_long function.])
|
||||
],
|
||||
GETOPT_LO="wsgetopt.lo")
|
||||
AC_SUBST(GETOPT_LO)
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
#include <wsutil/crash_info.h>
|
||||
#include <wsutil/ws_version_info.h>
|
||||
|
||||
#ifndef HAVE_GETOPT
|
||||
#ifndef HAVE_GETOPT_LONG
|
||||
#include "wsutil/wsgetopt.h"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
|
||||
#include "wtap.h"
|
||||
|
||||
#ifndef HAVE_GETOPT
|
||||
#ifndef HAVE_GETOPT_LONG
|
||||
#include "wsutil/wsgetopt.h"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
#include <string.h>
|
||||
#include "wtap.h"
|
||||
|
||||
#ifndef HAVE_GETOPT
|
||||
#ifndef HAVE_GETOPT_LONG
|
||||
#include <wsutil/wsgetopt.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETOPT
|
||||
#ifndef HAVE_GETOPT_LONG
|
||||
#include "wsutil/wsgetopt.h"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
# include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETOPT
|
||||
#ifndef HAVE_GETOPT_LONG
|
||||
#include "wsutil/wsgetopt.h"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
#include "wtap.h"
|
||||
|
||||
#ifndef HAVE_GETOPT
|
||||
#ifndef HAVE_GETOPT_LONG
|
||||
#include "wsutil/wsgetopt.h"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@
|
|||
#include <zlib.h> /* to get the libz version number */
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETOPT
|
||||
#ifndef HAVE_GETOPT_LONG
|
||||
#include "wsutil/wsgetopt.h"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
#include <zlib.h> /* to get the libz version number */
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETOPT
|
||||
#ifndef HAVE_GETOPT_LONG
|
||||
#include "wsutil/wsgetopt.h"
|
||||
#endif
|
||||
|
||||
|
|
2
tshark.c
2
tshark.c
|
@ -58,7 +58,7 @@
|
|||
# include <sys/capability.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETOPT
|
||||
#ifndef HAVE_GETOPT_LONG
|
||||
#include "wsutil/wsgetopt.h"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETOPT
|
||||
#ifndef HAVE_GETOPT_LONG
|
||||
#include "wsutil/wsgetopt.h"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -33,10 +33,12 @@
|
|||
#include <zlib.h> /* to get the libz version number */
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETOPT
|
||||
# include "wsutil/wsgetopt.h"
|
||||
#else
|
||||
# include <getopt.h>
|
||||
#ifdef HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETOPT_LONG
|
||||
#include "wsutil/wsgetopt.h"
|
||||
#endif
|
||||
|
||||
#include <wsutil/clopts_common.h>
|
||||
|
|
|
@ -85,7 +85,7 @@ if(HAVE_SSE4_2)
|
|||
set(WSUTIL_FILES ${WSUTIL_FILES} ws_mempbrk_sse42.c)
|
||||
endif()
|
||||
|
||||
if(NOT HAVE_GETOPT)
|
||||
if(NOT HAVE_GETOPT_LONG)
|
||||
set(WSUTIL_FILES ${WSUTIL_FILES} wsgetopt.c)
|
||||
endif()
|
||||
|
||||
|
|
Loading…
Reference in New Issue