All,
I've put together a patch (attached below) for compiling cfengine
1.6.3 under MacOS X client (aka Darwin). To apply, untar the cfengine
1.6.3 sources and then use "patch -p0 < patchfile" from the directory
holding the "cfengine-1.6.3" directory.
One minor compile problem this patch doesn't address: MacOS X includes
OpenSSL (v.0.9.5a), but it doesn't include the openssl include files,
so to compile cfengine, you'll need to download and install (in
/usr/local/include will do) a copy of the headers from ftp.openssh.org
(or http://www.opensource.apple.com//projects/darwin/). MacOS X also
includes tcp-wrappers, but it doesn't include libwrap nor tcpd.h, so
if you want to include tcp-wrapper support in cfd, you'll need to
download and install tcp-wrappper source too.
I've only done minimal testing of cfengine itself, but so far so good.
I haven't tested cfd at all. Please test & report any problems to the
list.
Also note: the patch mostly applies to the current cfengine-2.0 alpha,
but cfengine fails to link due to missing drand48() routines. There
are manpages for this (and related) routine in MacOS X, but I haven't
located yet the library which contains them (if any).
John
------------------------------------------------------------------------
diff -u --recursive cfengine-1.6.3.orig/acconfig.h cfengine-1.6.3/acconfig.h
--- cfengine-1.6.3.orig/acconfig.h Wed Jan 24 08:18:28 2001
+++ cfengine-1.6.3/acconfig.h Sun Apr 1 22:12:30 2001
@@ -73,6 +73,7 @@
#undef HAVE_SYS_ACL_H
#undef NOTBROKEN
#undef NT
+#undef DARWIN
/* SVR4 header stuff */
diff -u --recursive cfengine-1.6.3.orig/config.guess cfengine-1.6.3/config.guess
--- cfengine-1.6.3.orig/config.guess Mon May 24 16:45:46 1999
+++ cfengine-1.6.3/config.guess Sun Apr 1 01:09:47 2001
@@ -226,6 +226,9 @@
macppc:NetBSD:*:*)
echo powerpc-apple-netbsd${UNAME_RELEASE}
exit 0 ;;
+ Power*:Darwin:*:*)
+ echo powerpc-apple-darwin${UNAME_RELEASE}
+ exit 0 ;;
RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3
exit 0 ;;
diff -u --recursive cfengine-1.6.3.orig/config.sub cfengine-1.6.3/config.sub
--- cfengine-1.6.3.orig/config.sub Mon May 24 16:45:46 1999
+++ cfengine-1.6.3/config.sub Sun Apr 1 01:25:53 2001
@@ -715,7 +715,7 @@
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -rhapsody* \
- | -openstep*)
+ | -openstep* | -darwin*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-linux*)
diff -u --recursive cfengine-1.6.3.orig/configure cfengine-1.6.3/configure
--- cfengine-1.6.3.orig/configure Mon Jan 29 13:21:35 2001
+++ cfengine-1.6.3/configure Sun Apr 1 22:07:26 2001
@@ -4920,6 +4920,13 @@
;;
+ darwin*)
+ cat >> confdefs.h <<\EOF
+#define DARWIN 1
+EOF
+
+ ;;
+
*)
{ echo "configure: error: Unknown system type $target_os" 1>&2; exit 1;
}
;;
@@ -4999,7 +5006,7 @@
echo $ac_n "checking "8-bit support in Flex"""... $ac_c" 1>&6
-echo "configure:5003: checking "8-bit support in Flex"" >&5
+echo "configure:5010: checking "8-bit support in Flex"" >&5
if test "$LEX" = "flex"; then
EIGHTBIT="\200-\377"
@@ -5020,7 +5027,7 @@
# Extract the first word of "hostname", so it can be a program name with args.
set dummy hostname; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5024: checking for $ac_word" >&5
+echo "configure:5031: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_HOSTNAME'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
diff -u --recursive cfengine-1.6.3.orig/configure.in cfengine-1.6.3/configure.in
--- cfengine-1.6.3.orig/configure.in Thu Jan 25 13:06:41 2001
+++ cfengine-1.6.3/configure.in Sun Apr 1 21:57:39 2001
@@ -314,6 +314,10 @@
AC_DEFINE(SCO)
;;
+ darwin*)
+ AC_DEFINE(DARWIN)
+ ;;
+
*)
AC_MSG_ERROR(Unknown system type $target_os)
;;
diff -u --recursive cfengine-1.6.3.orig/src/cf.defs.h
cfengine-1.6.3/src/cf.defs.h
--- cfengine-1.6.3.orig/src/cf.defs.h Sun Dec 10 12:16:46 2000
+++ cfengine-1.6.3/src/cf.defs.h Sun Apr 1 13:26:48 2001
@@ -256,7 +256,7 @@
/* This is the only place you ever need to edit anything */
/*******************************************************************/
-#define clssattr 33 /* increase this for each new class added */
+#define clssattr 34 /* increase this for each new class added */
/* It defines the array size for class data */
#define attrdim 3 /* Only used in CLASSATTRUBUTES[][] defn */
@@ -501,6 +501,7 @@
cfnt,
unix_sv,
cfsco,
+ darwin,
unused1,
unused2,
unused3
diff -u --recursive cfengine-1.6.3.orig/src/cfd.c cfengine-1.6.3/src/cfd.c
--- cfengine-1.6.3.orig/src/cfd.c Thu Feb 15 01:25:05 2001
+++ cfengine-1.6.3/src/cfd.c Sun Apr 1 18:17:17 2001
@@ -790,7 +790,12 @@
pthread_attr_setdetachstate(&PTHREADDEFAULTS,PTHREAD_CREATE_DETACHED);
/*#ifdef HAVE_PTHREAD_ATTR_SETSTACKSIZE This seems to cause problems on some OSes*/
+#ifdef DARWIN
+#include <limits.h>
+pthread_attr_setstacksize(&PTHREADDEFAULTS,(size_t)(PTHREAD_STACK_MIN+100*1024));
+#else
pthread_attr_setstacksize(&PTHREADDEFAULTS,(size_t)(sysconf(_SC_THREAD_STACK_MIN)+100*1024));
+#endif
/*#endif*/
if (pthread_create(&tid,&PTHREADDEFAULTS,HandleConnection,(void *)conn) != 0)
Only in cfengine-1.6.3.orig/src: cflex.c
Only in cfengine-1.6.3.orig/src: cflex.l
Only in cfengine-1.6.3.orig/src: cfparse.c
Only in cfengine-1.6.3.orig/src: cfparse.h
diff -u --recursive cfengine-1.6.3.orig/src/classes.c
cfengine-1.6.3/src/classes.c
--- cfengine-1.6.3.orig/src/classes.c Mon Feb 19 10:35:22 2001
+++ cfengine-1.6.3/src/classes.c Sun Apr 1 19:03:44 2001
@@ -70,6 +70,7 @@
"unix_sv",
"openbsd",
"sco",
+ "darwin",
"unused1",
"unused2",
"unused3",
@@ -111,6 +112,7 @@
"unix_sv","*","*", /* Unixware */
"openbsd","*","*", /* OpenBSD */
"sco_sv","*","*", /* SCO */
+ "darwin","*","*", /* Darwin, aka MacOS X */
"unused1","blah","blah",
"unused2","blah","blah",
"unused3","blah","blah",
@@ -150,6 +152,7 @@
"/bin/ps", /* unixware */
"/bin/ps", /* openbsd */
"/bin/ps", /* sco */
+ "/bin/ps", /* darwin */
"/bin/ps",
"/bin/ps",
"/bin/ps",
@@ -189,6 +192,7 @@
"-ef", /* Unixware */
"ax", /* openbsd */
"-ef", /* sco */
+ "ax", /* darwin */
"-",
"-",
"-",
@@ -228,6 +232,7 @@
"/sbin/mountall", /* Unixware */
"/sbin/mount", /* openbsd */
"/etc/mountall", /* sco */
+ "/sbin/mount -va", /* darwin */
"unused-blah",
"unused-blah",
"unused-blah",
@@ -267,6 +272,7 @@
"/sbin/umount", /* Unixware */
"/sbin/umount", /* openbsd */
"/etc/umount", /* sco */
+ "/sbin/umount", /* darwin */
"unused-blah",
"unused-blah",
"unused-blah",
@@ -308,6 +314,7 @@
"bg,hard,intr", /* Unixware */
"-i,-b", /* openbsd */
"bg,hard,intr", /* sco */
+ "-i,-b", /* darwin */
"unused-blah",
"unused-blah",
"unused-blah",
@@ -347,6 +354,7 @@
"unknown", /* Unixware */
"le0", /* openbsd */
"net0", /* sco */
+ "en0", /* darwin */
"unused-blah",
"unused-blah",
"unused-blah",
@@ -387,6 +395,7 @@
"/etc/resolv.conf", /* Unixware */
"/etc/resolv.conf", /* openbsd */
"/etc/resolv.conf", /* sco */
+ "/etc/resolv.conf", /* darwin */
"unused-blah",
"unused-blah",
"unused-blah",
@@ -428,6 +437,7 @@
"/etc/vfstab", /* Unixware */
"/etc/fstab", /* openbsd */
"/etc/default/filesys", /* sco */
+ "/etc/fstab", /* darwin */
"unused-blah",
"unused-blah",
"unused-blah",
@@ -467,6 +477,7 @@
"/var/mail", /* Unixware */
"/var/mail", /* openbsd */
"/var/spool/mail", /* sco */
+ "/var/mail", /* darwin */
"unused-blah",
"unused-blah",
"unused-blah",
@@ -506,6 +517,7 @@
"/usr/bin/netstat -rn", /* Unixware */
"/usr/bin/netstat -rn", /* openbsd */
"/usr/bin/netstat -rn", /* sco */
+ "/usr/sbin/netstat -rn", /* darwin */
"unused-blah",
"unused-blah",
"unused-blah",
@@ -546,6 +558,7 @@
"/usr/bin/file", /* Unixware */
"/usr/bin/file", /* openbsd */
"/usr/bin/file", /* sco */
+ "/usr/bin/file", /* darwin */
"unused-blah",
"unused-blah",
"unused-blah",
diff -u --recursive cfengine-1.6.3.orig/src/conf.h.in
cfengine-1.6.3/src/conf.h.in
--- cfengine-1.6.3.orig/src/conf.h.in Wed Jan 24 08:49:08 2001
+++ cfengine-1.6.3/src/conf.h.in Sun Apr 1 22:07:17 2001
@@ -105,6 +105,7 @@
#undef HAVE_SYS_ACL_H
#undef NOTBROKEN
#undef NT
+#undef DARWIN
#undef __EXTENSIONS__
#undef _POSIX_C_SOURCE
diff -u --recursive cfengine-1.6.3.orig/src/df.c cfengine-1.6.3/src/df.c
--- cfengine-1.6.3.orig/src/df.c Sun Sep 10 12:16:00 2000
+++ cfengine-1.6.3/src/df.c Sun Apr 1 13:41:46 2001
@@ -108,7 +108,7 @@
avail = buf.f_bavail * (buf.f_frsize / blocksize);
#endif
-#if defined NETBSD || defined FREEBSD || defined OPENBSD || defined SUNOS || defined HPuUX
+#if defined NETBSD || defined FREEBSD || defined OPENBSD || defined SUNOS ||
defined HPuUX || defined DARWIN
total = buf.f_blocks;
used = buf.f_blocks - buf.f_bfree;
avail = buf.f_bavail;
diff -u --recursive cfengine-1.6.3.orig/src/misc.c cfengine-1.6.3/src/misc.c
--- cfengine-1.6.3.orig/src/misc.c Wed Jan 24 09:28:01 2001
+++ cfengine-1.6.3/src/misc.c Sun Apr 1 21:51:03 2001
@@ -284,7 +284,11 @@
list.ifc_len = sizeof(ifbuf);
list.ifc_req = ifbuf;
+#ifdef DARWIN
+if (ioctl(fd, OSIOCGIFCONF, &list) == -1 || (list.ifc_len < (sizeof(struct
ifreq))))
+#else
if (ioctl(fd, SIOCGIFCONF, &list) == -1 || (list.ifc_len < (sizeof(struct
ifreq))))
+#endif
{
CfLog(cferror,"Couldn't get interfaces","ioctl");
exit(1);
cfengine-darwin.patch
Content-Type:
text/plain