1999-11-20 21:53:57 +03:00
|
|
|
#!/bin/sh
|
1999-11-20 22:03:47 +03:00
|
|
|
#
|
1999-12-24 22:11:25 +03:00
|
|
|
# $NetBSD: probe_ipv6,v 1.3 1999/12/24 19:11:25 garbled Exp $
|
1999-11-20 21:53:57 +03:00
|
|
|
|
|
|
|
set -e
|
|
|
|
PATH=/bin:/usr/bin:$PATH; export PATH
|
|
|
|
trap "rm -f tmp$$a.c tmp$$b.c tmp$$a.o tmp$$b.o" 0
|
|
|
|
target=port_ipv6
|
|
|
|
new=new_${target}.h
|
|
|
|
old=${target}.h
|
|
|
|
|
|
|
|
cat > tmp$$a.c <<EOF
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
struct sockaddr_in6 xx;
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cat > tmp$$b.c <<EOF
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
struct in6_addr xx;
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cat > ${new} <<EOF
|
|
|
|
|
|
|
|
/* This file is automatically generated. Do Not Edit. */
|
|
|
|
|
|
|
|
#ifndef ${target}_h
|
|
|
|
#define ${target}_h
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
1999-12-24 22:11:25 +03:00
|
|
|
if ${CC} ${CPPFLAGS} -c tmp$$a.c > /dev/null 2>&1
|
1999-11-20 21:53:57 +03:00
|
|
|
then
|
|
|
|
echo "#define HAS_INET6_STRUCTS" >> ${new}
|
1999-12-24 22:11:25 +03:00
|
|
|
if ${CC} ${CPPFLAGS} -c tmp$$b.c > /dev/null 2>&1
|
1999-11-20 21:53:57 +03:00
|
|
|
then
|
|
|
|
:
|
|
|
|
else
|
|
|
|
echo "#define in6_addr in_addr6" >> ${new}
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "#undef HAS_INET6_STRUCTS" >> ${new}
|
|
|
|
fi
|
|
|
|
echo >> ${new}
|
|
|
|
echo "#endif" >> ${new}
|
|
|
|
if [ -f ${old} ]; then
|
|
|
|
if cmp -s ${new} ${old} ; then
|
|
|
|
rm -f ${new}
|
|
|
|
else
|
|
|
|
rm -f ${old}
|
|
|
|
mv ${new} ${old}
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
mv ${new} ${old}
|
|
|
|
fi
|
|
|
|
exit 0
|