forked from osmocom/wireshark
Fixes for a couple of problems, from Albert Chin:
1. On Solaris, inet_ntop and inet_pton need to be linked against -lnsl. AC_CHECK_FUNC() isn't good enough unless LIBS already has -lnsl. 2. On IRIX, the blanket redefinition of the inet_ntop function prototype is incorrect (compiling with MIPSpro 7.4): cc-1143 cc: ERROR File = inet_v6defs.h, Line = 32 Declaration is incompatible with "const char *inet_ntop(int, const void *, char *, socklen_t)" (declared at line 89 of "/usr/include/arpa/inet.h"). extern const char *inet_ntop(int af, const void *src, char *dst, ^ 1 error detected in the compilation of "inet_pton.c". gmake[4]: *** [inet_pton.o] Error 2 On IRIX, the correct prototype is: extern const char *inet_ntop(int, const void *, char *, socklen_t); Rather than blindly replacing the prototype we detect if a prototype exists and define it only if one does not exist. svn path=/trunk/; revision=7218
This commit is contained in:
parent
aa43cd779c
commit
959282506a
|
@ -1,4 +1,4 @@
|
|||
# $Id: configure.in,v 1.37 2003/02/26 20:08:32 guy Exp $
|
||||
# $Id: configure.in,v 1.38 2003/02/28 05:09:50 guy Exp $
|
||||
dnl
|
||||
dnl Process this file with autoconf 2.13 or later to produce a
|
||||
dnl configure script; 2.12 doesn't generate a "configure" script that
|
||||
|
@ -154,7 +154,7 @@ fi
|
|||
AC_SUBST(INET_ATON_C)
|
||||
AC_SUBST(INET_ATON_O)
|
||||
|
||||
AC_CHECK_FUNC(inet_pton, [
|
||||
AC_SEARCH_LIBS(inet_pton, [socket nsl], [
|
||||
dnl check for pre-BIND82 inet_pton() bug.
|
||||
AC_MSG_CHECKING(for broken inet_pton)
|
||||
AC_TRY_RUN([#include <sys/types.h>
|
||||
|
@ -185,13 +185,34 @@ fi
|
|||
AC_SUBST(INET_PTON_C)
|
||||
AC_SUBST(INET_PTON_O)
|
||||
|
||||
AC_CHECK_FUNC(inet_ntop, INET_NTOP_O="",
|
||||
INET_NTOP_O="inet_ntop.o")
|
||||
if test "$ac_cv_func_inet_ntop" = no ; then
|
||||
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_O=""], [
|
||||
INET_NTOP_C="inet_ntop.c"
|
||||
INET_NTOP_O="inet_ntop.o"
|
||||
AC_DEFINE(NEED_INET_V6DEFS_H, 1, [Define if inet/v6defs.h needs to be included])
|
||||
fi
|
||||
AC_DEFINE(NEED_INET_V6DEFS_H, 1,
|
||||
[Define if inet/v6defs.h needs to be included])])
|
||||
AC_SUBST(INET_NTOP_C)
|
||||
AC_SUBST(INET_NTOP_O)
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/* inet_v6defs.h
|
||||
*
|
||||
* $Id: inet_v6defs.h,v 1.2 2002/08/28 20:40:44 jmayer Exp $
|
||||
* $Id: inet_v6defs.h,v 1.3 2003/02/28 05:09:50 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
* Copyright 1998 Gerald Combs
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -29,8 +29,10 @@
|
|||
* don't have it.
|
||||
*/
|
||||
extern int inet_pton(int af, const char *src, void *dst);
|
||||
#ifndef HAVE_INET_NTOP_PROTO
|
||||
extern const char *inet_ntop(int af, const void *src, char *dst,
|
||||
size_t size);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Those OSes may also not have AF_INET6, so declare it here if it's not
|
||||
|
|
Loading…
Reference in New Issue