File: configure

package info (click to toggle)
udns 0.6-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 420 kB
  • sloc: ansic: 4,248; makefile: 166; sh: 131
file content (168 lines) | stat: -rwxr-xr-x 3,386 bytes parent folder | download
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#! /bin/sh
# autoconf-style configuration script
#

set -e

name=udns

if [ -f udns.h -a -f udns_resolver.c ] ; then :
else
  echo "configure: error: sources not found at `pwd`" >&2
  exit 1
fi

options="ipv6"

for opt in $options; do
  eval enable_$opt=
done

if [ -f config.status ]; then
  . ./config.status
fi

enable() {
  opt=`echo "$1" | sed 's/^--[^-]*-//'`
  case "$opt" in
    ipv6) ;;
    *) echo "configure: unrecognized option \`$1'" >&2; exit 1;;
  esac
  eval enable_$opt=$2
}

while [ $# -gt 0 ]; do
  case "$1" in
    --disable-*|--without-*|--no-*) enable "$1" n;;
    --enable-*|--with-*) enable "$1" y;;
    --help | --hel | --he | --h | -help | -hel | -he | -h )
      cat <<EOF
configure: configure $name package.
Usage: ./configure [options]
where options are:
 --enable-option, --with-option --
   enable the named option/feature
 --disable-option, --without-option, --no-option --
   disable the named option/feature
 --help - print this help and exit
Optional features (all enabled by default if system supports a feature):
  ipv6 - enable/disable IP version 6 (IPv6) support
EOF
      exit 0
      ;;
    *) echo "configure: unknown option \`$1'" >&2; exit 1 ;;
  esac
  shift
done

. ./configure.lib

ac_msg "configure"
ac_result "$name package"

ac_prog_c_compiler_v
ac_prog_ranlib_v

ac_ign ac_yesno "for getopt()" ac_have GETOPT ac_link <<EOF
#include <stdio.h>
extern int optind;
extern char *optarg;
extern int getopt(int, char **, char *);
int main(int argc, char **argv) {
  getopt(argc, argv, "abc");
  return optarg ? optind : 0;
}
EOF

if ac_library_find_v 'socket and connect' "" "-lsocket -lnsl" <<EOF
#include <sys/types.h>
#include <sys/socket.h>
int main() { socket(0,0,0); connect(0,0,0); return 0; }
EOF
then :
else
  ac_fatal "cannot find libraries needed for sockets"
fi

ac_ign \
 ac_yesno "for inet_pton() && inet_ntop()" \
 ac_have INET_PTON_NTOP \
 ac_link <<EOF
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
int main() {
  char buf[64];
  long x = 0;
  inet_ntop(AF_INET, &x, buf, sizeof(buf));
  inet_pton(AF_INET, buf, &x);
  return x;
} 
EOF

if ac_yesno "for socklen_t" ac_compile <<EOF
#include <sys/types.h>
#include <sys/socket.h>
int foo() { socklen_t len; len = 0; return len; }
EOF
then :
else
  ac_define socklen_t int
fi

if [ n != "$enable_ipv6" ]; then
if ac_yesno "for IPv6" ac_have IPv6 ac_compile <<EOF
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
int main() {
  struct sockaddr_in6 sa;
  sa.sin6_family = AF_INET6;
  return 0;
}
EOF
then :
elif [ "$enable_ipv6" ]; then
  ac_fatal "IPv6 is requested but not available"
fi
fi # !disable_ipv6?

if ac_yesno "for poll()" ac_have POLL ac_link <<EOF
#include <sys/types.h>
#include <sys/poll.h>
int main() {
  struct pollfd pfd[2];
  return poll(pfd, 2, 10);
}
EOF
then :
else
  ac_ign ac_yesno "for sys/select.h" ac_have SYS_SELECT_H ac_cpp <<EOF
#include <sys/types.h>
#include <sys/select.h>
EOF
fi

ac_config_h
ac_output Makefile
ac_msg "creating config.status"
rm -f config.status
{
echo "# automatically generated by configure to hold command-line options"
echo
found=
for opt in $options; do
  eval val=\$enable_$opt
  if [ -n "$val" ]; then
    echo enable_$opt=$val
    found=y
  fi
done
if [ ! "$found" ]; then
  echo "# (no options encountered)"
fi
} > config.status
ac_result ok

ac_result "all done."
exit 0