📄 install.doc
字号:
INSTALLATION INSTRUCTIONS for the Independent JPEG Group's JPEG software
Copyright (C) 1991-1996, Thomas G. Lane.
This file is part of the Independent JPEG Group's software.
For conditions of distribution and use, see the accompanying README file.
This file explains how to configure and install the IJG software. We have
tried to make this software extremely portable and flexible, so that it can be
adapted to almost any environment. The downside of this decision is that the
installation process is complicated. We have provided shortcuts to simplify
the task on common systems. But in any case, you will need at least a little
familiarity with C programming and program build procedures for your system.
If you are only using this software as part of a larger program, the larger
program's installation procedure may take care of configuring the IJG code.
For example, Ghostscript's installation script will configure the IJG code.
You don't need to read this file if you just want to compile Ghostscript.
If you are on a Unix machine, you may not need to read this file at all.
Try doing
./configure
make
make test
If that doesn't complain, do
make install
(better do "make -n install" first to see if the makefile will put the files
where you want them). Read further if you run into snags or want to customize
the code for your system.
TABLE OF CONTENTS
-----------------
Before you start
Configuring the software:
using the automatic "configure" script
using one of the supplied jconfig and makefile files
by hand
Building the software
Testing the software
Installing the software
Optional stuff
Optimization
Hints for specific systems
BEFORE YOU START
================
Before installing the software you must unpack the distributed source code.
Since you are reading this file, you have probably already succeeded in this
task. However, there is a potential for error if you needed to convert the
files to the local standard text file format (for example, if you are on
MS-DOS you may have converted LF end-of-line to CR/LF). You must apply
such conversion to all the files EXCEPT those whose names begin with "test".
The test files contain binary data; if you change them in any way then the
self-test will give bad results.
Please check the last section of this file to see if there are hints for the
specific machine or compiler you are using.
CONFIGURING THE SOFTWARE
========================
To configure the IJG code for your system, you need to create two files:
* jconfig.h: contains values for system-dependent #define symbols.
* Makefile: controls the compilation process.
(On a non-Unix machine, you may create "project files" or some other
substitute for a Makefile. jconfig.h is needed in any environment.)
We provide three different ways to generate these files:
* On a Unix system, you can just run the "configure" script.
* We provide sample jconfig files and makefiles for popular machines;
if your machine matches one of the samples, just copy the right sample
files to jconfig.h and Makefile.
* If all else fails, read the instructions below and make your own files.
Configuring the software using the automatic "configure" script
---------------------------------------------------------------
If you are on a Unix machine, you can just type
./configure
and let the configure script construct appropriate configuration files.
If you're using "csh" on an old version of System V, you might need to type
sh configure
instead to prevent csh from trying to execute configure itself.
Expect configure to run for a few minutes, particularly on slower machines;
it works by compiling a series of test programs.
Configure was created with GNU Autoconf and it follows the usual conventions
for GNU configure scripts. It makes a few assumptions that you may want to
override. You can do this by providing optional switches to configure:
* Configure will use gcc (GNU C compiler) if it's available, otherwise cc.
To force a particular compiler to be selected, use the CC option, for example
./configure CC='cc'
The same method can be used to include any unusual compiler switches.
For example, on HP-UX you probably want to say
./configure CC='cc -Aa'
to get HP's compiler to run in ANSI mode.
* The default CFLAGS setting is "-O". You can override this by saying,
for example, ./configure CFLAGS='-O2'.
* Configure will set up the makefile so that "make install" will install files
into /usr/local/bin, /usr/local/man, etc. You can specify an installation
prefix other than "/usr/local" by giving configure the option "--prefix=PATH".
* If you don't have a lot of swap space, you may need to enable the IJG
software's internal virtual memory mechanism. To do this, give the option
"--enable-maxmem=N" where N is the default maxmemory limit in megabytes.
This is discussed in more detail under "Selecting a memory manager", below.
You probably don't need to worry about this on reasonably-sized Unix machines,
unless you plan to process very large images.
Configure has some other features that are useful if you are cross-compiling
or working in a network of multiple machine types; but if you need those
features, you probably already know how to use them.
Configuring the software using one of the supplied jconfig and makefile files
-----------------------------------------------------------------------------
If you have one of these systems, you can just use the provided configuration
files:
Makefile jconfig file System and/or compiler
makefile.manx jconfig.manx Amiga, Manx Aztec C
makefile.sas jconfig.sas Amiga, SAS C
mak*jpeg.st jconfig.st Atari ST/STE/TT, Pure C or Turbo C
makefile.bcc jconfig.bcc MS-DOS or OS/2, Borland C
makefile.dj jconfig.dj MS-DOS, DJGPP (Delorie's port of GNU C)
makefile.mc6 jconfig.mc6 MS-DOS, Microsoft C version 6.x and up
makefile.wat jconfig.wat MS-DOS, OS/2, or Windows NT, Watcom C
makefile.mms jconfig.vms Digital VMS, with MMS software
makefile.vms jconfig.vms Digital VMS, without MMS software
Copy the proper jconfig file to jconfig.h and the makefile to Makefile
(or whatever your system uses as the standard makefile name). For the
Atari, we provide four project files; see the Atari hints below.
Configuring the software by hand
--------------------------------
First, generate a jconfig.h file. If you are moderately familiar with C,
the comments in jconfig.doc should be enough information to do this; just
copy jconfig.doc to jconfig.h and edit it appropriately. Otherwise, you may
prefer to use the ckconfig.c program. You will need to compile and execute
ckconfig.c by hand --- we hope you know at least enough to do that.
ckconfig.c may not compile the first try (in fact, the whole idea is for it
to fail if anything is going to). If you get compile errors, fix them by
editing ckconfig.c according to the directions given in ckconfig.c. Once
you get it to run, it will write a suitable jconfig.h file, and will also
print out some advice about which makefile to use.
You may also want to look at the canned jconfig files, if there is one for a
system similar to yours.
Second, select a makefile and copy it to Makefile (or whatever your system
uses as the standard makefile name). The most generic makefiles we provide
are
makefile.ansi: if your C compiler supports function prototypes
makefile.unix: if not.
(You have function prototypes if ckconfig.c put "#define HAVE_PROTOTYPES"
in jconfig.h.) You may want to start from one of the other makefiles if
there is one for a system similar to yours.
Look over the selected Makefile and adjust options as needed. In particular
you may want to change the CC and CFLAGS definitions. For instance, if you
are using GCC, set CC=gcc. If you had to use any compiler switches to get
ckconfig.c to work, make sure the same switches are in CFLAGS.
If you are on a system that doesn't use makefiles, you'll need to set up
project files (or whatever you do use) to compile all the source files and
link them into executable files cjpeg, djpeg, jpegtran, rdjpgcom, and wrjpgcom.
See the file lists in any of the makefiles to find out which files go into
each program. Note that the provided makefiles all make a "library" file
libjpeg first, but you don't have to do that if you don't want to; the file
lists identify which source files are actually needed for compression,
decompression, or both. As a last resort, you can make a batch script that
just compiles everything and links it all together; makefile.vms is an example
of this (it's for VMS systems that have no make-like utility).
Here are comments about some specific configuration decisions you'll
need to make:
Command line style
------------------
These programs can use a Unix-like command line style which supports
redirection and piping, like this:
cjpeg inputfile >outputfile
cjpeg <inputfile >outputfile
source program | cjpeg >outputfile
The simpler "two file" command line style is just
cjpeg inputfile outputfile
You may prefer the two-file style, particularly if you don't have pipes.
You MUST use two-file style on any system that doesn't cope well with binary
data fed through stdin/stdout; this is true for some MS-DOS compilers, for
example. If you're not on a Unix system, it's safest to assume you need
two-file style. (But if your compiler provides either the Posix-standard
fdopen() library routine or a Microsoft-compatible setmode() routine, you
can safely use the Unix command line style, by defining USE_FDOPEN or
USE_SETMODE respectively.)
To use the two-file style, make jconfig.h say "#define TWO_FILE_COMMANDLINE".
Selecting a memory manager
--------------------------
The IJG code is capable of working on images that are too big to fit in main
memory; data is swapped out to temporary files as necessary. However, the
code to do this is rather system-dependent. We provide five different
memory managers:
* jmemansi.c This version uses the ANSI-standard library routine tmpfile(),
which not all non-ANSI systems have. On some systems
tmpfile() may put the temporary file in a non-optimal
location; if you don't like what it does, use jmemname.c.
* jmemname.c This version creates named temporary files. For anything
except a Unix machine, you'll need to configure the
select_file_name() routine appropriately; see the comments
near the head of jmemname.c. If you use this version, define
NEED_SIGNAL_CATCHER in jconfig.h to make sure the temp files
are removed if the program is aborted.
* jmemnobs.c (That stands for No Backing Store :-).) This will compile on
almost any system, but it assumes you have enough main memory
or virtual memory to hold the biggest images you work with.
* jmemdos.c This should be used with most 16-bit MS-DOS compilers.
See the system-specific notes about MS-DOS for more info.
IMPORTANT: if you use this, define USE_MSDOS_MEMMGR in
jconfig.h, and include the assembly file jmemdosa.asm in the
programs. The supplied makefiles and jconfig files for
16-bit MS-DOS compilers already do both.
* jmemmac.c Custom version for Apple Macintosh; see the system-specific
notes for Macintosh for more info.
To use a particular memory manager, change the SYSDEPMEM variable in your
makefile to equal the corresponding object file name (for example, jmemansi.o
or jmemansi.obj for jmemansi.c).
If you have plenty of (real or virtual) main memory, just use jmemnobs.c.
"Plenty" means about ten bytes for every pixel in the largest images
you plan to process, so a lot of systems don't meet this criterion.
If yours doesn't, try jmemansi.c first. If that doesn't compile, you'll have
to use jmemname.c; be sure to adjust select_file_name() for local conditions.
You may also need to change unlink() to remove() in close_backing_store().
Except with jmemnobs.c or jmemmac.c, you need to adjust the DEFAULT_MAX_MEM
setting to a reasonable value for your system (either by adding a #define for
DEFAULT_MAX_MEM to jconfig.h, or by adding a -D switch to the Makefile).
This value limits the amount of data space the program will attempt to
allocate. Code and static data space isn't counted, so the actual memory
needs for cjpeg or djpeg are typically 100 to 150Kb more than the max-memory
setting. Larger max-memory settings reduce the amount of I/O needed to
process a large image, but too large a value can result in "insufficient
memory" failures. On most Unix machines (and other systems with virtual
memory), just set DEFAULT_MAX_MEM to several million and forget it. At the
other end of the spectrum, for MS-DOS machines you probably can't go much
above 300K to 400K. (On MS-DOS the value refers to conventional memory only.
Extended/expanded memory is handled separately by jmemdos.c.)
BUILDING THE SOFTWARE
=====================
Now you should be able to compile the software. Just say "make" (or
whatever's necessary to start the compilation). Have a cup of coffee.
Here are some things that could go wrong:
If your compiler complains about undefined structures, you should be able to
shut it up by putting "#define INCOMPLETE_TYPES_BROKEN" in jconfig.h.
If you have trouble with missing system include files or inclusion of the
wrong ones, read jinclude.h. This shouldn't happen if you used configure
or ckconfig.c to set up jconfig.h.
There are a fair number of routines that do not use all of their parameters;
some compilers will issue warnings about this, which you can ignore. There
are also a few configuration checks that may give "unreachable code" warnings.
Any other warning deserves investigation.
If you don't have a getenv() library routine, define NO_GETENV.
Also see the system-specific hints, below.
TESTING THE SOFTWARE
====================
As a quick test of functionality we've included a small sample image in
several forms:
testorig.jpg Starting point for the djpeg tests.
testimg.ppm The output of djpeg testorig.jpg
testimg.gif The output of djpeg -gif testorig.jpg
testimg.jpg The output of cjpeg testimg.ppm
testprog.jpg Progressive-mode equivalent of testorig.jpg.
testimgp.jpg The output of cjpeg -progressive -optimize testimg.ppm
(The first- and second-generation .jpg files aren't identical since JPEG is
lossy.) If you can generate duplicates of the testimg* files then you
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -