2N/A#!/bin/sh
2N/A
2N/A# Copyright 2003 by Sun Microsystems, Inc. All rights reserved.
2N/A# Use is subject to license terms.
2N/A#
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/Aset -e
2N/APATH=/bin:/usr/bin:$PATH; export PATH
2N/Atrap "rm -f tmp$$[abc].[oc]" 0
2N/Atarget=port_ipv6
2N/Anew=new_${target}.h
2N/Aold=${target}.h
2N/A
2N/Acat > tmp$$a.c <<EOF
2N/A#include <sys/types.h>
2N/A#include <netinet/in.h>
2N/Astruct sockaddr_in6 xx;
2N/AEOF
2N/A
2N/Acat > tmp$$b.c <<EOF
2N/A#include <sys/types.h>
2N/A#include <netinet/in.h>
2N/Astruct in6_addr xx;
2N/AEOF
2N/A
2N/Acat > tmp$$c.c <<EOF
2N/A#include <sys/types.h>
2N/A#include <netinet/in.h>
2N/Astruct sockaddr_in6 xx;
2N/Amain() { xx.sin6_scope_id = 0; }
2N/AEOF
2N/A
2N/Acat > ${new} <<EOF
2N/A
2N/A/* This file is automatically generated. Do Not Edit. */
2N/A
2N/A#ifndef ${target}_h
2N/A#define ${target}_h
2N/A
2N/AEOF
2N/A
2N/Aif ${CC} -c tmp$$a.c > /dev/null 2>&1
2N/Athen
2N/A echo "#define HAS_INET6_STRUCTS" >> ${new}
2N/A if ${CC} -c tmp$$b.c > /dev/null 2>&1
2N/A then
2N/A :
2N/A else
2N/A echo "#define in6_addr in_addr6" >> ${new}
2N/A fi
2N/A if ${CC} -c tmp$$c.c > /dev/null 2>&1
2N/A then
2N/A echo "#define HAVE_SIN6_SCOPE_ID" >> ${new}
2N/A else
2N/A echo "#undef HAVE_SIN6_SCOPE_ID" >> ${new}
2N/A fi
2N/Aelse
2N/A echo "#undef HAS_INET6_STRUCTS" >> ${new}
2N/Afi
2N/Aecho >> ${new}
2N/Aecho "#endif" >> ${new}
2N/Aif [ -f ${old} ]; then
2N/A if cmp -s ${new} ${old} ; then
2N/A rm -f ${new}
2N/A else
2N/A rm -f ${old}
2N/A mv ${new} ${old}
2N/A fi
2N/Aelse
2N/A mv ${new} ${old}
2N/Afi
2N/Aexit 0