#!/bin/sh # Copyright 2003 by Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # #pragma ident "%Z%%M% %I% %E% SMI" set -e setvar PATH = "/bin:/usr/bin:$PATH"; export PATH trap "rm -f tmp$Pid[abc].[oc]" 0 setvar target = 'port_ipv6' setvar new = "new_${target}.h" setvar old = "${target}.h" cat > tmp$$a.c <<< """ #include #include struct sockaddr_in6 xx; """ cat > tmp$$b.c <<< """ #include #include struct in6_addr xx; """ cat > tmp$$c.c <<< """ #include #include struct sockaddr_in6 xx; main() { xx.sin6_scope_id = 0; } """ cat > ${new} <<< """ /* This file is automatically generated. Do Not Edit. */ #ifndef ${target}_h #define ${target}_h """ if ${CC} -c tmp$Pida.c > /dev/null 2>&1 { echo "#define HAS_INET6_STRUCTS" >> ${new} if ${CC} -c tmp$Pidb.c > /dev/null 2>&1 { : } else { echo "#define in6_addr in_addr6" >> ${new} } if ${CC} -c tmp$Pidc.c > /dev/null 2>&1 { echo "#define HAVE_SIN6_SCOPE_ID" >> ${new} } else { echo "#undef HAVE_SIN6_SCOPE_ID" >> ${new} } } else { echo "#undef HAS_INET6_STRUCTS" >> ${new} } echo >> ${new} echo "#endif" >> ${new} if test -f ${old} { if cmp -s ${new} ${old} { rm -f ${new} } else { rm -f ${old} mv ${new} ${old} } } else { mv ${new} ${old} } exit 0