summaryrefslogtreecommitdiffstats
path: root/contrib/bind/port/freebsd/bin/probe_ipv6
blob: ba7135d0c5e3356c10402919c0f09ac105f94be8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh

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

if ${CC} -c tmp$$a.c > /dev/null 2>&1
then
        echo "#define HAS_INET6_STRUCTS" >> ${new}
        if ${CC} -c tmp$$b.c > /dev/null 2>&1
        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
OpenPOWER on IntegriCloud