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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
|
dnl Process this file with autoconf to produce a configure script
# "We are ugly but we have the music"
# -- Leonard Cohen
#
# http://jerkcity.com/jerkcity1335.html
# This is the configure script for distcc.
# Copyright (C) 2002, 2003, 2004 by Martin Pool
# As of 0.6cvs, distcc no longer uses automake, only autoconf.
AC_PREREQ(2.53)
AC_INIT(distcc, 3.1, distcc@lists.samba.org)
AC_CONFIG_HEADERS(src/config.h)
AC_CANONICAL_HOST
# FreeBSD installs its version of libpopt into /usr/local/, but does
# not put that on the default library and header path.
# Solaris doesn't even ship libpopt. We used to add that path if
# building on *bsd*, but bje points out that will break
# cross-compilation, and it's kind of ugly anyhow. Anyhow, you can
# either set CPPFLAGS and LDFLAGS when running configure, or use
# --with-extra-foo.
##### defaults
dnl --with-docdir
AC_DEFUN([DISTCC_WITH_DOCDIR],
[AC_ARG_WITH(docdir,
AC_HELP_STRING([--with-docdir=DIR],
[Use DIR to store documentation files (default ${datadir}/doc/distcc)]),
[with_docdir=$withval])
if test "x$with_docdir" = "x" ; then
docdir='${datadir}/doc/distcc'
else
docdir=$with_docdir
fi
AC_SUBST(docdir)
])
dnl Run the check for --with-docdir
DISTCC_WITH_DOCDIR
# Check for socklen_t, and do something appropiate on systems
# that don't have it.
AC_CHECK_TYPE([socklen_t], ,[
AC_MSG_CHECKING([for socklen_t equivalent])
AC_CACHE_VAL([dcc_cv_socklen_t_equiv],
[
# Systems have either "struct sockaddr *" or
# "void *" as the second argument to getpeername
dcc_cv_socklen_t_equiv=
for arg2 in "struct sockaddr" void; do
for t in int size_t unsigned long "unsigned long"; do
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
int getpeername (int, $arg2 *, $t *);
],[
$t len;
getpeername(0,0,&len);
],[
dcc_cv_socklen_t_equiv="$t"
break
])
done
done
if test "x$dcc_cv_socklen_t_equiv" = x; then
AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
fi
])
AC_MSG_RESULT($dcc_cv_socklen_t_equiv)
AC_DEFINE_UNQUOTED(socklen_t, $dcc_cv_socklen_t_equiv,
[type to use in place of socklen_t if not defined])],
[#include <sys/types.h>
#include <sys/socket.h>])
# TODO: Handle program transform rules by autoconf.
### Checks for configure options
AC_ARG_WITH(included-popt,
AC_HELP_STRING([--with-included-popt], [use bundled popt library, not from system]))
AC_ARG_ENABLE(rfc2553,
AC_HELP_STRING([--enable-rfc2553], [use getaddrinfo, getnameinfo, etc]),
AC_DEFINE(ENABLE_RFC2553,1,[Use getaddrinfo(), getnameinfo(), etc]))
AC_ARG_WITH(gnome,
AC_HELP_STRING([--with-gnome], [build GNOME-based monitor]))
if test x"$with_gnome" = xyes
then
GNOME_BIN=distccmon-gnome
AC_DEFINE(WITH_GNOME,1,[Use GNOME])
fi
AC_ARG_WITH(gtk,
AC_HELP_STRING([--with-gtk], [build GTK+-based monitor]))
if test x"$with_gtk" = xyes
then
GNOME_BIN=distccmon-gnome
AC_DEFINE(WITH_GTK,1,[Use GTK+])
fi
AC_ARG_ENABLE(profile,
AC_HELP_STRING([--enable-profile], [turn on gprof]))
if test x"$enable_profile" = xyes
then
CFLAGS="$CFLAGS -pg -g"
fi
# Now get the package configuration information for whatever packages
# we need. It's faster to just do it once during configuration.
if test "x${with_gnome}" = xyes
then
GNOME_PACKAGES="gtk+-2.0 libgnome-2.0 libgnomeui-2.0 pango"
elif test "x${with_gtk}" = xyes
then
GNOME_PACKAGES="gtk+-2.0"
else
GNOME_PACKAGES=""
fi
for pkg in $GNOME_PACKAGES
do
AC_MSG_CHECKING([version of $pkg])
if gnomevers=`pkg-config --modversion $pkg`
then
AC_MSG_RESULT($gnomevers)
else
AC_MSG_ERROR([$pkg was not found by pkg-config])
fi
done
if test x${with_gnome} = xyes -o x${with_gtk} = xyes
then
INSTALL_GNOME="install-gnome-data"
UNINSTALL_GNOME="uninstall-gnome-data"
AC_MSG_CHECKING([GNOME/GTK+ cflags])
GNOME_CFLAGS="`pkg-config --cflags $GNOME_PACKAGES`" || AC_MSG_ERROR([failed to get cflags])
AC_MSG_RESULT([${GNOME_CFLAGS}])
AC_MSG_CHECKING([GNOME/GTK+ libraries])
GNOME_LIBS="`pkg-config --libs $GNOME_PACKAGES`" || AC_MSG_ERROR([failed to get libs])
AC_MSG_RESULT([${GNOME_LIBS}])
fi
AC_SUBST(GNOME_PACKAGES)
AC_SUBST(GNOME_CFLAGS)
AC_SUBST(GNOME_LIBS)
AC_SUBST(INSTALL_GNOME)
AC_SUBST(UNINSTALL_GNOME)
dnl Checks for programs
AC_PROG_CC
POPT_CFLAGS=""
WERROR_CFLAGS=""
if test x"$GCC" = xyes
then
CFLAGS="$CFLAGS -MD \
-W -Wall -Wimplicit -Wuninitialized \
-Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings \
-Waggregate-return -Wstrict-prototypes -Wmissing-prototypes \
-Wnested-externs -Wmissing-declarations"
# Would like -Wunreachable-code here, but it generates too many false
# positives.
# We want warnings to be treated as errors.
# Note that we can't include this in CFLAGS,
# because that would affect the configure tests,
# causing some of the tests to fail when they should succeed.
WERROR_CFLAGS="-Werror"
# For popt/*.c, we disable unused variable warnings.
POPT_CFLAGS="-Wno-unused"
AC_MSG_NOTICE([Adding gcc options: $CFLAGS])
fi
AC_SUBST(POPT_CFLAGS)
AC_SUBST(WERROR_CFLAGS)
AC_ISC_POSIX
# Apple's OS X gcc has a cpp-precomp "feature" that breaks standard
# variadic macros. If we can disable it, do so.
# This is needed for our included version of popt.
# TODO(csilvers): figure out what that above comment means, and if it's true.
CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H"
# Needed to get various GNU-only functions. They're all autodetected
# by configure so we can cope without them, but we want them if they're
# there.
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
AC_PROG_MAKE_SET
AC_PROG_INSTALL
# We prefer to use the latest Python, but try to find an explicit
# version to make sure we don't get a really old one.
#
# The include server requires python 2.4 or later, but the 'make test'
# routines only require python 2.2. Thus we have two separate
# variables. Each variable is the empty string if the python that we
# haven't isn't recent enough for that use, or the path to a python
# executable if it is recent enough.
#
# NB: Cannot use AC_CONFIG_LIBOBJ_DIR here, because it's not present
# in autoconf 2.53.
AC_PATH_PROGS(PYTHON, [python2.5 python-2.5 python2.4 python-2.4 python])
AC_ARG_VAR(PYTHON, [Python interpreter])
# Python 1 doesn't even support -V
if ! "$PYTHON" -V 2>&1 | grep "^Python" >/dev/null; then
TEST_PYTHON=""
INCLUDESERVER_PYTHON=""
elif "$PYTHON" -V 2>&1 | grep "^Python 2.1" >/dev/null; then
TEST_PYTHON=""
INCLUDESERVER_PYTHON=""
elif "$PYTHON" -V 2>&1 | grep "^Python 2.[[23]]" >/dev/null; then
TEST_PYTHON="$PYTHON"
INCLUDESERVER_PYTHON=""
else
TEST_PYTHON="$PYTHON"
INCLUDESERVER_PYTHON="$PYTHON"
fi
AC_SUBST(TEST_PYTHON)
AC_SUBST(INCLUDESERVER_PYTHON)
AC_SUBST(PYTHON_RELATIVE_LIB)
AC_C_INLINE
AC_C_BIGENDIAN
########################################################################
### Checks for header files
# Some of these are needed by popt (or other libraries included in the future).
AC_CHECK_HEADERS([unistd.h sys/types.h sys/sendfile.h sys/signal.h])
AC_CHECK_HEADERS([ctype.h sys/resource.h sys/socket.h sys/select.h])
AC_CHECK_HEADERS([netinet/in.h], [], [],
[#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
])
AC_CHECK_HEADERS([arpa/nameser.h], [], [],
[#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
])
AC_CHECK_HEADERS([resolv.h], [], [],
[#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#if HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#endif
])
AC_CHECK_HEADERS([float.h mcheck.h alloca.h sys/mman.h sys/loadavg.h])
AC_CHECK_HEADERS([elf.h])
AC_CHECK_HEADERS([fnmatch.h])
######################################################################
dnl Checks for types
AC_CHECK_TYPES([in_port_t, in_addr_t], , ,
[
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#if HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#if HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#endif
])
########################################################################
### Checks for libraries.
# The following test taken from the cvs sources via Samba:
# If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
# The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
# libsocket.so which has a bad implementation of gethostbyname (it
# only looks in /etc/hosts), so we only look for -lsocket if we need
# it.
AC_SEARCH_LIBS(gethostent, [nsl])
AC_SEARCH_LIBS(setsockopt, [socket])
AC_SEARCH_LIBS(hstrerror, [resolv])
AC_SEARCH_LIBS(inet_aton, [resolv])
if test x"$with_included_popt" != x"yes" && test x"$with_included_popt" != xno
then
# If not explicitly requested, guess.
# People might have the library but not the header, in which case we
# still need to use the included copy.
AC_CHECK_HEADER(popt.h, , [with_included_popt=yes])
fi
AC_CACHE_SAVE
AC_MSG_CHECKING([whether to use included libpopt])
if test x"$with_included_popt" = x"yes"
then
AC_MSG_RESULT($srcdir/popt)
# popt_OBJS gets appended to distccd object list
BUILD_POPT='$(popt_OBJS)'
POPT_INCLUDES='-I"$(srcdir)/popt"'
else
LIBS="$LIBS -lpopt"
AC_MSG_RESULT(no)
POPT_INCLUDES=''
fi
########################################################################
# Check for types
AC_TYPE_SIGNAL
########################################################################
# Checks for library functions, using libraries discovered above
# The line below was commented out: it should not be necessary for the
# AC_CHECK_FUNCS, which link against libraries on the host. For the subsequent
# explicit compilation tests below, no distcc libraries are used.
# TODO(klarlund): remove the line.
# CPPFLAGS="$CPPFLAGS -I$srcdir/src"
AC_CHECK_FUNCS([getpagesize])
AC_CHECK_FUNCS([sendfile setsid flock lockf hstrerror strerror setuid setreuid])
AC_CHECK_FUNCS([getuid geteuid mcheck wait4 wait3 waitpid setgroups])
AC_CHECK_FUNCS([snprintf vsnprintf vasprintf asprintf getcwd getwd mkdtemp])
AC_CHECK_FUNCS([getrusage strsignal gettimeofday])
AC_CHECK_FUNCS([getaddrinfo getnameinfo inet_ntop inet_ntoa])
AC_CHECK_FUNCS([strndup strsep mmap strlcpy])
AC_CHECK_FUNCS([getloadavg])
AC_CHECK_DECLS([snprintf, vsnprintf, vasprintf, asprintf, strndup])
AC_MSG_CHECKING([if mmap() supports MAP_FAILED])
AC_TRY_COMPILE([
#ifdef HAVE_SYS_MMAN_H
# include <sys/mman.h>
#endif],[
#ifdef HAVE_MMAP
if (mmap (NULL, 0, 0, 0, 0, 0) == MAP_FAILED)
return 0;
#else
#error mmap unavailable
#endif], ,[
AC_DEFINE([MAP_FAILED], [(void *)-1L],
[Define if MAP_FAILED constant not available])
])
AC_MSG_RESULT()
dnl
dnl Test if the preprocessor understand vararg macros
dnl
AC_MSG_CHECKING([for vararg macro support])
AC_TRY_COMPILE([#define func(a, b...) do { } while (0)],
[func("a"); func("a", "b"); func("a", "b", "c")],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_VARARG_MACROS, , [Define if your cpp has vararg macros])],
[AC_MSG_RESULT(no)])
AC_CACHE_CHECK([for va_copy],dcc_cv_HAVE_VA_COPY,[
AC_TRY_LINK([#include <stdarg.h>
va_list ap1,ap2;], [va_copy(ap1,ap2);],
dcc_cv_HAVE_VA_COPY=yes,dcc_cv_HAVE_VA_COPY=no)])
if test x"$dcc_cv_HAVE_VA_COPY" = x"yes"; then
AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
fi
AC_CACHE_CHECK([for __va_copy],dcc_cv_HAVE_UNDERSCORE_UNDERSCORE_VA_COPY,[
AC_TRY_LINK([#include <stdarg.h>
va_list ap1,ap2;], [__va_copy(ap1,ap2);],
dcc_cv_HAVE_UNDERSCORE_UNDERSCORE_VA_COPY=yes,dcc_cv_HAVE_UNDERSCORE_UNDERSCORE_VA_COPY=no)])
if test x"$dcc_cv_HAVE_UNDERSCORE_UNDERSCORE_VA_COPY" = x"yes"; then
AC_DEFINE(HAVE_UNDERSCORE_UNDERSCORE_VA_COPY,1,[Whether __va_copy() is available])
fi
AC_CACHE_CHECK([for C99 vsnprintf],rsync_cv_HAVE_C99_VSNPRINTF,[
AC_TRY_RUN([
#include <sys/types.h>
#include <stdarg.h>
void foo(const char *format, ...) {
va_list ap;
int len;
char buf[5];
va_start(ap, format);
len = vsnprintf(0, 0, format, ap);
va_end(ap);
if (len != 5) exit(1);
if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
exit(0);
}
main() { foo("hello"); }
],
rsync_cv_HAVE_C99_VSNPRINTF=yes,rsync_cv_HAVE_C99_VSNPRINTF=no,rsync_cv_HAVE_C99_VSNPRINTF=cross)])
if test x"$rsync_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [define if vsnprintf is C99 compliant])
fi
AC_CACHE_CHECK([for working socketpair],rsync_cv_HAVE_SOCKETPAIR,[
AC_TRY_RUN([
#include <sys/types.h>
#include <sys/socket.h>
main() {
int fd[2];
exit((socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != -1) ? 0 : 1);
}],
rsync_cv_HAVE_SOCKETPAIR=yes,rsync_cv_HAVE_SOCKETPAIR=no,rsync_cv_HAVE_SOCKETPAIR=cross)])
if test x"$rsync_cv_HAVE_SOCKETPAIR" = x"yes"; then
AC_DEFINE(HAVE_SOCKETPAIR, 1, [define if you have a working socketpair])
fi
dnl Checks for structures
AC_CHECK_MEMBER([struct sockaddr_storage.ss_family],
AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [define if you have struct sockaddr_storage]),,
[#include <sys/socket.h>])
AC_ARG_WITH(avahi,
AC_HELP_STRING([--without-avahi], [build without avahi]))
dnl check for avahi
if test x"$with_avahi" != xno; then
PKG_CHECK_MODULES(AVAHI, [avahi-client >= 0.6],
[AC_DEFINE(HAVE_AVAHI, 1, [defined if Avahi is available])
CFLAGS="$CFLAGS $AVAHI_CFLAGS"
LIBS="$LIBS $AVAHI_LIBS"
ZEROCONF_COMMON_OBJS="src/zeroconf.o src/gcc-id.o"
ZEROCONF_DISTCC_OBJS=""
ZEROCONF_DISTCCD_OBJS="src/zeroconf-reg.o"],
[ZEROCONF_COMMON_OBJS=""
ZEROCONF_DISTCC_OBJS=""
ZEROCONF_DISTCCD_OBJS=""])
AC_SUBST(ZEROCONF_COMMON_OBJS)
AC_SUBST(ZEROCONF_DISTCC_OBJS)
AC_SUBST(ZEROCONF_DISTCCD_OBJS)
fi
ACX_PTHREAD
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
dnl ##### Output
AC_SUBST(docdir)
AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(POPT_INCLUDES)
AC_SUBST(BUILD_POPT)
AC_SUBST(GNOME_BIN)
AC_DEFINE_UNQUOTED(GNU_HOST, ["$host"], [Your gnu-style host triple])
# The '.stamp-conf' files force creation of the containing directories in the
# build tree.
AC_CONFIG_FILES([Makefile] popt/.stamp-conf lzo/.stamp-conf)
AC_CONFIG_FILES([pump], [chmod +x pump])
AC_OUTPUT
##### Finalization
# Display success, installation paths, and GPL licence statement.
echo ' '
${MAKE-make} showpaths
echo ' '
cat <<EOF
$PACKAGE_NAME $PACKAGE_VERSION configured
Copyright (C) 2002, 2003, 2004 by Martin Pool <mbp@samba.org>
Portions Copyright 2005 Google Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
After installing distcc, please complete the survey in the file "survey.txt".
EOF
|