I. ***** GENERAL REQUIREMENTS *****

The following software may be required to configure, compile and install
GNU software packages on your hard disk. Some of them are required for
every package, others may be optional. However, I recommend to install
them all.
Note: Some OS/2 ports may be broken in some way.
Note: For all packages you only have to copy the *.exe file into a directory
      in your PATH (sometimes a .exe file must be renamed) and to copy 
      the *.dll files into a directory in your LIBPATH. Only perl requires 
      an environment variable.
Note: You can also install newer versions of the required packages, of course.
Note: The description of the configuration and installation process 
      (Section III. - V.) of this README file only applies to packages from
      ftp.gnu.org or OS/2 ports of them using the same installation mechanism.


You can find the following precompiled software on hobbes.nmsu.edu or ftp.leo.org:

- GNU File Utilities (gnufutil.zip)
  Note: Rename install.exe into ginstall.exe. Then you must put EITHER
        the directory of ginstall.exe BEFORE X:\OS2\INSTALL into your
        PATH (recommended) OR you must call the configure script every
        time with "INSTALL=ginstall ... ./configure ..."
        Otherwise configure may be confused with OS/2's install.exe.
  Note: Some of these packages below may have DLL's of the same name.
        It (hopefully) does not matter which one you install.

- GNU Text Utilities (gnututil.zip)

- GNU Shell Utilities (gnusutil.zip)

- GNU grep (gnugrep.zip)

- GNU sed (gnused.zip)

- A sh compatible shell. No matter which one you use all current OS/2 ports
  are broken in some way. :-(
  - ash (ashos2.zip): a good and fast shell but it will fail with newer
    configure scripts (autoconf 2.52 and higher).
  - bash (bash-os2-2.0-266.zip): it will work unless you use "make distclean"
    or other unusual make targets.
  - ksh 5.2.7 (ksh527rt.zip): Works fine but the PATH is corrupted. You have
    to replace backslashes by forward slashes. This can be a bit tricky
    (see section II).

  I recommend to use ksh 5.2.7.
  Note: Copy the shell (ksh.exe) into \bin\sh.exe of the same drive where you
        want to unpack the source code.

- GNU texinfo (gnuinfo.zip)
  Note: This version of GNU info seems to be sufficient to install the
        GNU info documentation of all current software packages, but
        it may fail in displaying the .info files. If you want to read
        the new installed .info files you may have to install a newer
        version of texinfo, e.g. texinfo 4.0 (texinfo-4_0.zip)
  Note: info.exe and makeinfo.exe from the emx-gcc distribution are also
        outdated.

- GNU awk (gnugawk.zip: gawk-emx.exe -> awk.exe)

- GNU m4 (gnum4.zip)

- Perl (any version, e.g.: perlx.exe ->perl.exe, perl5.exe not required, no dll required)

- GNU make (make-1_76_1s.zip)
  Note: All current OS/2 ports of GNU make will fail with a lot of autogenerated
        Makefiles. I have provided a special patch of GNU make 2.76.1 that can
        be used. It should be somewhere on hobbes.nmsu.edu or ftp.leo.org.

- GNU tar (optional)

- GNU gzip (optional)

- unzip

- gcc (any version)

- EMX runtime library

For developers only:

- autoconf 2.50 or higher (autoconf-2_50.zip or autoconf-2_50-r?.zip)

- automake 1.4 patch 5 or higher (automake-1_4-p5.zip or automake-1_4-p5-r?.zip)




II. ***** PREPARATION OF THE CONFIGURE PROCESS *****

1. Make sure all of the above mentioned software is installed somewhere in 
   your PATH.

2. Make sure you have a ksh port copied to X:\bin\sh.exe if X: is your current
   drive.

3. Unpack the source code you want to compile:
   Example: "unzip autoconf-2_50.zip" or "tar -xvzf autoconf-2_50.tar.gz"

4. Change into the source directory and start ksh.

5. export EMXSHELL=ksh

6. A lot of configure scripts may create and delete hundreds of temporary
   files. You can speed up your system if you turn off the DELDIR feature:
   export DELDIR=




III. ***** GENERAL INSTALLATION INSTRUCTIONS *****

This section describes how to configure, compile and install GNU
software packages that are provided as source code. This applies to software
from ftp.gnu.org and to OS/2 ports of it that use the same installation
mechanism.


1. Look if there are the following files in the current directory:
   configure, aclocal.m4. If this is the case follow the
   installation instructions below.


2. Run "./configure --help" and have a look if you need a special option.
   Normally you need at least a prefix directory (i.e. the directory where
   you want to install the software). 


3. NLS support:
   If NLS is supported you can choose the languages to be installed.
   To install support for English, German and French only enter:   
   export LINGUAS="en de fr"
   If you don't specify LINGUAS all languages are installed.
   If you don't want NLS support (English only) use the option
   --disable-nls for the configure script.
   If want to install NLS support, you have two choices:
   (i) Either: First install the GNU gettext library and use it for NLS. (recommended,
       no additional configure option necessary)
   (ii) Or: Use the included GNU gettext library (configure option:
        --with-included-gettext)


4. You may have to set some environment variables to modify the compiler
   options. You generally have two options:

   a) The simple case: create DOS/OS/2 combined executables.
      You will get large executables with debug code.
      Set the following environment variables:
      CFLAGS="-O2 -s -Zmt -D__ST_MT_ERRNO__"
      
   b) More complicated: OS/2 only executables (OMF)
      You will get smaller, dynamically linked, compressed executables
      without debug code. This is recommended, but it is not supported
      by every package. If you run into trouble, use method a).
      Set the following environment variables:
      CFLAGS="-O2 -s -Zomf -Zmt -D__ST_MT_ERRNO__"
      LDFLAGS="-Zcrtdll -Zlinker /exepack:2 -Zlinker /pm:vio"
      RANLIB="echo"
      
      if you're using gcc/pgcc 2.95 or higher you may want to set also
      LIBS="-lgcc"
      Then your program will not require the compiler dependent library gcc????m.dll, 
      but your executable may (or may not) increase in size.


5. Start the configure process (you may need more configure options):
   If you want to install this software into subdirectories of x:/usr
   enter the following:

   a) ./configure --prefix=x:/usr

   b) ./configure --prefix=x:/usr

   Executables will be installed later into x:/usr/bin,
   libraries into x:/usr/lib and so on. You can also install the
   software into the root directory of drive X:, use --prefix=x: for
   this purpose (never use trailing slashes).
   If your source code is prepared for use with OS/2 the configure script
   will run and finally create the Makefiles. Otherwise jump to section IV.


6. Run "make":

   a) make

   b) make AR=emxomfar


7. Remove the debug code from the executables (optional, only method a), recommended). 
   If you have set $CFLAGS yourself like stated in 4. you can skip 7.

   a) Change into all directories containing new executables and enter:

      for i in *.exe; do strip -o $i.aout $i && emxbind -o $i $i.aout && rm $i.aout; done

      Note: This is only necessary if you didn't specify your $CFLAGS like
            mentioned in III.4.a)

   b) nothing to do


8. Run "make -n install". This will display all commands that would be
   executed for the final installation step. If you see wrong paths
   you may have called "configure" with the wrong options


9. If you run into trouble you can delete all object files with "make clean".
   You can also remove _all_ files that have been generated using
   "make distclean".
   Note: Sometimes very strange things may happen if you run make with
         "distclean" or other unusual targets. This seems to be due to bugs
         in the OS/2 ports of GNU make.
   Back to step 4.


10. If you are sure it's all right run "make install".



V. ***** PORTING GNU SOFTWARE PACKAGES TO OS/2 *****

If you have downloaded a package from ftp.gnu.org then it may be not prepared
for use with OS/2 and the configure script will fail most likely.

1. configure fails because the system type or host type can't be determined.
   Solution: replace config.guess and config.sub by newer versions.
   (You can use the files from this package)

2. Most likely you have to replace also the file mkinstalldirs. You can use
   the file from this package.
   Note: This script is required for the installation process only.

3. configure fails because program "foo" can't be found, but "foo" is in your
   PATH. Reason: your configure script can't deal with .exe extensions.
   You have to install autoconf to create a new configure script
   (I recommend autoconf 2.50 or newer).

4. autoconf is installed on your system.
   Run "EMXSHELL=ksh autoconf".
   Some older packages are not 100% compatible with autoconf 2.50 or higher.
   You may get an error message like 

   ./aclocal.m4:470: error: m4_defn: undefined: _m4_divert_diversion
   acoldnames.m4:86: AM_PROG_INSTALL is expanded from...
   ./aclocal.m4:470: the top level

   If there is a file acinclude.m4 edit this file, otherwise
   edit aclocal.m4. Search for a line similar to
   "AC_DEFUN(AM_PROG_INSTALL,". Simply insert the line
   "undefine([AM_PROG_INSTALL])" before it and run autoconf again.

5. If the configure script still fails, you are in trouble. Most likely OS/2
   is missing a feature that is required for this specific software or
   there is a bug in the file acinclude.m4 or aclocal.m4. Fix it.
   If you want to add a test for the existence of a header file foo.h or
   a function foo(), add the following lines to acinclude.m4 (or aclocal.m4):
   AC_CHECK_FUNCS([foo])
   AC_CHECK_HEADERS([foo.h])

   Then you will have the following preprocessor macros in available in each 
   C source file:
   HAVE_FOO (if foo() is available, otherwise it is undefined)
   HAVE_FOO_H (uf foo.h exists, otherwise it is undefined)
    
6. If "make" fails, check the following:
   - Check for the lines "AC_OBJEXT" and "AC_EXEEXT" in configure.in, add them
     if they are missing

7. You can find general general hints who to port an application to OS/2 there:
   http://homepages.tu-darmstadt.de/~st002279/os2/porting.html

8. After you have changed configure.in, acinclude.m4 or aclocal.m4 enter the
   following (autoconf and automake must be installed):
   aclocal  (reads acinclude.m4 and overwrites aclocal.m4)
   automake (reads aclocal.m4, Makefile.am and overwrites Makefile.in)
   autoheader (reads aclocal.m4 and overwrites config.h.in)
   autoconf (reads configure.in, aclocal.m4 and overwrites configure)

9. If there are no patches for OS/2 in the source code "make" may fail.
   Even if it compiles there may be some restrictions in usage.


VI. Special features/bug fixes for this text utilities 2.0 release

Support for %UNIXROOT%                  not necessary
NLS support for messages                yes (some of the message files seem to be defect)
NLS support for the program itself      not necessary (?)


--

Maintainer: Andreas Buening, <buening@nexgo.de>

