]> git.mxchange.org Git - simgear.git/blob - 3rdparty/udns/configure
Initial commit for a DNS service resolver
[simgear.git] / 3rdparty / udns / configure
1 #! /bin/sh
2 # autoconf-style configuration script
3 #
4
5 set -e
6
7 name=udns
8
9 if [ -f udns.h -a -f udns_resolver.c ] ; then :
10 else
11   echo "configure: error: sources not found at `pwd`" >&2
12   exit 1
13 fi
14
15 options="ipv6"
16
17 for opt in $options; do
18   eval enable_$opt=
19 done
20
21 if [ -f config.status ]; then
22   . ./config.status
23 fi
24
25 enable() {
26   opt=`echo "$1" | sed 's/^--[^-]*-//'`
27   case "$opt" in
28     ipv6) ;;
29     *) echo "configure: unrecognized option \`$1'" >&2; exit 1;;
30   esac
31   eval enable_$opt=$2
32 }
33
34 while [ $# -gt 0 ]; do
35   case "$1" in
36     --disable-*|--without-*|--no-*) enable "$1" n;;
37     --enable-*|--with-*) enable "$1" y;;
38     --help | --hel | --he | --h | -help | -hel | -he | -h )
39       cat <<EOF
40 configure: configure $name package.
41 Usage: ./configure [options]
42 where options are:
43  --enable-option, --with-option --
44    enable the named option/feature
45  --disable-option, --without-option, --no-option --
46    disable the named option/feature
47  --help - print this help and exit
48 Optional features (all enabled by default if system supports a feature):
49   ipv6 - enable/disable IP version 6 (IPv6) support
50 EOF
51       exit 0
52       ;;
53     *) echo "configure: unknown option \`$1'" >&2; exit 1 ;;
54   esac
55   shift
56 done
57
58 . ./configure.lib
59
60 ac_msg "configure"
61 ac_result "$name package"
62
63 ac_prog_c_compiler_v
64 ac_prog_ranlib_v
65
66 ac_ign ac_yesno "for getopt()" ac_have GETOPT ac_link <<EOF
67 #include <stdio.h>
68 extern int optind;
69 extern char *optarg;
70 extern int getopt(int, char **, char *);
71 int main(int argc, char **argv) {
72   getopt(argc, argv, "abc");
73   return optarg ? optind : 0;
74 }
75 EOF
76
77 if ac_library_find_v 'socket and connect' "" "-lsocket -lnsl" <<EOF
78 int main() { socket(); connect(); return 0; }
79 EOF
80 then :
81 else
82   ac_fatal "cannot find libraries needed for sockets"
83 fi
84
85 ac_ign \
86  ac_yesno "for inet_pton() && inet_ntop()" \
87  ac_have INET_PTON_NTOP \
88  ac_link <<EOF
89 #include <sys/types.h>
90 #include <sys/socket.h>
91 #include <arpa/inet.h>
92 int main() {
93   char buf[64];
94   long x = 0;
95   inet_pton(AF_INET, &x, buf);
96   return inet_ntop(AF_INET, &x, buf, sizeof(buf));
97
98 EOF
99
100 if ac_yesno "for socklen_t" ac_compile <<EOF
101 #include <sys/types.h>
102 #include <sys/socket.h>
103 int foo() { socklen_t len; len = 0; return len; }
104 EOF
105 then :
106 else
107   ac_define socklen_t int
108 fi
109
110 if [ n != "$enable_ipv6" ]; then
111 if ac_yesno "for IPv6" ac_have IPv6 ac_compile <<EOF
112 #include <sys/types.h>
113 #include <sys/socket.h>
114 #include <netinet/in.h>
115 int main() {
116   struct sockaddr_in6 sa;
117   sa.sin6_family = AF_INET6;
118   return 0;
119 }
120 EOF
121 then :
122 elif [ "$enable_ipv6" ]; then
123   ac_fatal "IPv6 is requested but not available"
124 fi
125 fi # !disable_ipv6?
126
127 if ac_yesno "for poll()" ac_have POLL ac_link <<EOF
128 #include <sys/types.h>
129 #include <sys/poll.h>
130 int main() {
131   struct pollfd pfd[2];
132   return poll(pfd, 2, 10);
133 }
134 EOF
135 then :
136 else
137   ac_ign ac_yesno "for sys/select.h" ac_have SYS_SELECT_H ac_cpp <<EOF
138 #include <sys/types.h>
139 #include <sys/select.h>
140 EOF
141 fi
142
143 ac_config_h
144 ac_output Makefile
145 ac_msg "creating config.status"
146 rm -f config.status
147 {
148 echo "# automatically generated by configure to hold command-line options"
149 echo
150 found=
151 for opt in $options; do
152   eval val=\$enable_$opt
153   if [ -n "$val" ]; then
154     echo enable_$opt=$val
155     found=y
156   fi
157 done
158 if [ ! "$found" ]; then
159   echo "# (no options encountered)"
160 fi
161 } > config.status
162 ac_result ok
163
164 ac_result "all done."
165 exit 0