import less(1)
[unleashed/tickless.git] / usr / src / lib / libresolv2 / include / probe_ipv6.sh
blob371ac96c554993cd938da891ca387660b45e6975
1 #!/bin/sh
3 # Copyright 2003 by Sun Microsystems, Inc. All rights reserved.
4 # Use is subject to license terms.
6 #pragma ident "%Z%%M% %I% %E% SMI"
8 set -e
9 PATH=/bin:/usr/bin:$PATH; export PATH
10 trap "rm -f tmp$$[abc].[oc]" 0
11 target=port_ipv6
12 new=new_${target}.h
13 old=${target}.h
15 cat > tmp$$a.c <<EOF
16 #include <sys/types.h>
17 #include <netinet/in.h>
18 struct sockaddr_in6 xx;
19 EOF
21 cat > tmp$$b.c <<EOF
22 #include <sys/types.h>
23 #include <netinet/in.h>
24 struct in6_addr xx;
25 EOF
27 cat > tmp$$c.c <<EOF
28 #include <sys/types.h>
29 #include <netinet/in.h>
30 struct sockaddr_in6 xx;
31 main() { xx.sin6_scope_id = 0; }
32 EOF
34 cat > ${new} <<EOF
36 /* This file is automatically generated. Do Not Edit. */
38 #ifndef ${target}_h
39 #define ${target}_h
41 EOF
43 if ${CC} -c tmp$$a.c > /dev/null 2>&1
44 then
45 echo "#define HAS_INET6_STRUCTS" >> ${new}
46 if ${CC} -c tmp$$b.c > /dev/null 2>&1
47 then
49 else
50 echo "#define in6_addr in_addr6" >> ${new}
52 if ${CC} -c tmp$$c.c > /dev/null 2>&1
53 then
54 echo "#define HAVE_SIN6_SCOPE_ID" >> ${new}
55 else
56 echo "#undef HAVE_SIN6_SCOPE_ID" >> ${new}
58 else
59 echo "#undef HAS_INET6_STRUCTS" >> ${new}
61 echo >> ${new}
62 echo "#endif" >> ${new}
63 if [ -f ${old} ]; then
64 if cmp -s ${new} ${old} ; then
65 rm -f ${new}
66 else
67 rm -f ${old}
68 mv ${new} ${old}
70 else
71 mv ${new} ${old}
73 exit 0