[distcc] AIX patches

Stuart D. Gathman stuart at bmsi.com
Tue Feb 18 17:14:46 GMT 2003


I got distcc compiled and installed on AIX with an RPM spec that also 
works on Linux.  aix-4.1.5 is missing setenv.  I tried adding 
HAVE_SETENV to config.h.in and setenv to AC_CHECK_FUNCS in configure.ac, 
however, this did not cause configure to check for setenv.  I don't 
pretend to know how autoconfigure works, so I just made the patch 
conditional.
-------------- next part --------------
Summary: Distributed frontend for gcc compilers.
Name: distcc
Version: 1.1
Release: 1
License: GPL
Group: Development/Tools
Source: http://distcc.samba.org/ftp/distcc/distcc-1.1.tar.bz2
Patch0: distcc-aix.patch
URL: http://distcc.samba.org
Prereq: /sbin/install-info
Buildroot: /var/tmp/%{name}-root

%description
distcc is a program to distribute compilation of C or C++ code across several
machines on a network. distcc should always generate the same results as a
local compile, is simple to install and use, and is often two or more times
faster than a local compile.

distcc does not require all machines to share a filesystem, have synchronized
clocks, or to have the same libraries or header files installed. Machines can
be running different operating systems, as long as they have compatible binary
formats or cross-compilers.

Install distcc if you have two or more networked computers and want to
speed up compiles.

%prep
%setup -q
%ifos aix4.1
%patch0
%endif

%build
%ifos aix4.1
LDFLAGS="-s -Wl,-blibpath:/lib:/usr/local/lib"
%else
LDFLAGS="-s"
%endif
CFLAGS="-pipe $RPM_OPT_FLAGS"
LANG=C
export LDFLAGS CFLAGS LANG
./configure --bindir=%{_bindir} --mandir=%{_mandir} --infodir=%{_infodir}
make

%clean
rm -rf $RPM_BUILD_ROOT

%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT

%post
/sbin/install-info --item='* distcc: (distcc).	Distrubuted gcc frontend.' \
	--section='Programming' %{_infodir}/distcc.info.gz %{_infodir}/dir 

%preun
if [ $1 = 0 ]; then
  /sbin/install-info --delete \
  	--item='* distcc: (distcc).	Distrubuted gcc frontend.' \
	--section='Programming' %{_infodir}/distcc.info.gz %{_infodir}/dir 
fi

%files
%defattr(-,bin,bin)
%doc AUTHORS COPYING COPYING.FDL NEWS OLDNEWS README DEPENDENCIES 
%doc linuxdoc/html/*
%{_bindir}/*
%{_mandir}/*/*
%{_infodir}/*

%changelog
* Tue Feb 18 2003 Stuart Gathman <stuart at bmsi.com>
- build on AIX
-------------- next part --------------
--- ./src/exec.c.aix    Tue Feb 18 10:19:02 2003
+++ ./src/exec.c        Tue Feb 18 10:33:30 2003
@@ -179,7 +179,27 @@
     }
 }
 
-
+#if !HAVE_SETENV
+int setenv(const char *name,const char *val,int overwrite) {
+  int namlen;
+  char *envp;
+  if (!overwrite) {
+    if (getenv(name) != 0)
+      return 0;
+  }
+  namlen = strlen(name);
+  envp = malloc(namlen + strlen(val) + 2);
+  if (!envp) return -1;
+  strcpy(envp,name);
+  envp[namlen] = '=';
+  strcpy(envp+namlen+1,val);
+  if (putenv(envp)) {
+    free(envp);
+    return -1;
+  }
+  return 0;
+}
+#endif
 
 /**
  * Called inside the newly-spawned child process to execute a command.
--- ./src/config.h.in.aix       Tue Feb 18 10:22:30 2003
+++ ./src/config.h.in   Tue Feb 18 10:23:08 2003
@@ -24,6 +24,9 @@
 /* Define to 1 if you have the `hstrerror' function. */
 #undef HAVE_HSTRERROR
 
+/* Define to 1 if you have the `setenv' function. */
+#undef HAVE_SETENV
+
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
--- ./configure.ac.aix  Tue Feb 18 10:21:11 2003
+++ ./configure.ac      Tue Feb 18 10:21:26 2003
@@ -142,7 +142,7 @@
 CPPFLAGS="$CPPFLAGS -I$srcdir/src"
 
 AC_CHECK_FUNCS([sendfile setsid flock lockf hstrerror strerror setuid setreuid])
-AC_CHECK_FUNCS([getuid geteuid mcheck wait4 wait3 waitpid setgroups])
+AC_CHECK_FUNCS([getuid geteuid mcheck wait4 wait3 waitpid setgroups setenv])
 
 
 dnl



More information about the distcc mailing list