jpeg shared library for Atari (MiNT/MagiC)
==========================================

This is an attempt to make libjpeg, which is used widely by several applications,
available as a shared libary for Atari.

The goal here was to make it as easy as possible to switch from linking a
static version, to use the shared version instead. Remember though that
neither the OS nor the compilers in use have direct support for that,
and that the application needs to support it.


How to use it:
==============

for GCC:
Install the header files from the include directory to /usr/include (or
to your cross installation directory), the libraries to /usr/lib, and
the executables from /mint/slb to a directory where Slbopen can find them
(usually also /mint/slb, or c:/gemsys/slb)

In your application:
- Define -DJPEG_SLB before including jpeglib.h, or include slb/jpeg.h instead
  (both should have the same effect)
- add a call to slb_jpeglib_open() before using any function from jpeg. Optionally,
  you can pass in a library search path that is passed along to Slbopen().
- for completeness, you can also add a call to slb_jpeglib_close() before your
  application terminates.
- link to libjpeg.slb.a instead of the normal libjpeg.a
- use any function from libjpeg as usual. No need to pass any extra parameters.

For Pure-C:
Same as for GCC, except:
- You can use the header files from the purec/include directory instead. They
  are identical to the ones for GCC, just converted to have CR/LF endings.
- The static libraries are named jpeg6.lib, jpeg7.lib, and jpeg8.lib.
  The import libraries for the shared libraries are jpegslb6.lib, jpegslb7.lib,
  and jpegslb8.lib. The provided jpeglib.h header file is for version
  8 of the library, so by default you should link against this.

That's all!

Note that slb_jpeglib_open() contains fallback code for systems lacking Slbopen(),
so this should work even on SingleTOS.



Files in the archive:
=====================

usr/include/jpeglib.h
usr/include/jconfig.h
usr/include/jerror.h
usr/include/jmorecfg.h
    Slightly modified versions from the files of the original distribution,
    intended to be usable for both static and shared linking.
    Note that, expect for the version information, they should
    be identical for 6b, 7 and 8d.
usr/include/slb/jpeg.h
    Include file for using the shared library, with declarations of the above
    mentioned functions.
usr/lib/libjpeg6b.a
usr/lib/libjpeg7.a
usr/lib/libjpeg8d.a
    Static versions of the library
usr/lib/libjpeg6b.slb.a
usr/lib/libjpeg7.slb.a
usr/lib/libjpeg8d.slb.a
    Import libraries for using the shared library instead
usr/lib/m68020-60/libjpeg6b.a
usr/lib/m68020-60/libjpeg7.a
usr/lib/m68020-60/libjpeg8d.a
    Static versions of the library, compiled for 68020 or better
usr/lib/m68020-60/libjpeg6b.slb.a
usr/lib/m68020-60/libjpeg7.slb.a
usr/lib/m68020-60/libjpeg8d.slb.a
    Import libraries for using the shared library instead,
    compiled for 68020 or better
usr/lib/m5475/libjpeg6b.a
usr/lib/m5475/libjpeg7.a
usr/lib/m5475/libjpeg8d.a
    Static versions of the library, compiled for coldfire
usr/lib/m5475/libjpeg6b.slb.a
usr/lib/m5475/libjpeg7.slb.a
usr/lib/m5475/libjpeg8d.slb.a
    Import libraries for using the shared library instead,
    compiled for coldfire
usr/bin/*
    Some test/example programs from the original distribution.
    These are linked for the shared library.

purec/include:
    Header files for Pure-C. Same as for GCC, just converted to have CR/LF endings.
purec/lib/000/jpeg6.lib
purec/lib/000/jpeg7.lib
purec/lib/000/jpeg8.lib
    Static versions of the library
purec/lib/000/jpegslb6.lib
purec/lib/000/jpegslb7.lib
purec/lib/000/jpegslb8.lib
    Import libraries for using the shared library instead
purec/lib/020/jpeg6.lib
purec/lib/020/jpeg7.lib
purec/lib/020/jpeg8.lib
    Static versions of the library, compiled for 68020 or better
purec/lib/020/jpegslb6.lib
purec/lib/020/jpegslb7.lib
purec/lib/020/jpegslb8.lib
    Import libraries for using the shared library instead,
    compiled for 68020 or better
    
mint/slb
    The shared library itself. Use the one appropiate for your system.
    Those were compiled by GCC, but can be used also by Pure-C.


Exported functions:
===================

#0: long jpeglib_slb_control(long fn, void *arg)
    - used internally by slb_jpeglib_open() to check that
      the correct version of the library was loaded

everything else:
    - all functions publicitly available from jepglib.h.
      Consult that header file, or the man page on
      how to use them.


Known bugs:
===========

- Although the handle of the shared library and its corresponding exec
  function are available to the application, the exec function
  cannot be directly called. Always use the import functions
  (they cover all available functions, anyway).

- When using the library with Pure-C, you may have to change some variables
  from plain "int" to "jint_t". This is because the library was
  compiled by gcc, and sizeof(int) differs between the two. Look at
  cjpeg.c/djepg.c from the source archive where that changes have already been
  made.

- That would also apply to gcc when compiling with --mshort, but you
  shouldn't do that.

- Some transformation functions can use float functions. The operations
  are only basic ones, like adding, subtracting etc. When using the shared
  library, these are already linked into that library. When using the
  static library, you have to link against pcfltlib.lib (the static
  libraries were compiled without 68881 support)

- The source archive also contains code for jpeg-9c. Since that is
  incompatible with turbojpeg found in most linux distributions,
  pre-compiled binaries for this are not provided.

- Certain symbols defined in jpeglib.h/jmorecfg.h may conflict with
  system headers. This is not a bug of this port, but a shortcoming
  of the original API. You have to watch out for definitions of
  - LOCAL (often defined in portab.h)
  - GLOBAL (often defined in portab.h)
  - EXTERN (often defined in portab.h)
  - INLINE (often defined in portab.h)
  - INT16 (for example defined in mt_gem.h)
  - UINT16
  - INT8
  - UINT8
  - INT32
  - boolean
