Make it build on systems lacking "inet_pton()", "inet_ntop()", and a

definition of "AF_INET6".  Declare those functions and, if it's not
defined, define "AF_INET6" in "inet_v6defs.h", and arrange to include
it if "inet_ntop()" is missing.  (Systems will probably have both of
them or lack both of them, and we may choose not to use the system's
"inet_pton()" because it's buggy, so base the decision on whether to
include "inet_v6defs.h" on whether we're using the system's
"inet_ntop()" or not.)  Fix some macro references in "Makefile.am" and
"configure.in".

svn path=/trunk/; revision=830
This commit is contained in:
Guy Harris 1999-10-14 06:55:11 +00:00
parent 831497b33e
commit ae276ffe20
8 changed files with 75 additions and 12 deletions

View File

@ -1,7 +1,7 @@
# Makefile.am
# Automake file for Ethereal
#
# $Id: Makefile.am,v 1.86 1999/10/14 05:41:28 itojun Exp $
# $Id: Makefile.am,v 1.87 1999/10/14 06:55:07 guy Exp $
#
# Ethereal - Network traffic analyzer
# By Gerald Combs <gerald@zing.org>
@ -168,7 +168,7 @@ ethereal_DEPENDENCIES = @SNMP_O@ @SNPRINTF_O@ @STRERROR_O@ \
@STRNCASECMP_O@ @MKSTEMP_O@ @INET_ATON_O@ @INET_PTON_O@ @INET_NTOP_O@\
wiretap/libwiretap.a gtk/libui.a
ethereal_LDADD = @SNMP_O@ @SNPRINTF_O@ @STRERROR_O@ \
@STRNCASECMP_O@ @MKSTEMP_O@ @INET_ATON_O@ @INET_ATON_O@ @INET_NTOP_O@\
@STRNCASECMP_O@ @MKSTEMP_O@ @INET_ATON_O@ @INET_PTON_O@ @INET_NTOP_O@\
wiretap/libwiretap.a gtk/libui.a \
@SNMP_A@

View File

@ -1,7 +1,7 @@
/* acconfig.h
* #ifdefs to be controlled by "configure"
*
* $Id: acconfig.h,v 1.11 1999/10/06 03:37:52 guy Exp $
* $Id: acconfig.h,v 1.12 1999/10/14 06:55:11 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -31,6 +31,8 @@
#undef DATAFILE_DIR
#undef NEED_INET_V6DEFS_H
#undef NEED_SNPRINTF_H
#undef NEED_STRERROR_H

View File

@ -1,4 +1,4 @@
# $Id: configure.in,v 1.51 1999/10/14 05:41:28 itojun Exp $
# $Id: configure.in,v 1.52 1999/10/14 06:55:08 guy Exp $
dnl Process this file with autoconf to produce a configure script.
AC_INIT(etypes.h)
@ -228,10 +228,11 @@ AC_SUBST(INET_PTON_C)
AC_SUBST(INET_PTON_O)
AC_CHECK_FUNC(inet_ntop, INET_NTOP_O="",
INET_ATON_O="inet_ntop.o")
INET_NTOP_O="inet_ntop.o")
if test "$ac_cv_func_inet_ntop" = no ; then
INET_ATON_C="inet_ntop.c"
INET_ATON_O="inet_ntop.o"
INET_NTOP_C="inet_ntop.c"
INET_NTOP_O="inet_ntop.o"
AC_DEFINE(NEED_INET_V6DEFS_H)
fi
AC_SUBST(INET_NTOP_C)
AC_SUBST(INET_NTOP_O)

View File

@ -16,9 +16,11 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char rcsid[] = "$Id: inet_ntop.c,v 1.1 1999/10/14 05:41:29 itojun Exp $";
static char rcsid[] = "$Id: inet_ntop.c,v 1.2 1999/10/14 06:55:08 guy Exp $";
#endif /* LIBC_SCCS and not lint */
#include "config.h"
#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
@ -40,6 +42,8 @@ static char rcsid[] = "$Id: inet_ntop.c,v 1.1 1999/10/14 05:41:29 itojun Exp $";
# include "snprintf.h"
#endif
#include "inet_v6defs.h"
#ifndef NS_INADDRSZ
#define NS_INADDRSZ 4
#endif

View File

@ -16,7 +16,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char rcsid[] = "$Id: inet_pton.c,v 1.1 1999/10/14 05:41:29 itojun Exp $";
static char rcsid[] = "$Id: inet_pton.c,v 1.2 1999/10/14 06:55:10 guy Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@ -28,6 +28,8 @@ static char rcsid[] = "$Id: inet_pton.c,v 1.1 1999/10/14 05:41:29 itojun Exp $";
#include <string.h>
#include <errno.h>
#include "inet_v6defs.h"
#ifndef NS_INADDRSZ
#define NS_INADDRSZ 4
#endif

47
inet_v6defs.h Normal file
View File

@ -0,0 +1,47 @@
/* inet_pton.h
*
* $Id: inet_v6defs.h,v 1.1 1999/10/14 06:55:09 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
* Version of "inet_pton()" and "inet_ntop()", for the benefit of OSes that
* don't have it.
*/
extern int inet_pton(int af, const char *src, void *dst);
extern const char *inet_ntop(int af, const void *src, char *dst,
size_t size);
/*
* Those OSes may also not have AF_INET6, so declare it here if it's not
* already declared, so that we can pass it to "inet_ntop()" and "inet_pton()".
*/
#ifndef AF_INET6
#define AF_INET6 127 /* pick a value unlikely to duplicate an existing AF_ value */
#endif
/*
* And if __P isn't defined, define it here, so we can use it in
* "inet_ntop.c" and "inet_pton.c" (rather than having to change them
* not to use it).
*/
#ifndef __P
#define __P(args) args
#endif

View File

@ -1,7 +1,7 @@
/* packet.c
* Routines for packet disassembly
*
* $Id: packet.c,v 1.47 1999/10/14 05:41:30 itojun Exp $
* $Id: packet.c,v 1.48 1999/10/14 06:55:09 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -55,6 +55,10 @@
# include <netinet/in.h>
#endif
#ifdef NEED_INET_V6DEFS_H
# include "inet_v6defs.h"
#endif
#include "packet.h"
#include "print.h"
#include "file.h"

View File

@ -1,7 +1,7 @@
/* resolv.c
* Routines for network object lookup
*
* $Id: resolv.c,v 1.14 1999/10/14 05:41:33 itojun Exp $
* $Id: resolv.c,v 1.15 1999/10/14 06:55:10 guy Exp $
*
* Laurent Deniel <deniel@worldnet.fr>
*
@ -39,7 +39,6 @@
#endif
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@ -68,6 +67,10 @@
# include <setjmp.h>
#endif
#ifdef NEED_INET_V6DEFS_H
# include "inet_v6defs.h"
#endif
#include "packet.h"
#include "packet-ipv6.h"
#include "globals.h"