This is PORTING Tue Nov 13 14:45:26 MST 2001

If you want to port rxtx to a new Unix platform do the following.

*IMPORTANT* you will need gnu make.

There are probably three areas you will need to focus on:

	configure.in

	src/SerialImp.c src/SerialImp.h src/ParallelImp.c

	RXTXCommDriver.java  (just add the ports for your OS)

configure.in grabs information about the OS, Java, ... and tries to set sane
values for the Makefile.  Look towards the bottom of configure.in and just
copy *bsd or HP-UX.  Modify to your liking.

Edit configure.in, run autoconf, run configure, run make.  repeat. An endless 
loop analagous to shampoo instructions.

SerialImp.c and ParallelImp.c may require system specific includes and possibly
a small amount of #ifdef's in the code.  Lock file information will need to
be added to SerialImp.h

SerialImp.h will need defines for the location of lock files and the lock file
type if they are used.  See BSD or Linux as examples.

Common problems include the following varibles in the Makefile

      JAVAINCLUDE
      JAVANATINC
      CLASSPATH

Which are defined in configure.in

We will gladly help with any UNIX platform.  Send questions to
taj@www.linux.org.uk.  New OS's usually require tweaks.

If its not compiling try backing out functionality until it compiles.

win32 support has not been tested.  Contact taj@www.linux.org.uk if your 
interested in developing win32 support.   

For all Unix flavors... If the package did not work out of the box please
see BUGS and send a comment.

Here are more details sent to the rxtx mail list:

Here are some tips for starters.

There are three files you will need to modify.

configure.in

HP-UX)
        # compiler flags required to build. Often enables POSIX termios
        # support and related #defines
        CFLAGS="-g -Aa +e -D__hpux__ -D_HPUX_SOURCE -D_NO_POSIX=1
-D_NO_XOPEN4=1"
        # location for the library libSerial.so
        RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)"
        #Libraries to build.  libSerial.la and libParallel.la are options
        # libSerial.la is usually ported first and has had more work/tests
        TARGETLIB="\$(target_alias)/libSerial.la"
        # Handle java quirks here.
        case $JAVA_VERSION in
                HP-UX\ Java\ C.01.2*|HP-UX\ Java\ C.01.3*)
                        # function call
                        fix_parameters $JPATH/jre/lib/javax.comm.properties
                        # location for comm.jar and jcl.jar (RXTX)
                        JHOME=$JPATH"/jre/lib/ext"
                        # classpath for building (hackish)
CLASSPATH=".:\$(TOP):\$(TOP)/src:\$(JPATH)/lib/classes.zip:\$(JPATH)/jre/lib/ext/comm.jar:$CLASSPATH"
                        # location for libSerial.so .. again I see.
                        RXTX_PATH="\$(JPATH)/jre/lib/\$(OS_ARCH)"
                ;;
                *)
                        echo "$JAVA_VERSION untests"
                # possibly more java specific cases...
        esac;

That should be enough to get Makefile with autoconf/automake/configure.
the autogen.sh script can be used to bring the version of scripts you have
into the top rxtx directory.  Helpfull if you cant get the same versions
used.  hmm I need to update the INSTALL info here.

        libtool  1.3.5
        autoconf 2.13
        automake 1.4
        gnu make 3.79.1

Makefile.am is changed to create new Makefiles
Makefile.in is generated from it with automake
Makefile is generated with the configure script

configure.in is changed to create new configure scripts
configure is generated from configure.in with automake

A hard coded Makefile is also possible.  I can send you the output of a
typical make session off the list if you like.

Source changes:

RXTXCommDriver.java

Port enumeration needs to know which ports to check.

private void registerScannedPorts(int PortType){}

has code like the following listing the ports on that system.  Again
os.name is used to determine the system.

....
else if(osName.equals("HP-UX"))
{
        String[] Temp = {
                "tty0p",// HP-UX serial ports
                 "tty1p" // HP-UX serial ports
         };
         CandidatePortPrefixes=Temp;
}

Next, one should fix the port locking.  RXTX supports FHS locks, UUCP and
no locks.  One could start with no locking at first and then add the lock
capability later:

SerialImp.h

#if defined(__hpux__)
/* modif cath */
/* The directory the device files are in */
#       define DEVICEDIR "/dev/"
/* the directory to place the lock files */
#       define LOCKDIR "/usr/spool/uucp"
/* what the prefix is for lockfiles  example:  LK.134.124.124 */
#       define LOCKFILEPREFIX "LK."
/*  UUCP of FHS locking */
#       define UUCP
#endif /* __hpux__ */

for starters you may do something like:

#if defined(WIN32)
#       define DEVICEDIR ""
#       define LOCKDIR ""
#       define LOCKFILEPREFIX ""
#endif /* WIN32 */

to disable lock files.


That should be it.  Some changes to SerialImp.c may be needed for compiler
errors.


