
	$Id: INSTALL 23551 2010-09-13 21:00:46Z jimg $

Updated for version 3.11.0 of the OPeNDAP DAP 3.4 library software.

Installing the DAP2/3.x library

---------------------------------------------------------------------------

BUILDING THE SOFTWARE
REQUIREMENTS
NOTES

---------------------------------------------------------------------------

BUILDING THE SOFTWARE

  To build the OPeNDAP DAP2/3.x library and the getdap client program, follow
  these steps:

  0. Please skim REQUIREMENTS and NOTES sections of this file
     before reporting problems. Thanks.

  1. Type `./configure' at the system prompt. On some systems you may have
     to type `sh configure'.

  2. Type `make' to build the library, `make check' to run the tests.
     You must have CppUnit to run `make check.' On a Mandrake/Mandriva
     system, you need to copy or link conf/config.guess into the
     'tests' directory and then run the tests.

  3. Type `make install' to install the library files. The libraries
     (libdap.a. libdapclient.a and libdapserver.a, etc.), their header files and
     the getdap and dap-config utilities install under /usr/local/ in lib,
     include/libdap and bin by default. Use the --prefix option to specify a
     different root directory. For example, './configure
     --prefix=/opt/opendap' would set the build so that the library was
     installed in /opt/opendap/lib, ...

Building from Our SVN Repository

  If you are building from a SVN checkout, run 'autoreconf --install'
  before './configure; make'. Using --verbose might be useful if there
  are errors running configure. If you try to run autoconf, et c., by
  hand and wind up with build files that don't work, use 'autoreconf
  --force --verbose --install' and then './configure; make'. Also
  included in SVN is a script which runs the auto* tools one by one
  called autogen.sh. At one time this seemed to be a better way to do
  things, but now autoreconf seems the most reliable tool for
  bootstrapping the auto tools.

  Make certain that you have recent versions of autoconf, automake and
  libtool.

AFTER INSTALLING

  o Set the PATH environment variable to include the bin directory where
    libdap was installed. For example, if using the default installation
    directory, which is /usr/local, make sure that /usr/local/bin is on your
    path. This is important because often libdap is built so that some other
    software can then be built, but without setting PATH, those other
    packages might not detect the newly installed libdap.

  o Set the LD_LIBRARY_PATH environment variable to include the lib directory
    where libdap was installed. For example, if using the default
    installation directory, which is /usr/local, make sure that
    /usr/local/lib is part of LD_LIBRARY_PATH. If you have set $prefix so
    that the libraries are installed in a directory that's included in
    ld.so.conf (on linux; other systems may use a slightly different name)
    you don't have to use LD_LIBRARY_PATH but, but if you don't use
    LD_LIBRARY_PATH, **make sure to re-run ldconfig**.

REQUIREMENTS

  o To build from a fresh SVN checkout, you'll need automake 1.11, autoconf
    2.63 and libtool 2.2.6. Earlier versions may work, but may cause
    problems, particularly with the 'distcheck' target for make. Given those
    requirements, use 'autoreconf --force --verbose' and then build as
    described above. You also need bison and flex as of version 3.7.9. If you
    don't have these tools, you can try the copies of the generated files
    in the 'grammarfiles' directory.

  o The library uses libcurl and libxml2. You will need these libraries
    installed on your system to successfully run configure and build the
    library. You must have libcurl version 7.10.6 or newer and libxml2 2.6.16
    or newer. We provide source versions of the packages on the web site; the
    web pages for these projects are: http://curl.haxx.se/ and
    http://xmlsoft.org/. Modern Linux and recent OS/X distributions include
    these libraries.

  o If you are concerned about introducing problems with your OS's package
    system, build and install curl, et c., into a special directory (e.g.,
    /opt/opendap/) and then be sure to set PATH to include the curl-config
    and xml2-config scripts before running configure (e.g., run configure as
    'PATH="$PATH:/opt/opendap/bin';./configure'). You probably should install
    libdap.a under /opt/opendap as well, so set prefix to that path:
    
	'PATH="$PATH:/opt/opendap/bin';./configure --prefix=/opt/opendap'

  o You should have gcc/g++ 2.95.x or greater (really, you should probably be
    using gcc/++ 4.x, but you _can_ use 2.95 on our code). You'll also need
    to get the stdc++ library that matches the compiler (whatever version).
    NB: gcc 2.8.x and earlier *won't* build the software. We're working on
    modifying the software so that it will build with a variety of compilers.
    As of 01/22/03 we have built the code using Microsoft's Visual C++ 6.0
    and GNU gcc/++ 3.2.1, 3.3, 3.4, 4.0, ..., 4.4. The library has also been
    built using the native AIX compiler; see INSTALL.AIX.

  o We ship the C++ source files generated using bison and flex so these
    programs are no longer required to build the source code. However, to
    build the C++ sources from the grammar files, you'll need bison 1.25 and
    flex 2.5.4.

NOTES

  o Check for other INSTALL.* files to see if there's information specific to
    your OS (e.g., AIX).
    
  o If you are building on a new platform (one for which we don't supply
    binaries), please run the tests and tell us about any failures. To do a
    really complete job of this you'll need to get the GNU test system called
    DejaGNU and the CppUnit unit testing package. It is very simple to
    install these and we're very willing to help, so don't be shy!

  o If you are developing code that uses the DAP, get autoconf and subversion
    (SVN). We maintain a SVN-managed source tree that people outside the
    group may access. See http://scm.opendap.org:8090/trac/

  o The gnulib software is used to provide replacement functions when
    autoconf detects that is necessary. To update the gnulib, check it out
    from CVS and run '$gnulib_home/gnulib-tool --lgpl --import' in this
    directory. Macros in configure.ac supply gnulib-tool with all the
    information it needs. Only developers working on libdap should ever have
    to do this.

  o To build a rpm file for a source or binary distribution use 'make rpm' or 
    'make srpm'. These targets should run 'make dist' to build the required
    tar.gz file first. You may need root privileges for these targets to work.
    
  o To build a Mac OS/X package, use the 'pkg' target. Read over the target
    to get a feel for how it works. You will need PackageMaker, which should
    already be installed on your system, and you will need DropDMG, which
    can be obtained at http://c-command.com/dropdmg/. The target has been
    automated to generate a ReadMe.txt file, update the Info.plist file, run
    PackageMaker and DropDMG.

  o DEBUGGING AIDS

    - The DAP API includes the following debugging aids that may be of help
      to you in developing new OPeNDAP applications.

    - DBG: simple program instrumentation -- see the file debug.h.

    - DBG2: more elaborate program instrumentation -- by convention this is
      used for output that is half a page or more, while DEBUG is used for
      single line output.

    - In the past we used efence and dbnew to help debug dynamic memory
      programming errors. We are now using valgrind and suggest you do the
      same. On some Linux platforms you should export MALLOC_CHECK_=0 in the
      shell before running valgrind. This is true for the unit tests and may
      be true for other code. You'll also notice that the Makefile contains
      CXX and C compile-time flags for debugging. These will greatly simplify
      using valgrind and/or a debugger. To use these, don't hack up the
      Makefile.am. Instead export CXXFLAGS with the values you want and then
      run configure. For example:

	  export CXXFLAGS="-g3 -O0 -Wall -fno-defer-pop"; ./configure

    - To build with program instrumentation use `--enable-debug=<level>'
      where <level> is 1 or 2.
