forked from osmocom/wireshark
Use AC_REPLACE_FUNCS and LTLIBOBJS
Change-Id: I0f46167fe900c39d678560809cd5391c2a9bc4d2 Reviewed-on: https://code.wireshark.org/review/14809 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
This commit is contained in:
parent
cd1d137743
commit
7f873d92cb
|
@ -117,7 +117,7 @@ endif()
|
|||
check_function_exists("getprotobynumber" HAVE_GETPROTOBYNUMBER)
|
||||
check_function_exists("getifaddrs" HAVE_GETIFADDRS)
|
||||
check_function_exists("inet_aton" HAVE_INET_ATON)
|
||||
check_function_exists("inet_ntop" HAVE_INET_NTOP_PROTO)
|
||||
check_function_exists("inet_ntop" HAVE_INET_NTOP)
|
||||
check_function_exists("inet_pton" HAVE_INET_PTON)
|
||||
check_function_exists("issetugid" HAVE_ISSETUGID)
|
||||
check_function_exists("mkdtemp" HAVE_MKDTEMP)
|
||||
|
|
|
@ -109,8 +109,8 @@
|
|||
/* Define to 1 if you have the `inet_aton' function. */
|
||||
#cmakedefine HAVE_INET_ATON 1
|
||||
|
||||
/* Define if inet_ntop() prototype exists */
|
||||
#cmakedefine HAVE_INET_NTOP_PROTO 1
|
||||
/* Define to 1 if you have the `inet_ntop' function. */
|
||||
#cmakedefine HAVE_INET_NTOP 1
|
||||
|
||||
/* Define to 1 if you have the `inet_pton' function. */
|
||||
#cmakedefine HAVE_INET_PTON 1
|
||||
|
|
108
configure.ac
108
configure.ac
|
@ -56,6 +56,8 @@ AC_DEFINE(VERSION_FLAVOR, "Development Build", [Wireshark's package flavor])
|
|||
|
||||
AM_DISABLE_STATIC
|
||||
|
||||
AC_CONFIG_LIBOBJ_DIR([wsutil])
|
||||
|
||||
#
|
||||
# Checks for programs used in the main build process.
|
||||
#
|
||||
|
@ -2706,43 +2708,22 @@ AC_PROG_GCC_TRADITIONAL
|
|||
|
||||
AC_CHECK_FUNCS([getaddrinfo])
|
||||
|
||||
AC_CHECK_FUNC(getopt_long,
|
||||
[
|
||||
GETOPT_LO=""
|
||||
AC_DEFINE(HAVE_GETOPT_LONG, 1, [Define to 1 if you have the getopt_long function.])
|
||||
AC_REPLACE_FUNCS(getopt_long)
|
||||
dnl
|
||||
dnl Do we have optreset?
|
||||
dnl
|
||||
if test "x$ac_cv_func_getopt_long" = xyes; then
|
||||
AC_CACHE_CHECK([whether optreset is defined], ac_cv_have_optreset,
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([[extern int optreset;return optreset;]])],
|
||||
ac_cv_have_optreset=yes, ac_cv_have_optreset=no))
|
||||
if test "$ac_cv_have_optreset" = yes ; then
|
||||
AC_DEFINE(HAVE_OPTRESET, 1, [Define to 1 if you have the optreset variable])
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# Do we have optreset?
|
||||
#
|
||||
AC_CACHE_CHECK([whether optreset is defined],
|
||||
[ac_cv_optreset_defined], [
|
||||
AC_TRY_LINK([],
|
||||
[
|
||||
extern int optreset;
|
||||
AC_REPLACE_FUNCS(inet_aton)
|
||||
|
||||
return optreset;
|
||||
],
|
||||
ac_cv_optreset_defined=yes,
|
||||
ac_cv_optreset_defined=no)
|
||||
])
|
||||
if test "$ac_cv_optreset_defined" = yes ; then
|
||||
AC_DEFINE(HAVE_OPTRESET, 1, [Define to 1 if you have the optreset variable])
|
||||
fi
|
||||
],
|
||||
GETOPT_LO="wsgetopt.lo")
|
||||
AC_SUBST(GETOPT_LO)
|
||||
|
||||
AC_CHECK_FUNCS(mkstemp mkdtemp)
|
||||
|
||||
AC_SEARCH_LIBS(inet_aton, [socket nsl],
|
||||
[
|
||||
INET_ATON_LO=""
|
||||
AC_DEFINE(HAVE_INET_ATON, 1, [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], [
|
||||
AC_CHECK_FUNC(inet_pton, [
|
||||
dnl check for pre-BIND82 inet_pton() bug.
|
||||
AC_MSG_CHECKING(for broken inet_pton)
|
||||
AC_TRY_RUN([#include <sys/types.h>
|
||||
|
@ -2760,63 +2741,20 @@ int main()
|
|||
#endif
|
||||
}], [AC_MSG_RESULT(ok);
|
||||
have_inet_pton=yes], [AC_MSG_RESULT(broken);
|
||||
have_inet_pton=no], [AC_MSG_RESULT(cross compiling, assume it is broken);
|
||||
have_inet_pton=no], [AC_MSG_RESULT([cross compiling, assume it is broken]);
|
||||
have_inet_pton=no])],
|
||||
have_inet_pton=no)
|
||||
if test "$have_inet_pton" = no; then
|
||||
INET_PTON_LO="inet_pton.lo"
|
||||
AC_LIBOBJ(inet_pton)
|
||||
else
|
||||
AC_DEFINE(HAVE_INET_PTON, 1,
|
||||
[Define to 1 if you have the `inet_pton' function.])
|
||||
INET_PTON_LO=""
|
||||
AC_DEFINE(HAVE_INET_PTON, 1, [Define to 1 if you have the `inet_pton' function.])
|
||||
fi
|
||||
AM_CONDITIONAL(NEED_INET_PTON_LO, test "x$have_inet_pton" = "xno")
|
||||
AC_SUBST(INET_PTON_LO)
|
||||
|
||||
AC_SEARCH_LIBS(inet_ntop, [socket nsl], [
|
||||
AC_MSG_CHECKING([for inet_ntop prototype])
|
||||
AC_TRY_COMPILE([#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
extern const char *inet_ntop(int, const void *, char *, size_t);],, [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_INET_NTOP_PROTO, 1,
|
||||
[Define if inet_ntop() prototype exists])], [
|
||||
AC_TRY_COMPILE([#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
extern const char *inet_ntop(int, const void *, char *, socklen_t);],, [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_INET_NTOP_PROTO, 1,
|
||||
[Define if inet_ntop() prototype exists])], [
|
||||
AC_MSG_RESULT(no)])])
|
||||
INET_NTOP_LO=""], [
|
||||
INET_NTOP_LO="inet_ntop.lo"])
|
||||
AM_CONDITIONAL(NEED_INET_NTOP_LO, test "x$INET_NTOP_LO" != "x")
|
||||
AC_SUBST(INET_NTOP_LO)
|
||||
|
||||
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_FUNC(popcount,
|
||||
[
|
||||
POPCOUNT_LO=""
|
||||
AC_DEFINE(HAVE_POPCOUNT, 1, [Define if you have the popcount function.])
|
||||
],
|
||||
POPCOUNT_LO="popcount.lo")
|
||||
AC_SUBST(POPCOUNT_LO)
|
||||
AC_REPLACE_FUNCS(inet_ntop)
|
||||
AC_REPLACE_FUNCS(strptime)
|
||||
AC_REPLACE_FUNCS(popcount)
|
||||
|
||||
AC_CHECK_FUNCS(mkstemp mkdtemp)
|
||||
AC_CHECK_FUNCS(getprotobynumber)
|
||||
AC_CHECK_FUNCS(issetugid)
|
||||
AC_CHECK_FUNCS(sysconf)
|
||||
|
|
|
@ -15,3 +15,5 @@ tools/lemon/*
|
|||
wsutil/inet_aton.c
|
||||
wsutil/inet_ntop.c
|
||||
wsutil/inet_pton.c
|
||||
wsutil/strptime.c
|
||||
wsutil/getopt_long.c
|
||||
|
|
|
@ -146,7 +146,7 @@ if(HAVE_SSE4_2)
|
|||
endif()
|
||||
|
||||
if(NOT HAVE_GETOPT_LONG)
|
||||
set(WSUTIL_FILES ${WSUTIL_FILES} wsgetopt.c)
|
||||
set(WSUTIL_FILES ${WSUTIL_FILES} getopt_long.c)
|
||||
endif()
|
||||
|
||||
if(NOT HAVE_INET_ATON)
|
||||
|
|
|
@ -42,13 +42,7 @@ libwsutil_abi_INCLUDES = \
|
|||
|
||||
# Optional objects that I know how to build. These will be
|
||||
# linked into libwsutil if necessary.
|
||||
wsutil_optional_objects = \
|
||||
@GETOPT_LO@ \
|
||||
@INET_ATON_LO@ \
|
||||
@INET_NTOP_LO@ \
|
||||
@INET_PTON_LO@ \
|
||||
@POPCOUNT_LO@ \
|
||||
@STRPTIME_LO@
|
||||
wsutil_optional_objects =
|
||||
|
||||
if SSE42_SUPPORTED
|
||||
wsutil_optional_objects += libwsutil_sse42.la
|
||||
|
@ -78,23 +72,14 @@ libwsutil_sse42_la_SOURCES = \
|
|||
libwsutil_sse42_la_CFLAGS = $(AM_CFLAGS) $(CFLAGS_SSE42)
|
||||
|
||||
EXTRA_libwsutil_la_SOURCES = \
|
||||
inet_aton.c \
|
||||
inet_aton.h \
|
||||
inet_ntop.c \
|
||||
inet_pton.c \
|
||||
inet_addr-int.h \
|
||||
popcount.c \
|
||||
popcount.h \
|
||||
strptime.c \
|
||||
strptime.h \
|
||||
wsgetopt.c \
|
||||
wsgetopt.h \
|
||||
wsgetopt_int.h
|
||||
wsgetopt.h
|
||||
|
||||
libwsutil_la_DEPENDENCIES = \
|
||||
EXTRA_libwsutil_la_DEPENDENCIES = \
|
||||
$(wsutil_optional_objects)
|
||||
|
||||
libwsutil_la_LIBADD = \
|
||||
$(LTLIBOBJS) \
|
||||
@COREFOUNDATION_FRAMEWORKS@ \
|
||||
@GLIB_LIBS@ \
|
||||
@LIBGCRYPT_LIBS@ \
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
they can distinguish the relative order of options and other arguments. */
|
||||
|
||||
#include "wsgetopt.h"
|
||||
#include "wsgetopt_int.h"
|
||||
#include "getopt_long.h"
|
||||
|
||||
/* For communication from `getopt' to the caller.
|
||||
When `getopt' finds an option that takes an argument,
|
|
@ -51,7 +51,7 @@
|
|||
extern int inet_pton(int af, const char *src, void *dst);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_INET_NTOP_PROTO
|
||||
#ifndef HAVE_INET_NTOP
|
||||
extern const char *inet_ntop(int af, const void *src, char *dst, size_t size);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -125,6 +125,8 @@ inet_ntop6(const u_char *src, char *dst, size_t size)
|
|||
* Copy the input (bytewise) array into a wordwise array.
|
||||
* Find the longest run of 0x00's in src[] for :: shorthanding.
|
||||
*/
|
||||
memset(&best, 0, sizeof best);
|
||||
memset(&cur, 0, sizeof cur);
|
||||
memset(words, '\0', sizeof words);
|
||||
for (i = 0; i < NS_IN6ADDRSZ; i++)
|
||||
words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3));
|
||||
|
|
Loading…
Reference in New Issue