How to use neon from your application
Prev | Chapter 1. Introduction | Next

## How to use neon from your application

This section describes how to add neon support to an application. If you just want to quickly try out neon, use the neon-config script.

The neon source code is designed to be easily embedded into an application source tree. neon has no dependencies on libraries other than an SSL toolkit and XML parser, though the source tree can be configured to have no support for SSL or XML if desired. To configure the neon source code some GNU autoconf macros are supplied, which can be used in a number of ways, as follows:

- autoconf macros are distributed in the 'macros' subdirectory of the neon distribution. Use the NEON_LIBRARY macro from your configure.in to check for the presence of the neon library installed on the system. The macro adds an '--with-neon=...' argument to configure, which allows the user to specify a location for the library (the standard /usr and /usr/local directories are checked automatically without having to be specified).

- The 'src' directory of the neon package can be imported directly into your application, if you do not wish to add an external dependency. If you wish to bundle, use the NEON_BUNDLED macro to configure neon in your application: here, the neon sources are bundled in a directory called 'libneon':

      NEON_BUNDLED(libneon, ...)

  If your application supports builds where srcdir != builddir, you should use the NEON_VPATH_BUNDLED macro like this:

      NEON_VPATH_BUNDLED(${srcdir}/libneon, libneon, ...)

  If you use this macro, a '--with-included-neon' option will be added to the generated configure script. This allows the user to force the bundled neon to be used in the application, rather than any neon library found on the system. If you allow neon to be configured this way, you must also configure an XML parser. Use the NEON_XML_PARSER macro to do this.

- The final argument to the _BUNDLED macros is a set of actions which are executed if the bundled build *is* chosen (rather than an external neon which might have been found on the user's system). In here, use either the NEON_LIBTOOL_BUILD or NEON_NORMAL_BUILD macro to set up the neon Makefile appropriately: including adding the neon source directory to the recursive make.

A full fragment might be:

    NEON_BUNDLED(libneon, [
      NEON_NORMAL_BUILD
      NEON_XML_PARSER
      SUBDIRS="libneon $SUBDIRS"
    ])

This means the bundled neon source directory (called 'libneon') is used if no neon is found on the system, and the standard XML parser search is used.

Prev | Up | Next
Feature list | Home | Example application