File: configure

package info (click to toggle)
proxycheck 0.49a-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 376 kB
  • sloc: ansic: 4,461; sh: 748; makefile: 130
file content (295 lines) | stat: -rwxr-xr-x 6,204 bytes parent folder | download | duplicates (2)
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
#! /bin/sh
# $Id: configure,v 1.4 2004/05/29 14:46:09 mjt Exp $
# autoconf-style configuration script
# Author: Michael Tokarev <mjt@corpit.ru>
# License: GPL

name=proxycheck

case "$1" in
  --help | --hel | --he | --h | -help | -hel | -he | -h )
    cat <<EOF
configure: configure $name package.
Usage: ./configure [options]
where options are:
 --help - print this help and exit
EOF
    exit 0
    ;;
  "") ;;
  *) echo "configure: unknown option \`$1'" >&2; exit 1 ;;
esac

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

set -e
rm -f conftest* confdef* config.log
exec 5>config.log
cat <<EOF >&5
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

EOF
cat >confdef.h <<EOF
/* $name autoconfiguration header file.
 * Generated automatically by configure. */

EOF
touch confdef.sed

case `echo "a\c"` in
  *c*) en=-n ec= ;;
  *)   en= ec='\c' ;;
esac

subst=
ac_define() {
  echo "#define $1	${2:-1}" >>confdef.h
}
ac_subst() {
  subst="$subst $*"
}
ac_error() {
  if [ -n "$*" ]; then
    echo "configure: $*" >&2
  fi
  echo "configure: see config.log and conftest.* for possible explanation"
  exit 1
}
ac_checking() {
  echo $en "checking $1... $ec" >&2
  echo >&5
  echo "configure: *** checking for $1 ***" >&5
}

read VERSION_DATE VERSION < CHANGES
ac_subst VERSION VERSION_DATE

echo "Configuring $name $VERSION ($VERSION_DATE)"
echo

### check for C compiler.  Set $CC
###
ac_checking "for C compiler"
rm -f conftest*; cat >conftest.c <<EOF
int main(int argc, char **argv) { return 0; }
EOF
if [ -n "$CC" ]; then
  if $CC -o conftest conftest.c 2>&5 && ./conftest 2>&5 ; then
    echo "\$CC ($CC)" >&2
  else
    echo no >&2
    ac_error "\$CC ($CC) is not a working compiler"
  fi
else
  for cc in gcc cc ; do
    if $cc -o conftest conftest.c 2>&5 && ./conftest 2>&5 ; then
      echo $cc
      CC=$cc
      break
    fi
  done
  if [ -z "$CC" ]; then
    echo no
    ac_error "no working C compiler found in \$PATH"
  fi
fi
ac_subst CC

if [ -z "$CFLAGS" ]; then
  ac_checking "whenever C compiler ($CC) is GNU CC"
  rm -f conftest*; cat >conftest.c <<EOF
#ifdef __GNUC__
  yes_it_is_gcc;
#endif
EOF
  if $CC -E conftest.c 2>&5 | grep yes_it_is_gcc >/dev/null ; then
    echo yes
    CFLAGS="-Wall -W -O2"
  else
    echo no
    CFLAGS=-O
  fi
fi
cc="$CC $CFLAGS $CPPFLAGS"
if [ -z "$LDFLAGS" ]; then LDFLAGS='$(CFLAGS)'; ldflags=
else ldflags="$LDFLAGS"
fi
ccld="$cc $ldflags -o conftest conftest.c"
cpp="$cc -E conftest.c"
cc="$cc -c conftest.c"
ac_subst CFLAGS CPPFLAGS LDFLAGS

ac_run() {
  ac_checking "$1"
  rm -f conftest*; cat >conftest.c
  if $ccld $2 2>&5 && ./conftest 2>&5 ; then
    echo ${3:-yes} >&2
    return 0
  else
    echo ${4:-no} >&2
    return 1
  fi
}
ac_link() {
  ac_checking "$1"
  rm -f conftest*; cat >conftest.c
  if $ccld $2 2>&5 ; then
    echo ${3:-yes} >&2
    return 0
  else
    echo ${4:-no} >&2
    return 1
  fi
}
ac_cpp() {
  ac_checking "$1"
  rm -f conftest*; cat >conftest.c
  if $cpp $2 2>&5 ; then
    echo ${3:-yes} >&2
    return 0
  else
    echo ${4:-no} >&2
    return 1
  fi
}

ac_run "whenever C compiler ($CC) works" <<EOF >/dev/null || exit 1
#include <stdio.h>
int main(int argc, char **argv) {
  puts("hello, world!");
  return 0;
}
EOF

if ac_link "for socket routines" <<EOF
#include <sys/socket.h>
int main() { connect(0, 0, 0); accept(0, 0, 0); return 0; }
EOF
then
  LIBSOCKET=
else
  LIBSOCKET="-lsocket -lnsl"
  ac_link "for socket routines in $LIBSOCKET" "$LIBSOCKET" <<EOF || ac_error
#include <sys/socket.h>
int main() { connect(0, 0, 0); accept(0, 0, 0); return 0; }
EOF
fi
ac_subst LIBSOCKET

if ac_link "for gethostbyname()" $LIBSOCKET <<EOF
#include <netdb.h>
int main() { gethostbyname(0); return 0; }
EOF
then
  LIBRESOLV=
else
  LIBRESOLV="-lresolv"
  ac_link "for gethostbyname() in $LIBRESOLV" "$LIBRESOLV $LIBSOCKET" <<EOF || ac_error
#include <netdb.h>
int main() { gethostbyname(0); return 0; }
EOF
fi
ac_subst LIBRESOLV

ev_methods=select
add_method() {
 ev_methods="$* $ev_methods"
}

ac_cpp "for <sys/select.h>" <<EOF >/dev/null && ac_define HAVE_SYS_SELECT_H
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/select.h>
int foo() { return 0; }
EOF

ac_link "for poll()" <<EOF && ac_define HAVE_POLL && add_method poll
#include <sys/types.h>
#include <sys/poll.h>
int main() {
  struct pollfd pfd[2];
  return poll(pfd, 2, 10);
}
EOF

ac_link "for epoll" <<EOF && ac_define HAVE_EPOLL && add_method epoll
#include <sys/types.h>
#include <sys/poll.h>
#include <sys/epoll.h>
int main() {
  struct epoll_event ev;
  ev.events = EPOLLIN;
  ev.data.fd = 0;
  epoll_create(10);
  epoll_ctl(10, EPOLL_CTL_ADD, 0, &ev);
  return 0;
}
EOF

ac_link "for kqueue" <<EOF && ac_define HAVE_KQUEUE && add_method kqueue
#include <sys/types.h>
#include <sys/time.h>
#include <sys/event.h>
int main() {
  struct kevent ke;
  EV_SET(&ke, 1, EVFILT_READ, EV_ADD, 0, 0, 0);
  kqueue();
  kevent(10, &ke, 1, 0, 0, 0);
  return 0;
}
EOF

ac_link "for devpoll" <<EOF && ac_define HAVE_DEVPOLL && add_method devpoll
#include <sys/types.h>
#include <fcntl.h>
#include <sys/poll.h>
#include <sys/devpoll.h>
#include <sys/ioctl.h>
int main() {
  struct pollfd pfd;
  dvpoll_t dp;
  pfd.fd = 10;
  pfd.events = POLLIN|POLLREMOVE;
  dp.dp_timeout = 10;
  dp.dp_nfds = 1;
  dp.dp_fds = &pfd;
  ioctl(10, DP_POLL, &dp);
  return 0;
}
EOF

echo "Using the following I/O multiplexing methods: $ev_methods" >&2

ac_link "for memmem()" <<EOF && ac_define HAVE_MEMMEM
#include <string.h>
int main(int argc, char **argv) {
  memmem(argv[0], 'a', 10);
  return 0;
}
EOF

echo $en "creating Makefile... $ec"
for var in $subst LIBS DEFS ; do
  eval echo "\"s|@$var@|\$$var|\""
done >>confdef.sed
rm -f Makefile.tmp
echo "# Automatically generated from Makefile.in by configure" >Makefile.tmp
echo "#" >>Makefile.tmp
sed -f confdef.sed Makefile.in >>Makefile.tmp
chmod +x Makefile.tmp
mv -f Makefile.tmp Makefile
echo ok

echo $en "creating config.h... $ec"
mv -f confdef.h config.h
echo ok

echo "all done."
rm -f conftest* confdef*
exit 0