home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rximc175.zip / README.make < prev    next >
Text File  |  1999-02-10  |  23KB  |  457 lines

  1.                          Installation of REXX/imc
  2.  
  3. Note: The installation procedure for REXX/imc >= 1.6d is different from that
  4. of previous versions.  It was written in collaboration with Pierre Fortin.
  5. We hope that the new installation procedure is simpler than the old one.
  6.  
  7. In general, if you just type "Make" (capital M and without the quotes) on
  8. one of the platforms supported by REXX/imc then you should get a working
  9. copy of REXX/imc which you can test (note that if "." isn't on your path
  10. then you will have to type "./Make" instead of "Make").  If you type
  11. "Make install" then REXX/imc will be installed in a system directory.  A
  12. list of tested platforms with some notes about one or two irregularities
  13. discovered can be found in README.platforms.  Please check this to see
  14. whether there is anything you should be aware of.
  15.  
  16. Of course, things are rarely as simple as they are supposed to be, so a
  17. few notes follow.  You should probably scan through them before starting
  18. (especially the first one).  But before the notes, here are some tests that
  19. you can try to see whether REXX/imc is working properly.
  20.  
  21.  (a) rexx -v
  22.  
  23.      The simplest test, which just tells you whether the program was
  24.      successfully compiled.  It should give you the version info.  If
  25.      you have problems at this stage, see the note below about "librexx"
  26.      files.  Note that if "." isn't on your PATH then you will have to say
  27.      "./rexx" instead of just "rexx".
  28.  
  29.  (b) rexx rexxcps
  30.  
  31.      This program by Mike Cowlishaw tests most of the main control structures
  32.      of Rexx and in addition tells you how fast it is running.
  33.  
  34.  (c) rexx rexxtest
  35.  
  36.      This runs a cursory check on most of the REXX/imc functions to make sure
  37.      all is OK.
  38.  
  39.  (d) rexx -s 'numeric digits 25;say sqrt(2)'
  40.  
  41.      This will check that the math library is working OK.  You may need to
  42.      set the environment variable REXXLIB to "." first so that the just-
  43.      compiled library can be found.  If the rxmathfn.rxlib file from the
  44.      source package is not in the current directory, make a copy of it.
  45.      If the math library was not compiled then set REXXLIB to point to
  46.      the source directory and the supplied Rexx program should provide
  47.      the answer.  The expected answer is 1.414213562373095048801689.
  48.  
  49. ====================
  50. Notes on Compilation
  51. ====================
  52.  
  53. Contents:  1. Which compiler and other configuration options
  54.            2. Final locations of object files
  55.            3. The librexx library files
  56.            4. Removing the object files
  57.  
  58. 1. Which compiler and other configuration options
  59.  
  60.    There are a few variables at the top of the Make program which you can
  61.    configure.  One of these is CC, which gives the name of the compiler.
  62.    In general it is probably best to use the Gnu compiler gcc if you have
  63.    it, except on HP-UX, IRIX and OSF1 platforms, where cc is better.  HP-UX
  64.    also has c89 (apparently).  Note that the program does not always know
  65.    the correct options for the compiler you choose and might have to guess
  66.    (you will get a warning in that case).
  67.  
  68.    REXX/imc allows you to do the compilation in a different directory from
  69.    where the source is kept.  If you do this then change SRC to point to the
  70.    directory containing the source.  Note that there are some systems on
  71.    which this doesn't work.
  72.  
  73.    Any general flags that should be passed to the C compiler during the
  74.    compile or link phase can be put in COMPILEFLAG or LINKFLAG respectively
  75.    (this is not usually necessary).
  76.  
  77.    When REXX/imc starts it usually adds ".rexx" to the filename.  This
  78.    can be changed to a different extension (such as ".exec" or ".cmd")
  79.    at run time with the REXXEXT environment variable, or at compile
  80.    time by defining the filetype macro (e.g., using the compile flag
  81.    -Dfiletype=\\\".cmd\\\" - if you type this on the shell command line you
  82.    will need an extra pair of single quotes around the whole thing).
  83.  
  84.    If the variable STUFF is left undefined (or blank) then stacked lines
  85.    left on the Rexx queue will be ignored when the Rexx program finishes
  86.    (the stack server will report this on the screen when it closes down).
  87.    If it is set to "-DSTUFF_STACK" then the interpreter will attempt
  88.    to stuff all remaining stacked lines into the terminal buffer, thus
  89.    mimicking the CMS behaviour.  This works on SunOS and Solaris - your
  90.    mileage may vary.
  91.  
  92.    If SMALL is set to false then normal executables will be created.  If
  93.    it is set to true then the "-n" option will be passed to the linker to
  94.    prevent it from adding padding, resulting in smaller executables.  This
  95.    is obsoleted by ELF-format executables as found in many modern systems.
  96.    It works on SunOS - your milage may vary.
  97.  
  98.    If you prefer, any of the above variables can be altered without editing
  99.    the program by specifying them immediately after the word Make on the
  100.    command line, for example, "Make CC=gcc SMALL=false".
  101.  
  102. 2. Final locations of object files
  103.  
  104.    Unless you are performing an install operation, all files created during
  105.    the compilation process will remain in the current directory (they are
  106.    not moved around as in previous versions of the installation procedure).
  107.  
  108.    If you are installing then the binaries will go into one directory and
  109.    the library files will go into another.  The binaries are: rexx (the
  110.    main program); rxque (the stack server program) and rxstack (the stack
  111.    access program).  The library file will be a file whose name starts
  112.    with "librexx" (see a later section for details).  The Rexx library
  113.    files, which will usually be put with the librexx file, are: either
  114.    rxmathfn.rxfn or rxmathfn.rexx (the math function package - which version
  115.    depends on whether shared objects are supported), and rxmathfn.rxlib (the
  116.    math function dictionary).  The destination of the Rexx library files
  117.    may be specified separately by setting the REXXLIB variable. 
  118.  
  119.    By default, the binaries will go into $PREFIX/bin and the library will
  120.    go into $PREFIX/lib, where $PREFIX is usually /usr/local/bin.  Manual
  121.    pages will be installed in $PREFIX/man/man/man1.  On Solaris systems
  122.    the $PREFIX will be /opt/REXXimc.  You can change the prefix by setting
  123.    the environment variable PREFIX or by putting a string of the form
  124.    PREFIX=/another/directory in the arguments to Make (see below for Make
  125.    arguments).
  126.  
  127.    Alternatively, if you set BINDIR, LIBDIR and MANDIR then these will be
  128.    used as the binary, library and manual page directories, respectively.
  129.  
  130.    The object file interface.o usually contains a record of the binaries
  131.    directory.  This is not essential but can help to speed the startup
  132.    process of REXX/imc.  Therefore it helps if the BINDIR is correct even
  133.    if you are not immediately installing REXX/imc.  It is possible to
  134.    record a directory other than BINDIR in interface.o by setting the
  135.    variable REXXIMC (either in the environment or in the arguments to Make).
  136.  
  137.    The same object file also contains a default REXXLIB string, which
  138.    will be taken from the REXXLIB variable if you set it, or the library
  139.    directory as detailed above.  REXXLIB could be set differently during
  140.    compilation and during installation to record a path different from the
  141.    one in which the library is installed.  The value during compilation can
  142.    be a colon-separated path, or the special value "" which means the
  143.    libraries are in the binaries directory (as in earlier versions of
  144.    REXX/imc).
  145.  
  146. 3. The librexx library files
  147.  
  148.    The library file which is produced will be either librexx.a or a file
  149.    whose name starts with "librexx.so".  On some systems there will also
  150.    be a symbolic link whose full name is "librexx.so".  This depends on
  151.    whether or not your system supports dynamic shared libraries (and, more
  152.    importantly, whether I have found out how to create them!).
  153.  
  154.    The librexx.a file is a static library archive.  It is not necessary in
  155.    order to run REXX/imc and could be deleted.  The librexx.so file is a
  156.    dynamic shared library.  It is necessary in order to run REXX/imc.
  157.    However, even if the library is not required by REXX/imc it may still
  158.    be useful because it is needed in order to compile any application that
  159.    uses the REXX/imc programming interface.  You can even make a copy of
  160.    librexx.a on a system that supports dynamic libraries if you like by
  161.    typing "Make librexx.a".
  162.  
  163.    NOTE: Some systems are more fussy than others on the location of the
  164.    dynamic shared library.  SunOS 4 appears to record the location of the
  165.    library so that the executable always works as long as you don't move
  166.    the library; the Make program also contains code for OSF1, Linux and
  167.    Solaris (SunOS 5) to make the compiler record the location of the library
  168.    in a similar manner.  However, if you get a message such as "ld.so:
  169.    librexx.so.1: not found" or "librexx.so.1.7: Undefined error: 0" (that
  170.    gem from FreeBSD) then this means that the system doesn't know where the
  171.    library file is.  If you are just testing then setting the environment
  172.    variable LD_LIBRARY_PATH to point to the library directory usually works,
  173.    but this is not particularly good as a permanent solution.  If you can
  174.    run ldconfig (sometimes installed in /sbin - see system manual page)
  175.    then this should fix the problem; otherwise you may have to install the
  176.    library in a system directory.  On FreeBSD you can cure the problem by
  177.    finding the line containing the string "Uncomment above line" in the Make
  178.    program and obeying it before doing the final install.
  179.  
  180. 4. Removing the object files
  181.  
  182.    Once you have installed REXX/imc, you may type "Make clean" which removes
  183.    any compiled programs or object files.
  184.  
  185.    If you want to delete REXX/imc from the system directories, you can type
  186.    "Make uninstall" (obviously, the directories have to be set correctly
  187.    as in (2) above).
  188.  
  189. =============
  190. Fun with Make
  191. =============
  192.  
  193. The full syntax of Make is:
  194.  
  195.    Make [VAR=value [...]] [v] [letter] [target [...]].
  196.  
  197. The parameters must appear in this order, though there is no set order for
  198. individual variables or targets.  Explanations of these parameters follow.
  199.  
  200.    VAR=value
  201.        sets the variable VAR to the given value.  Variables which can be
  202.        set in this manner include SRC, CC, COMPILEFLAG, LINKFLAG, STUFF,
  203.        SMALL, PREFIX, BINDIR, LIBDIR, MANDIR, REXXLIB and REXXIMC, all of
  204.        which are described in previous sections; MAKE and LD, which name the
  205.        programs make and ld respectively, and MAKEFILE which names the file
  206.        Makefile.REXXimc.
  207.  
  208.    v (also -v)
  209.        Sets "verbose" mode.  This just prints out the name of each rule
  210.        which is followed in the Makefile as compilation progresses.
  211.  
  212.    letter
  213.        One of the following letters or "pg" which modifies the
  214.        "optimisation" flags for compilation.  These are mostly used
  215.        for debugging.  By default the programs will be optimised and
  216.        stripped.
  217.  
  218.        a  uses cc with the "-a" flag to compile a version of REXX/imc which
  219.           will output profiling statistics when executed.
  220.        d  uses the "-g" compilation flag and also defines the DEBUG
  221.           preprocessor macro in order to make a debug version of REXX/imc
  222.           with memory tracing.
  223.        g  uses the "-g" compilation flag to produce an ordinary debug
  224.           version of REXX/imc.
  225.        n  uses no compiler flags at all, which reduces compilation time at
  226.           the cost of making REXX/imc slightly slower.  Does not strip the
  227.           executable.
  228.        o  uses optimisation flags to produce faster, smaller executables.
  229.        p  uses the "-p" compiler flag to compile a version of REXX/imc which
  230.           will output profiling statistics for "prof" when executed.
  231.        pg uses the "-pg" compiler flag to compile a version of REXX/
  232.           imc which will output profiling statistics for "gprof" when
  233.           executed.
  234.  
  235.    target
  236.        One of the following things to make.  You can specify several
  237.        targets, but any (un)installation option should be specified by
  238.        itself.  The "test" target also only works by itself.
  239.  
  240.        all (same as leaving out the target): compile all the binaries (in
  241.               the current directory), namely rexx, rxque, rxstack and, if it
  242.               is supported, the math library.  Compiling rexx also involves
  243.               compiling an appropriate librexx file.
  244.        test:  a dummy run - the same as "Make all" but the actions are
  245.               printed out instead of executed.
  246.        check: print out the values of important parameters.
  247.        install: Compile and install all the binaries and manual pages.
  248.        install-pgm: Compile and install the main programs and librexx file.
  249.        install-fn: Compile and install the math function library.
  250.        install-man: Install the manual pages.
  251.        uninstall: Remove all Rexx-related files from system directories.
  252.        uninstall-pgm: Remove the programs and librexx file from system
  253.               directories.
  254.        uninstall-fn: Remove the math function library from the system
  255.               directory.
  256.        uninstall-man: Remove the manual pages from the system directory.
  257.        clean: Remove all compiled objects from the current directory.
  258.        rexx:  Compile just the library "librexx" and the program "rexx".
  259.        rxque: Compile just the program "rxque".
  260.        rxstack: Compile just the program "rxstack".
  261.        rexx.1: Make the necessary substitution in the rexx manual page.
  262.        librexx.a: Compile the static libary archive.
  263.        librexx.so: Compile the dynamic shared library (the target is
  264.               called librexx.so even if the file is actually called
  265.               librexx.so.1.7).  This only works if shared libraries
  266.               are supported on your platform.
  267.        math:  Compile the math function library (only works if it is
  268.               supported on your platform).
  269.        lint:  Run the REXX/imc source through lint (only on systems which
  270.               have lint).
  271.  
  272.        The name of any "*.o" file may also be supplied as a target.
  273.  
  274. ================================
  275. Configuring Make for your system
  276. ================================
  277.  
  278. All the variables that need changing are set in the Make program for
  279. flexibility - this allows the program to decide on the compiler flags
  280. depending on the operating system.  In order to add or change the values
  281. for your system, follow the format of the second half of the Make program,
  282. which is as follows.
  283.  
  284.    SYSTEM)
  285.        the various settings that apply to all
  286.        compilers on that system
  287.        case $CC in
  288.           COMPILER)
  289.               the various settings that
  290.               apply to this compiler
  291.               ;;
  292.           COMPILER)
  293.               some more settings
  294.               for another compiler
  295.               ;;
  296.           *)  what happens if the compiler
  297.               is unknown
  298.               ;;
  299.        esac
  300.        ;;
  301.  
  302. The string you use for SYSTEM will be the output of the command "uname -s"
  303. followed by a colon and a version number (the output of "uname -r").  A star
  304. usually suffices for the version number, meaning "all versions".  Examples
  305. from the Make program are "SunOS:5.*" and "OSF1:*".
  306.  
  307. The important variables that you can examine or set are as follows.
  308.  
  309.    CCFLAG
  310.        Contains all the necessary flags and defines for compiling.  If
  311.        your machine does not have signed characters by default then you
  312.        will need to insert a flag for this ("-fsigned-char" works on gcc).
  313.        The various preprocessor symbols you can define are described later
  314.        on.
  315.    DEBUG
  316.        If debugging was turned on by the "letter" option "d" then this
  317.        contains the names of any special object files which may be linked
  318.        with the executables.
  319.    DLLFLAG
  320.        If your machine supports dynamic shared libraries then this variable
  321.        contains flags which must be passed to ld in order to make the
  322.        library.
  323.    LDL This will usually contain the string "-ldl", but if function
  324.        libraries have been disabled (because of certain debug options)
  325.        it will be blank.  This just exists to help you write the list of
  326.        required libraries.  The -ldl library is required on SunOS but not
  327.        on some other systems.
  328.    LIBRARIES
  329.        This contains the list of libraries required when linking the
  330.        programs.  Possible libraries that may be required are -ldl (for
  331.        loading shared objects - see also LDL), -lbsd (for BSD-compatible
  332.        functions on systems such as AIX), -lsocket and so on.
  333.    LREXX
  334.        Usually contains the string "-lrexx" for linking with the librexx
  335.        file, but if it helps you could change this to the absolute path
  336.        name of the library, namely "$(LIBDIR)/$(SONAME)" (SONAME is set
  337.        in the Makefile to the name of the dynamic library).
  338.    MATH
  339.        If your machine supports shared objects which can be loaded
  340.        by a running program (using the dlopen(3) function) then this
  341.        variable should contain the name of the math function library,
  342.        namely "rxmathfn.rxfn".  Otherwise it should remain blank, and
  343.        the Rexx program rxmathfn.rexx will be installed instead.
  344.    OPTFLAG
  345.        This contains the flags which were chosen by the "letter" option of
  346.        Make, which will be passed to the compiler during both compilation
  347.        and linking stages.
  348.    PIC If you will be using a dynamic shared library then it may have to
  349.        be compiled using position-independent code.  If that is so then
  350.        PIC should contain a flag which makes the compiler produce such
  351.        code.
  352.    RANLIB
  353.        Contains "ranlib" if you need to run ranlib on a library archive
  354.        after it is created, and "@true" otherwise.
  355.    REXXLIB
  356.        If you will be using a dynamic shared library (and the system
  357.        supports it) then this should contain "librexx.so".  Otherwise it
  358.        should contain "librexx.a".
  359.    RUNLIBS
  360.        The contents of this variable are appended to the command line when
  361.        linking programs.  This is used on Solaris for adding a library
  362.        directory.
  363.    SOFLAG
  364.        If your machine supports shared objects which can be loaded by a
  365.        running program (using the dlopen(3) function) then this variable
  366.        contains flags which must be passed to ld in order to make the
  367.        shared object.
  368.    SOLINK
  369.        If you will be using a dynamic shared library then it will be
  370.        called something like librexx.so.1.6.4 (even though REXXLIB
  371.        equals "librexx.so").  Some systems require a symbolic link called
  372.        librexx.so to point to this.  If it is required on your system then
  373.        let SOLINK="librexx.so", otherwise leave it blank.
  374.    STRIPFLAG
  375.        This usually contains either nothing or "-s" to strip the executables.
  376.        It will have been set by the "letter" option of Make.
  377.    USEDLLFLAG
  378.        Usually blank, but sometimes contains some flags which are given to
  379.        the compiler when the rexx executable is being linked in order to
  380.        make sure the dynamic library is linked correctly.
  381.  
  382. The definitions of some preprocessor symbols that you can put in the CCFLAG
  383. variable are as follows.
  384.  
  385.    _REQUIRED
  386.        The symbol name that is passed to the dlsym(3) function requires
  387.        a "_" before it (see rexx.c).  If this is incorrectly defined then
  388.        trying to call a math function results in a message such as "Routine
  389.        not found: SQRT in file rxmathfn.rxfn".
  390.    DECLARE_RANDOM
  391.        Used on Sun systems: the random() function is not declared in
  392.        system headers so the Rexx source files should define it.
  393.    DECLARE_TIMEZONE
  394.        Used on Sun systems: the timezone external variable is not
  395.        declared in system headers so the Rexx source files should
  396.        define it.
  397.    FSTAT_FOR_CHARS
  398.        Do not trust the FIONREAD ioctl for finding the number of unread
  399.        characters in a regular file, but instead call fstat to find the
  400.        file's size.  Note that FIONREAD is still used for finding the
  401.        number of unread characters in a tty or other special file.
  402.    HAS_GMTOFF
  403.        Used on SunOS 4 and Digital Unix: the tm structure has a tm_gmtoff
  404.        element which contains the offset from GMT.
  405.    HAS_MALLOPT
  406.        The malloc library has the function mallopt() as in SunOS.  This is
  407.        by no means essential.
  408.    HAS_TTYCOM
  409.        The system requires <sys/ttycom.h> to be included before the
  410.        TIOCGWINSZ ioctl can be used, as in SunOS.  If this is not defined
  411.        then <termios.h> will be included instead.
  412.    MALLOC_DEBUG
  413.        If DEBUG is set and the function "malloc_debug()" is provided on your
  414.        system then defining this will allow the program to use it.
  415.    NO_CNT 
  416.        Do not use the hack of inspecting fp->_cnt (where fp is a FILE
  417.        pointer) to find the number of characters read but not returned
  418.        to the program.  If this symbol is defined then the chars() call
  419.        may not work correctly on special files (for regular files you can
  420.        define FSTAT_FOR_CHARS instead).  However, most systems do have a
  421.        way of calculating this number.  If the method exists but requires
  422.        something other than inspecting fp->_cnt, then change the _CNT
  423.        macro in rxfn.c accordingly.  Suitable definitions have already
  424.        been included for Linux and FreeBSD.
  425.    NO_LDL       
  426.        The system does not have the functions dlopen(), dlsym(), dlclose(),
  427.        dlerror() for dynamic loading.  The effect of defining NO_LDL will
  428.        be to remove support for external compiled functions.  If you define
  429.        this then leave MATH blank (see above) so that the math function
  430.        library will not be compiled.
  431.    POINTER64   
  432.        Insert extra padding into various structures in order to align for
  433.        a system with 64-bit pointers (it does no harm to define this on a
  434.        machine with short pointers; it just makes some of the structures
  435.        use a few bytes more memory).
  436.  
  437. If you define NO_LDL, you will not be able to use compiled function
  438. packages, such as rxmathfn.rxfn (the math library).  However, it will
  439. still be possible to use external functions written in Rexx.  You will be
  440. able to use the Rexx math library by copying the Rexx file rxmathfn.rexx
  441. into the binaries directory together with rxmathfn.rxlib.  This will be
  442. done automatically by "Make install".
  443.  
  444. It appears that a dlfcn package containing dlopen(), dlsym() and dlclose()
  445. functions has been written for AIX.  One of the locations where it may be
  446. found is at <ftp://ftp.rzg.mpg.de/pub/software/the/Regina/>.  I have not
  447. tested this so cannot say whether it will allow shared objects to be used
  448. with REXX/imc on that system.
  449.  
  450. ------------------------
  451.  
  452. REXX/imc is copyright, but free.  Permission is granted to use, copy
  453. and redistribute this code, provided that the same permission is
  454. granted to all recipients, and that due acknowledgement is given to
  455. the author.
  456.  
  457.