summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-12-26 14:37:31 -0800
committerGuy Harris <guy@alum.mit.edu>2014-12-27 02:10:58 +0000
commitcc1d20fdc9b9f9b8270e61e3164735c1cfba194a (patch)
tree6540eef3e50d54ee5291bc04b5c0c9bcee1831e6 /configure.ac
parentadce5fa31f01e7894465b42de98b9a7ee69c152a (diff)
downloadwireshark-cc1d20fdc9b9f9b8270e61e3164735c1cfba194a.tar.gz
Use getopt_long() for the first pass through the argument list.
That way: 1) we don't have to worry about the system getopt() and our getopt_long(), on platforms that have getopt() but not getopt_long() (Solaris prior to Solaris 10, HP-UX, AIX), not working well together; 2) if necessary, we can handle long options in the first pass. Switch to using getopt_long() for the *second* pass for the GTK+ version of Wireshark. Use the documented mechanism for resetting the argument parser for the glibc version of getopt_long(); use the mostly-undocumented-but-at-least- they-documented-optreset mechanism for the *BSD version. (We should look into doing only one pass, saving away arguments that can't fully be processed in the first pass for further processing after initializing libwireshark.) Change-Id: I891dcd33489abec5a56aae0dc9aad6758aadf97d Reviewed-on: https://code.wireshark.org/review/6066 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac24
1 files changed, 22 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 207d40990f..47c5870015 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2554,8 +2554,28 @@ AC_PROG_GCC_TRADITIONAL
GETOPT_LO=""
AC_CHECK_FUNC(getopt_long,
- [GETOPT_LO=""
- AC_DEFINE(HAVE_GETOPT_LONG, 1, [Define to 1 if you have the getopt_long function.])
+ [
+ GETOPT_LO=""
+ AC_DEFINE(HAVE_GETOPT_LONG, 1, [Define to 1 if you have the getopt_long function.])
+
+ #
+ # Do we have optreset?
+ #
+ AC_MSG_CHECKING(whether optreset is defined)
+ AC_TRY_LINK([],
+ [
+ extern int optreset;
+
+ return optreset;
+ ],
+ ac_cv_pcap_debug_defined=yes,
+ ac_cv_pcap_debug_defined=no)
+ if test "$ac_cv_pcap_debug_defined" = yes ; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_OPTRESET, 1, [Define to 1 if you have the optreset variable])
+ else
+ AC_MSG_RESULT(no)
+ fi
],
GETOPT_LO="wsgetopt.lo"
)