xref: /titanic_51/usr/src/lib/libresolv2/include/probe_ipv6.sh (revision 0c44d0008f52b6a42b9c01d3b344661217520a68)
1*0c44d000Sstevel#!/bin/sh
2*0c44d000Sstevel
3*0c44d000Sstevel# Copyright 2003 by Sun Microsystems, Inc. All rights reserved.
4*0c44d000Sstevel# Use is subject to license terms.
5*0c44d000Sstevel#
6*0c44d000Sstevel#pragma ident	"%Z%%M%	%I%	%E% SMI"
7*0c44d000Sstevel
8*0c44d000Sstevelset -e
9*0c44d000SstevelPATH=/bin:/usr/bin:$PATH; export PATH
10*0c44d000Ssteveltrap "rm -f tmp$$[abc].[oc]" 0
11*0c44d000Ssteveltarget=port_ipv6
12*0c44d000Sstevelnew=new_${target}.h
13*0c44d000Sstevelold=${target}.h
14*0c44d000Sstevel
15*0c44d000Sstevelcat > tmp$$a.c <<EOF
16*0c44d000Sstevel#include <sys/types.h>
17*0c44d000Sstevel#include <netinet/in.h>
18*0c44d000Sstevelstruct sockaddr_in6 xx;
19*0c44d000SstevelEOF
20*0c44d000Sstevel
21*0c44d000Sstevelcat > tmp$$b.c <<EOF
22*0c44d000Sstevel#include <sys/types.h>
23*0c44d000Sstevel#include <netinet/in.h>
24*0c44d000Sstevelstruct in6_addr xx;
25*0c44d000SstevelEOF
26*0c44d000Sstevel
27*0c44d000Sstevelcat > tmp$$c.c <<EOF
28*0c44d000Sstevel#include <sys/types.h>
29*0c44d000Sstevel#include <netinet/in.h>
30*0c44d000Sstevelstruct sockaddr_in6 xx;
31*0c44d000Sstevelmain() { xx.sin6_scope_id = 0; }
32*0c44d000SstevelEOF
33*0c44d000Sstevel
34*0c44d000Sstevelcat > ${new} <<EOF
35*0c44d000Sstevel
36*0c44d000Sstevel/* This file is automatically generated. Do Not Edit. */
37*0c44d000Sstevel
38*0c44d000Sstevel#ifndef ${target}_h
39*0c44d000Sstevel#define ${target}_h
40*0c44d000Sstevel
41*0c44d000SstevelEOF
42*0c44d000Sstevel
43*0c44d000Sstevelif ${CC} -c tmp$$a.c > /dev/null 2>&1
44*0c44d000Sstevelthen
45*0c44d000Sstevel        echo "#define HAS_INET6_STRUCTS" >> ${new}
46*0c44d000Sstevel        if ${CC} -c tmp$$b.c > /dev/null 2>&1
47*0c44d000Sstevel        then
48*0c44d000Sstevel		:
49*0c44d000Sstevel	else
50*0c44d000Sstevel                echo "#define in6_addr in_addr6" >> ${new}
51*0c44d000Sstevel        fi
52*0c44d000Sstevel	if ${CC} -c tmp$$c.c > /dev/null 2>&1
53*0c44d000Sstevel	then
54*0c44d000Sstevel		echo "#define HAVE_SIN6_SCOPE_ID" >> ${new}
55*0c44d000Sstevel	else
56*0c44d000Sstevel		echo "#undef HAVE_SIN6_SCOPE_ID" >> ${new}
57*0c44d000Sstevel	fi
58*0c44d000Sstevelelse
59*0c44d000Sstevel        echo "#undef HAS_INET6_STRUCTS" >> ${new}
60*0c44d000Sstevelfi
61*0c44d000Sstevelecho  >> ${new}
62*0c44d000Sstevelecho "#endif" >> ${new}
63*0c44d000Sstevelif [ -f ${old} ]; then
64*0c44d000Sstevel        if cmp -s ${new} ${old} ; then
65*0c44d000Sstevel                rm -f ${new}
66*0c44d000Sstevel        else
67*0c44d000Sstevel                rm -f ${old}
68*0c44d000Sstevel                mv ${new} ${old}
69*0c44d000Sstevel        fi
70*0c44d000Sstevelelse
71*0c44d000Sstevel        mv ${new} ${old}
72*0c44d000Sstevelfi
73*0c44d000Sstevelexit 0
74