
BUILDING
-----------------------------------------------------------------------

In order to compile this software you should install development versions of

Openssl
BerkeleyDB
flex
bison
PCRE

to simplify building and fully enable the software.

Type the following to build the software:

$ tar zxf cfengine-3.0.0.tar.gz
$ cd cfengine-3.0.0
$ ./configure && make

If you only wish to test this software, you do not need to install it
with "make install", nor do you need to run it with root privileges.
You may run it as a regular user.


TROUBLESHOOTING
-----------------------------------------------------------------------

Problems linking?

 Try getting the latest cfengine version directly from svn. You only
 need to install the library

 host$ cd /workdir
 host$ svn checkout https://svn.iu.hio.no/projects/cfengine-3/trunk
 host$ cd trunk; ./configure;make
 host$ cd src; install -c .libs/libcfengine.a /usr/local/lib/libcfengine.a

Some reports indicate that there is trouble compiling cfengine with
recent versions 4.x of gcc. No problems are reported with gcc 3.x.

EXAMPLES
-----------------------------------------------------------------------

Some basic documentation is provided in the tests/units directory. 


Basic Installation
==================

 Cfengine depends on two packages. You should install up to date
 versions of these first.

 Berkeley Database obtainable from   http://www.sleepycat.com
 OpenSSL obtainable from             http://www.openssl.org
 Perl Compatible Regular Expressions

 Some operating systems with package managers will already contain
 packages for these libraries.

 If you use MacOS X you need to download and install a copy of
 BerkeleyDB, as well as a copy of the OpenSSL header files.

   The following are generic installation instructions.

   The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation.  It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions.  Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').

   If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release.  If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.

   The file `configure.in' is used to create `configure' by a program
called `autoconf'.  You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.

The simplest way to compile this package is:

  1. `cd' to the directory containing the package's source code and type
     `./configure' to configure the package for your system.  If you're
     using `csh' on an old version of System V, you might need to type
     `sh ./configure' instead to prevent `csh' from trying to execute
     `configure' itself.

     Running `configure' takes awhile.  While running, it prints some
     messages telling which features it is checking for.

  2. Type `make' to compile the package.

  3. Optionally, type `make check' to run any self-tests that come with
     the package.

  4. Type `make install' to install the programs and any data files and
     documentation.

  5. You can remove the program binaries and object files from the
     source code directory by typing `make clean'.  To also remove the
     files that `configure' created (so you can compile the package for
     a different kind of computer), type `make distclean'.  There is
     also a `make maintainer-clean' target, but that is intended mainly
     for the package's developers.  If you use it, you may have to get
     all sorts of other programs in order to regenerate files that came
     with the distribution.

OpenSSL Problem
=====================

If you see error messages of the follwing type when upgrading OpenSSL:

dso_dlfcn.c: undefined reference to `dlsym'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o)(.text+0x31d):dso_dlfcn.c: undefined reference to `dlerror'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o)(.text+0x3bf): In function `dlfcn_bind_var':
dso_dlfcn.c: undefined reference to `dlsym'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o)(.text+0x43b):dso_dlfcn.c: undefined reference to `dlerror'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o)(.text+0x4a7): In function `dlfcn_unload':
dso_dlfcn.c: undefined reference to `dlclose'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o)(.text+0x563): In function `dlfcn_load':
dso_dlfcn.c: undefined reference to `dlopen'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o)(.text+0x5c9):dso_dlfcn.c: undefined reference to `dlclose'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o)(.text+0x5fe):dso_dlfcn.c: undefined reference to `dlerror'
collect2: ld returned 1 exit status
make[2]: *** [cfagent] Error 1


Then you should make sure that you rebuilt *with* shared libraries and
without static libcrypto.a libraries. Rename or remove
/usr/local/ssl/lib/libcrypto.a and recompile. The libdl functions are
apparently only available from shared libraries.
