
#include "bacula_template.inc" title="Porting Notes"

<H1>Bacula Porting Notes</H1>

<h2>General</h2>
This document is intended mostly for developers who wish to
port Bacula to a system that is not <b>officially</b>
supported.
<p>It is hoped that Bacula clients will eventually run on every
imaginable system that needs backing up (perhaps even a Palm). It
is also hoped that the Bacula Directory and Storage daemons will
run on every system capable of supporting them.

<h2>Requirements</h2>
In General, the following holds true:
<ul type="disc">
<li><b>Bacula</b> has been compiled and run on Linux RedHat, FreeBSD,
    and Solaris systems. </li>
<li>In addition, clients exist on Win32 (Cygwin), and Irix</li>
<li>It requires GNU C++ to compile. You can try with other compilers, but
    you are on your own. The Irix client is built with the Irix complier,
    but, in general, you will need GNU.</li>
<li>Your compiler must provide support for 64 bit signed and unsigned
    integers.</li>
<li>You will need a recent copy of the <b>autoconf</b> tools loaded
    on your system (version 2.13 or later). The <b>autoconf</b> tools
    are used to build the configuration program, but are not part of
    the Bacula source distribution.</li>
<li>There are certain third party packages that Bacula needs. Except
    for MySQL, they can all be found in the <b>depkgs</b> and
    <b>depkgs1</b> releases.
<li>If you want to build the Win32 binaries, you will need the
    full Cygwin 1.5.5 release. Although all components build (console
    has some warnings), only the File daemon has been tested.
    Please note that if you attempt to build Bacula on any other
    version of Cygwin, particularly previous versions, you will
    be on your own.
<li><b>Bacula</b> requires a good implementation of pthreads to work.</li>
<li>The source code has been written with portability in mind and is
    mostly POSIX compatible. Thus porting to any POSIX compatible operating
    system should be relatively easy.</li>
</ul>


<h2>Steps to Take</h2>
<ul type="disc">
<li>The first step is to ensure that you have version 2.13 or later  
    of the <b>autoconf</b> tools loaded. You can skip this step, but 
    making changes to the configuration program will be difficult or
    impossible. </li>
<li>The run a <b>./configure</b> command in the main source directory
    and examine the output.  It should look something like the
    following:
    <pre>
Configuration on Mon Oct 28 11:42:27 CET 2002:

  Host:                        i686-pc-linux-gnu -- redhat 7.3
  Bacula version:              1.27 (26 October 2002)
  Source code location:        .
  Install binaries:            /sbin
  Install config files:        /etc/bacula
  C Compiler:                  gcc
  C++ Compiler:                c++
  Compiler flags:              -g -O2 
  Linker flags:                
  Libraries:                   -lpthread 
  Statically Linked Tools:     no
  Database found:              no
  Database type:               Internal
  Database lib:                

  Job Output Email:            root@localhost
  Traceback Email:             root@localhost
  SMTP Host Address:           localhost
  Director Port                9101
  File daemon Port             9102
  Storage daemon Port          9103
  Working directory            /etc/bacula/working
  SQL binaries Directory   

  Large file support:          yes
  readline support:            yes 
  cweb support:                yes /home/kern/bacula/depkgs/cweb
  TCP Wrappers support:        no
  ZLIB support:                yes
  enable-smartalloc:           yes 
  enable-gnome:                no
  gmp support:                 yes 

</pre>
   The details depend on your system. The first thing to check is that
   it properly identified your host on the <b>Host:</b> line. The
   first part (added in version 1.27) is the GNU four part identification
   of your system. The part after the -- is your system and the system version.
   Generally, if your system is not yet supported, you must correct these.</li>

<li>If the <b>./configure</b> does not function properly, you must 
    determine the cause and fix it. Generally, it will be because some
    required system routine is not available on your machine.</li>

<li>To correct problems with detection of your system type or with routines
    and libraries, you must edit the file <b>&lt;bacula-src&gt;/autoconf/configure.in</b>.
    This is the &quot;source&quot; from which <b>configure</b> is built.
    In general, most of the changes for your system will be made in
    <b>autoconf/aclocal.m4</b> in the routine <b>BA_CHECK_OPSYS</b> or
    in the routine <b>BA_CHECK_OPSYS_DISTNAME</b>. I have already added the
    necessary code for most systems, but if yours shows up as <b>unknown</b>
    you will need to make changes.  Then as mentioned above, you will need
    to set a number of system dependent items in <b>configure.in</b> in the
    <b>case</b> statement at approximately line 1050 (depending on the 
    Bacula release).</li>

<li>The items to in the case statement that corresponds to your system
    are the following:
    <ul>
      <li>DISTVER -- set to the version of your operating system.  Typically
          some form of <b>uname</b> obtains it. </li>
      <li>TAPEDRIVE -- the default tape drive. Not too important as the user
          can set it as an option.</li>
      <li>PSCMD -- set to the <b>ps</b> command that will provide the PID
          in the first field and the program name in the second field. If this
          is not set properly, the <b>bacula stop</b> script will most likely
          not be able to stop Bacula in all cases.</li>
       <li>hostname -- command to return the base host name (non-qualified)
          of your system. This is generally the machine name. Not too important
          as the user can correct this in his configuration file. </li>
       <li>CFLAGS -- set any special compiler flags needed. Many systems need
          a special flag to make pthreads work. See cygwin for an example.</li>
       <li>LDFLAGS -- set any special loader flags. See cygwin for an example.</li>
       <li>PTHREAD_LIB -- set for any special pthreads flags needed during
           linking. See freebsd as an example.</li>
       <li>lld -- set so that a "long long int" will be properly edited in
           a printf() call.</li>
       <li>llu -- set so that a "long long unsigned" will be properly edited in
           a printf() call.</li>
       <li>PFILES -- set to add any files that you may define is your platform
           subdirectory. These files are used for installation of automatic
           system startup of Bacula daemons.</li>
     </ul>

<li>To rebuild a new version of <b>configure</b> from a changed <b>autoconf/configure.in</b>
    you enter <b>make configure</b> in the top level Bacula source
    directory. You must have done a ./configure prior to trying to rebuild
    the configure script or it will get into an infinite loop. </li>
<li>If the <b>make configure</b> gets into an infinite loop, ctl-c it, then do
    <b>./configure</b> (no options are necessary) and retry the 
    <b>make configure</b>, which should now work. </li>
<li>To rebuild <b>configure</b> you will need to have <b>autoconf</b> version
    2.57-3 or higher loaded. Older versions of autoconf will complain about
    unknown or bad options, and won't work. </li>
<li>After you have a working <b>configure</b> script, you may need to 
    make a few system dependent changes to the way Bacula works.
    Generally, these are done in <b>src/baconfig.h</b>. You can find
    a few examples of system dependent changes toward the end of this
    file. For example, on Irix systems, there is no definition for
    <b>socklen_t</b>, so it is made in this file. If your system has
    structure alignment requirements, check the definition of BALIGN in
    this file. Currently, all Bacula allocated memory is aligned on a <b>double</b>
    boundary.</li>
<li>If you are having problems with Bacula's type definitions, you might
    look at <b>src/bc_types.h</b> where all the types such as <b>uint32_t</b>,
    <b>uint64_t</b>, etc. that Bacula uses are defined.</li>
</ul>
 
<page_prev name="Bacula Developer Notes" url="developers.html">
<page_next name="Bacula Regression Testing" url="regression.html">
