Agar Logo

   <-- Back to Documentation

Installing Agar on other Unix-like platforms - LibAgar

This guide describes how to compile and install libagar under Unix-like platforms other than Linux and *BSD. Before compiling, you might want to search the ports/packages collection for an Agar package. However, if an available package is outdated compared to the most recent release of Agar, we recommend installing from source instead.

Prerequisites

Agar works best with OpenGL and the FreeType font engine installed. Provided that you have a modern X.org installation, those components should be already installed on your system.

Agar uses the native X.org API by default, but Agar applications can be made to work over SDL 1.2 as well.

Some optional Agar features also make use of the jpeg, png and iconv libraries if they are available.

Compilation under SGI IRIX

Under the SGI IRIX platform, we recommend compiling Agar using gcc3 or SGI cc (there are varargs-related problems with gcc 2.95). You can download .tardist packages gcc3 (as well as SDL, freetype, etc.) from nekochan.net.

Installation Procedure

First download the Agar source package and unpack it to a temporary location:

  $ wget http://stable.hypertriton.com/agar/agar-1.7.0.tar.gz
  $ tar -xzf agar-1.7.0.tar.gz
  $ cd agar-1.7.0

Then configure and compile the sources. There are a number of build options available (see ./configure --help), but the defaults should be fine unless you have specific requirements. The --enable-debug option is recommended for developers since it enables run-time assertions and type safety checking. --disable-threads will improve performance is thread-safety is not needed.

  $ ./configure --prefix=$HOME    # Install to some alternate location
  $ ./configure --enable-debug    # For developers
  $ ./configure --disable-threads # Disable support for multithreading
  
  $ make all

Finally, install the library. This will install under the /usr/local by default (you can use the configure option --prefix to install to an alternate location).

  # make install

On some platforms, installing shared libraries requires that you refresh the dynamic linker cache. Refer to your operating system's documentation on how to do this.

Testing Agar

You can test that Agar is working using a simple hello.c program like so:

  #include <agar/core.h>
  #include <agar/gui.h>
  
  int
  main(int argc, char *argv)
  {
          AG_Window *win;
          
          if (AG_InitCore(NULL, 0) == -1 ||
              AG_InitGraphics(0) == -1) {
                  AG_Verbose("Init failed: %s\n", AG_GetError());
                  return (1);
          }
          win = AG_WindowNew(0);
          AG_LabelNew(win, 0, "Hello, world!");
          AG_WindowShow(win);
          AG_EventLoop();
          return (0);
  }

Compile this example using:

  $ cc -o hello `agar-config --cflags` hello.c `agar-config --libs`

The tests directory contains a test suite named agartest:

  $ cd tests
  $ ./configure && make
  # make install

  $ ./agartest
  $ ./agartest -C                       # Console output to terminal
  $ ./agartest -s blue.css              # Alternate stylesheet
  $ ./agartest -t Courier:12            # Alternate font
   
  $ ./agartest -d sdlfb                 # Alternate graphics backend (SDL)
  $ ./agartest -d 'glx(stereo)'         # Stereoscopic display under X
  $ ./agartest -d 'sdlgl(out=%08d.jpg)' # Capture frames to JPEG files

Csoft.net ElectronTubeStore