# Installation

A few words on installation on various platforms:

UNIX:
  Type “configure”, “make” and finally “make install”. To make sure everything proceeded correctly, type “make check”. If you don't have superuser privileges and thus access to the default system areas, you should type “configure --help” to help you set up correct paths.

  If you haven't installed any software like this before, that is distributed in source form, here are some guidelines to help you install it locally at your account. Please note that a mail to the system administrator may be less work for you.

  We assume that you have put the archive (“chktex.tar.gz”) in a subdir of yours, with path “˜/tmp”. We further assume that your shell is “csh” or “tcsh”. Do the following:

  1. First of all, unpack the archive contents.

         > cd ~/tmp
         > gunzip chktex.tar.gz
         > tar xf chktex.tar

  2. Now, we can configure the program. There are some configuration options you should know about:
     “--enable-pcre”:
       Allows using PCRE (perl compatible regular expressions) for use defined warnings. The default is to use PCRE if it is installed on your system as determined by “pcre-config”. You can use “--disable-pcre” if you plan to distribute this for systems in which you cannot ensure PCRE will be installed.

       User defined regular expressions are defined using UserWarnRegex in the “chktexrc” file. See warning 44 for more information.

     “--enable-lacheck-replace”
       This enables a quick hack for using ChkTeX instead of lacheck. This is done by installing a stub script which “overrides” the original lacheck executable. In this way, tools which support lacheck can be easily made to support chktex instead.

     “--enable-debug-info”
       ChkTeX has an ability to spit out various diagnostic messages using the “-d” flag. This behaviour is on by default. By adding the flag “--disable-debug-info” to the commandline, this will not be compiled in.

       This may be useful if you're running short of disk space (the time savings are neglible).

     If you are installing the program on your local account, use the following command:

         > configure --prefix ~/

     Add eventual extra flags as specified above. This command will generate a significant amount of output, this can usually be ignored.

  3. Finally, we can just build the program and install it.

         > make
         > make install

  4. Finished! The program is now installed and ready to use. You may now tell other people to put your bindir in their path in order to benefit from your work. All that remains is to make the shell aware of your installation.

         > rehash

     To make the remaining parts of your system aware of this, you'll have to log out and re-log in, I'm afraid. However, you should delay this until you've completed this installation procedure.

  5. If you wish to make sure that everything is OK (you ought to), you may now ask ChkTeX to do a self-test:

         > make check

Other platforms:
  First of all, you have to copy the “config.h.in” file to a file named “config.h”. Then, edit it to reflect your system. Do the same with “OpSys.h” (this file has been reduced significantly). If you wish, you may define “DATADIR” to the path you want the global resource file to be put.

  Now, I would suggest that you take a peak at the “OpSys.c” file, and edit it appropiately, for more comfort. This should not be necessary, though, at least not the first time.

  Finally, you may now compile and link all `.c`files. Do not forget to define “HAVE_CONFIG_H” to 1 (on the command-line, for instance). If the “config.h” you wish to use has another name, define “CONFIG_H_NAME” to that (in that case, don't define “HAVE_CONFIG_H”).

  Put the directory path of the “chktexrc” file in a environment variable named “CHKTEXRC”. The files “deweb.in” and “chkweb” should be moved to a directory in your path. These files may need further setup, as they haven't got the location of perl initialized.

  If your compiler/the compiled program complains (or crashes!), you may try the hints listed below. Please note that it only makes sense to try these hints if your compiler fails to produce a working program.

  1. Increase the preprocessor buffers and line buffers. The ChkTeX sources define macros sized 3–4k (expanding to about the same), and passes arguments sized about 1k.
  2. Use the magic switch which lets us use large “switch(...){...}” statements; some of these statements have about 120 “case” entries.
  3. The sources require that at least the first 12 of each identifier is significant.

Subsections

- - - Note: