summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorCraig Silverstein <csilvers@khanacademy.org>2008-04-11 22:20:16 +0000
committerCraig Silverstein <csilvers@khanacademy.org>2008-04-11 22:20:16 +0000
commit0a38eace37b20a663b235fb20107829e22fbeb43 (patch)
tree44c5645cfbc35fb2d4a53daac40cf64b00a1b6ad /configure.ac
parent6dcf5b5d62ee5e88f8b11e03d5af05878111b8a2 (diff)
downloaddistcc-git-0a38eace37b20a663b235fb20107829e22fbeb43.tar.gz
Merge configure.ac, distcc/configure.ac, and
include_server/configure.ac into a single, top-level configure.ac script. Likewise with the three Makefile.in scripts. Now one config file at the top level controls everything. I had to rewrite quite a bit of code to account for the new level-up. In particular, I had to add "distcc/" in front of many things in order to refer to the same files I used to refer to when the configure.ac/Makefile.in text lived in the distcc/ directory rather than the top-level directory. Likewise (though to a lesser extent) for include_server. I also had to do a bit of merge work. Typically I'd leave the originally-distcc-directory content as close to the original as possible, and then try to put in the include_server directory stuff. Most of the top-level configure.ac and Makefile.in could go away, since they were glue before. I also could get rid of other top-level helper scripts that were used for the glue, such as version.sh. I also fixed a number of typos and other bugs: Makefile.in: 1) Removed obsolete CVS comment (we're 3 source-control systems past that now!) 2) distcc/Makefile.in was using top_builddir without importing it from the configure script. 3) Add zeroconf.h to HEADERS, which is needed for 'make dist'. I also added all the include_server files to 'make dist'. 4) "make dist" was passing 'h' ("no symlinks") to tar. This does not work with the include_server test-suite, which includes symlinks. I verified no other part of the distribution uses symlinks. Removed the h. 5) "make dist" was missing a lot of stuff (including almost all the include-server files). Updated it to get it all now. Likewise, updated "make clean" and its cousins to be more precise. Also made "make distcheck" more careful in checking that kind of thing. 6) Declared more phony targets .PHONY. 7) The include-server build commands do a lot of 'cd'-ing (since setup.py requires it), and then using make variables that might store relative directory paths. I now go through some hoops to make those directory paths absolute before the cd. 8) "make pump-check" was not setting the path, so it was using the installed distcc instead of the local one in the client. Fixed that, and added a new target, "make pump-installcheck", to use the installed distcc instead (parallel to the maintainer-check and maintainer-installcheck targets). configure.ac: 1) popt test was using $srcdir rather than required ${srcdir}, and thus was always getting the empty string. (Luckily, srcdir is usually ".", and the empty string is usually equivalent.) Likewise when setting CPPFLAGS, which again didn't matter because it turns out the relevant code was redundant with what autoconf already does automatically. 2) A merge error: apparently the avahi check was added twice. Get rid of the second one. 3) Was using obsolete AC_OUTPUT format. Use AC_CONFIG_FILES instead. 4) Added pkg.m4 to the m4/ directory. Before it only lived in autoconf.m4. But my system, at least, doesn't have it. 5) include-server requires python2.4, so remove checks for earlier pythons. autogen.sh: 1) Added aclocal call. I think it was a bug that it was left out before. pump.in: 1) Fixed it to notice when it can't find the .so file it needs. I also modified INSTALL to point to the new file locations, and the new instructions to run them (eg no more run_all_autoconf.sh). Despite all these bugfixes, I made the minimal changes possible to get things to work. I marked with "TODO" further improvements I'd like to make later. One particular TODO is that I had to rename the "distcc" target -- the main executable -- because it conflicts with the existing distcc directory. This is a temporary breakage which will be fixed in the next submit after this one, where I move the subdirs under distcc to the top level, getting rid of the artificial extra directory introduced. Tested by running 'make maintainer-check', 'make distcheck', and 'make pump-check' on my local machine, which passed. I've not tested all the various configurations and options (including using avahi, using the library popt library, building without python, etc). I've also not tried 'make benchmark'. Reviewed by klarlund@google.com and fergus@google.com
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac472
1 files changed, 464 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac
index 367e336..2af90b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,11 +1,467 @@
-AC_INIT(distcc_pump,
- esyscmd(source version.sh && echo -n $DISTCC_PUMP_VERSION),
- distcc-pump@google.com)
-AC_CHECK_PROGS(PYTHON, [python2.4 python2.3 python-2.3 python2.2 python-2.2 python])
+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.0-prerelease1, distcc@googlegroups.com)
+
+AC_CONFIG_HEADERS(distcc/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"
+ 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)
+
+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 -Wpointer-arith -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 effect 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.
+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.
+AC_CHECK_PROGS(PYTHON, [python2.4 python-2 python])
AC_ARG_VAR(PYTHON, [Python interpreter])
-AC_CONFIG_AUX_DIR(distcc)
-AC_CONFIG_SUBDIRS(include_server distcc)
-AC_CONFIG_FILES([Makefile])
+# NB: Cannot use AC_CONFIG_LIBOBJ_DIR here, because it's not present
+# in autoconf 2.53.
+
+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/distcc/popt)
+ # popt_OBJS gets appended to distccd object list
+ BUILD_POPT='$(popt_OBJS)'
+ CPPFLAGS="$CPPFLAGS -I$srcdir/distcc/popt"
+else
+ LIBS="$LIBS -lpopt"
+ AC_MSG_RESULT(no)
+fi
+
+
+
+########################################################################
+# Check for types
+AC_TYPE_SIGNAL
+
+
+########################################################################
+# Checks for library functions, using libraries discovered above
+CPPFLAGS="$CPPFLAGS -I$srcdir/distcc/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 getcwd])
+AC_CHECK_FUNCS([snprintf vsnprintf vasprintf asprintf getcwd getwd])
+AC_CHECK_FUNCS([getrusage strsignal gettimeofday])
+AC_CHECK_FUNCS([getaddrinfo getnameinfo inet_ntop inet_ntoa])
+AC_CHECK_FUNCS([strndup 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],samba_cv_HAVE_VA_COPY,[
+AC_TRY_LINK([#include <stdarg.h>
+va_list ap1,ap2;], [__va_copy(ap1,ap2);],
+samba_cv_HAVE_VA_COPY=yes,samba_cv_HAVE_VA_COPY=no)])
+if test x"$samba_cv_HAVE_VA_COPY" = x"yes"; then
+ AC_DEFINE(HAVE_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>])
+
+dnl check for avahi
+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_DISTCC_OBJS="distcc/src/zeroconf.o"
+ZEROCONF_DISTCCD_OBJS="distcc/src/zeroconf-reg.o"],
+[ZEROCONF_DISTCC_OBJS=""
+ZEROCONF_DISTCCD_OBJS=""])
+AC_SUBST(ZEROCONF_DISTCC_OBJS)
+AC_SUBST(ZEROCONF_DISTCCD_OBJS)
+
+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(BUILD_POPT)
+AC_SUBST(GNOME_BIN)
+AC_DEFINE_UNQUOTED(GNU_HOST, ["$host"], [Your gnu-style host triple])
+AC_CONFIG_FILES([Makefile] distcc/popt/.stamp-conf distcc/lzo/.stamp-conf)
AC_CONFIG_FILES([pump], [chmod +x pump])
-AC_PROG_INSTALL
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>
+
+ 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. Unauthorized redistribution is
+ prohibited by law.
+
+ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+After installing distcc, please complete the survey in the file "survey.txt".
+
+EOF