check_include_file("fcntl.h" HAVE_FCNTL_H)
check_include_file("getopt.h" HAVE_GETOPT_H)
check_include_file("grp.h" HAVE_GRP_H)
-check_include_file("inet/aton.h" HAVE_INET_ATON_H)
check_include_file("inttypes.h" HAVE_INTTYPES_H)
check_include_file("memory.h" HAVE_MEMORY_H)
check_include_file("netinet/in.h" HAVE_NETINET_IN_H)
check_function_exists("gethostbyname2" HAVE_GETHOSTBYNAME2)
check_function_exists("getopt" HAVE_GETOPT)
check_function_exists("getprotobynumber" HAVE_GETPROTOBYNUMBER)
+check_function_exists("inet_aton" HAVE_INET_ATON)
check_function_exists("inet_ntop" HAVE_INET_NTOP_PROTO)
check_function_exists("issetugid" HAVE_ISSETUGID)
check_function_exists("mmap" HAVE_MMAP)
check_function_exists("mkstemp" HAVE_MKSTEMP)
check_function_exists("setresgid" HAVE_SETRESGID)
check_function_exists("setresuid" HAVE_SETRESUID)
+
+#
+# Windows doesn't have strncasecmp, but does have stricmp, which has
+# the same signature and behavior. We #define strncasecmp to stricmp
+# on Windows.
+#
+if(WIN32)
+ check_function_exists("stricmp" HAVE_STRNCASECMP)
+else()
+ check_function_exists("strncasecmp" HAVE_STRNCASECMP)
+endif()
+check_function_exists("strptime" HAVE_STRPTIME)
check_function_exists("sysconf" HAVE_SYSCONF)
#Struct members
/* Define to have ntddndis.h */
@HAVE_NTDDNDIS_H@
-/* #undef HAVE_INET_ATON_H */
+/* Define to 1 if you have the strncasecmp function. */
+/* Actually, we don't, but we have strnicmp, and #define strncasecmp to strnicmp below */
+#define HAVE_STRNCASECMP 1
+
+/* Define if you have the strptime function. */
+/* #undef HAVE_STRPTIME 1 */
+
#define NEED_INET_V6DEFS_H 1
-#define NEED_STRPTIME_H 1
#ifndef WIN32
#define WIN32 1
# XXX - do we need this?
AC_PROG_GCC_TRADITIONAL
-GETOPT_LO=""
AC_CHECK_FUNC(getopt,
- [GETOPT_LO=""
- AC_DEFINE(HAVE_GETOPT, 1, [Define to 1 if you have the getopt function.])
+ [
+ GETOPT_LO=""
+ AC_DEFINE(HAVE_GETOPT, 1, [Define to 1 if you have the getopt function.])
],
- GETOPT_LO="wsgetopt.lo"
-)
-if test "$ac_cv_func_getopt" = no ; then
- GETOPT_LO="wsgetopt.lo"
-fi
-AM_CONDITIONAL(NEED_GETOPT_LO, test "x$ac_cv_func_getopt" = "xno")
+ GETOPT_LO="wsgetopt.lo")
AC_SUBST(GETOPT_LO)
-AC_CHECK_FUNC(strncasecmp, STRNCASECMP_LO="",
+AC_CHECK_FUNC(strncasecmp,
+ [
+ STRNCASECMP_LO=""
+ AC_DEFINE(HAVE_STRNCASECMP, 1, [Define to 1 if you have the strncasecmp function.])
+ ],
STRNCASECMP_LO="strncasecmp.lo")
-if test "$ac_cv_func_strncasecmp" = no ; then
- STRNCASECMP_LO="strncasecmp.lo"
-fi
-AM_CONDITIONAL(NEED_STRNCASECMP_LO, test "x$ac_cv_func_strncasecmp" = "xno")
AC_SUBST(STRNCASECMP_LO)
AC_CHECK_FUNCS(mkstemp mkdtemp)
-AC_SEARCH_LIBS(inet_aton, [socket nsl], have_inet_aton=yes,
- have_inet_aton=no)
-if test "$have_inet_aton" = no; then
- INET_ATON_LO="inet_aton.lo"
- AC_DEFINE(HAVE_INET_ATON_H, 0, [Define unless inet/aton.h needs to be included])
-else
- INET_ATON_LO=""
-fi
-AM_CONDITIONAL(NEED_INET_ATON_LO, test "x$have_inet_aton" = "xno")
+AC_SEARCH_LIBS(inet_aton, [socket nsl],
+ [
+ INET_ATON_LO=""
+ AC_DEFINE(HAVE_INET_ATON, 0, [Define to 1 if you have the inet_aton function.])
+ ],
+ INET_ATON_LO="inet_aton.lo")
AC_SUBST(INET_ATON_LO)
AC_SEARCH_LIBS(inet_pton, [socket nsl], [
AM_CONDITIONAL(NEED_INET_NTOP_LO, test "x$INET_NTOP_LO" != "x")
AC_SUBST(INET_NTOP_LO)
-AC_CHECK_FUNC(strptime, STRPTIME_LO="",
- [STRPTIME_LO="strptime.lo"
- AC_DEFINE(NEED_STRPTIME_H, 1, [Define if strptime.h needs to be included])
-])
-if test "$ac_cv_func_strptime" = no ; then
- STRPTIME_LO="strptime.lo"
-fi
-AC_SUBST(STRPTIME_C)
-AM_CONDITIONAL(NEED_STRPTIME_LO, test "x$ac_cv_func_strptime" = "no")
+AC_CHECK_FUNC(strptime,
+ [
+ STRPTIME_LO=""
+ AC_DEFINE(HAVE_STRPTIME, 1, [Define if you have the strptime function.])
+ ],
+ STRPTIME_LO="strptime.lo")
AC_SUBST(STRPTIME_LO)
AC_CHECK_FUNCS(getprotobynumber gethostbyname2)
#endif
#endif
-#ifdef NEED_STRPTIME_H
+#ifndef HAVE_STRPTIME
# include "wsutil/strptime.h"
#endif
#include <winsock2.h> /* needed to define AF_ values on Windows */
#endif
-#ifndef HAVE_INET_ATON_H
+#ifndef HAVE_INET_ATON
# include "wsutil/inet_aton.h"
#endif
#include <epan/exceptions.h>
#include <epan/wmem/wmem.h>
#include <epan/addr_resolv.h>
+#ifndef HAVE_INET_ATON
#include <wsutil/inet_aton.h>
+#endif
#include <epan/expert.h>
#include <epan/prefs.h>
#include <ctype.h>
#include <epan/value_string.h>
#include <epan/wmem/wmem.h>
#include <epan/to_str.h>
-#include <wsutil/inet_aton.h>
+#ifndef HAVE_INET_ATON
+ #include <wsutil/inet_aton.h>
+#endif
#include <wsutil/pint.h>
#include "packet-lbm.h"
#include "packet-lbtru.h"
#include <epan/tap.h>
#include <epan/conversation.h>
#include <epan/to_str.h>
-#include <wsutil/inet_aton.h>
+#ifndef HAVE_INET_ATON
+ #include <wsutil/inet_aton.h>
+#endif
#include <wsutil/pint.h>
#include "packet-lbm.h"
#include "packet-lbtrm.h"
#include <ftypes-int.h>
#include <epan/to_str.h>
-#ifdef NEED_STRPTIME_H
+#ifndef HAVE_STRPTIME
#include "wsutil/strptime.h"
#endif
* yet defined.
*/
#include <time.h>
-/*#ifdef NEED_STRPTIME_H*/
+/*#ifndef HAVE_STRPTIME*/
#ifndef strptime
#include "wsutil/strptime.h"
#endif
#include "wsutil/wsgetopt.h"
#endif
-#ifdef NEED_STRPTIME_H
+#ifndef HAVE_STRPTIME
# include "wsutil/strptime.h"
#endif
#include <winsock2.h> /* needed to define AF_ values on Windows */
#endif
-#ifndef HAVE_INET_ATON_H
+#ifndef HAVE_INET_ATON
# include "wsutil/inet_aton.h"
#endif
#include <wsutil/crc32.h>
#include <epan/in_cksum.h>
-#ifdef NEED_STRPTIME_H
+#ifndef HAVE_STRPTIME
# include "wsutil/strptime.h"
#endif
ACLOCAL_AMFLAGS = `../aclocal-flags`
# Optional objects that I know how to build. These will be
-# linked into libwsutil.
-wsutil_optional_objects =
-
-if NEED_GETOPT_LO
-wsutil_optional_objects += @GETOPT_LO@
-endif
-
-if NEED_INET_ATON_LO
-wsutil_optional_objects += @INET_ATON_LO@
-endif
-
-if NEED_INET_NTOP_LO
-wsutil_optional_objects += @INET_NTOP_LO@
-endif
-
-if NEED_INET_PTON_LO
-wsutil_optional_objects += @INET_PTON_LO@
-endif
-
-if NEED_STRNCASECMP_LO
-wsutil_optional_objects += @STRNCASECMP_LO@
-endif
-
-if NEED_STRPTIME_LO
-wsutil_optional_objects += @STRPTIME_LO@
-endif
+# linked into libwsutil if necessary.
+wsutil_optional_objects = \
+ @GETOPT_LO@ \
+ @INET_ATON_LO@ \
+ @INET_NTOP_LO@ \
+ @INET_PTON_LO@ \
+ @STRNCASECMP_LO@ \
+ @STRPTIME_LO@
if SSE42_SUPPORTED
wsutil_optional_objects += libwsutil_sse42.la
inet_pton.c \
inet_v6defs.h \
strncasecmp.c \
+ strncasecmp.h \
strptime.c \
strptime.h \
wsgetopt.c \
#include <string.h>
#include <ctype.h>
+#include "wsutil/strncasecmp.h"
+
/* Compare no more than N characters of S1 and S2,
ignoring case, returning less than, equal to or
greater than zero if S1 is lexicographically less
--- /dev/null
+/* strncasecmp.h
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __STRNCASECMP_H__
+#define __STRNCASECMP_H__
+
+#include "ws_symbol_export.h"
+
+/*
+ * Version of "strncasecmp()", for the benefit of OSes that don't have it.
+ */
+WS_DLL_PUBLIC int strncasecmp (const char *, const char *, size_t);
+
+#endif
#include <string.h>
#include <time.h>
+#ifndef HAVE_STRNCASECMP
+#include "wsutil/strncasecmp.h"
+#endif
+
#ifdef _LIBC
# include "../locale/localeinfo.h"
#endif