From sveta.andic@tab.co.nz Tue Mar 27 00:09:38 2001 Date: Tue, 27 Mar 2001 17:30:37 +1200 From: Svetozar Andic To: smcpeak@cs.berkeley.edu Subject: Porting SafeTP to AIX Hi, I have managed to successfully compile, link and run your SafeTP server on our AIX machine. We are using AIX 4.2.1.0 on our IBM SP machines. I did the compiling with GNU C/C++ compiler version 2.95.1. The version of SafeTP was 1.46 unpacked from the source tarball. ----- Here is what I had to do to get things going: Building the Code 1) Configure script incompleteness. In the configure script in the 'case "$target" in' statement in line 1353, I have added the *aix* switch: *aix*) echo "$ac_t""adding AIX-specific stuff" 1>&6 CFLAGS="$CFLAGS -O2 -D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE" ;; This adds proper flags to the CFLAGS macro for AIX. 2) A number of executable targets failed during linking due to the undefined symbol 'userConfigDir'. I took the 'primitive' approach and stuck the usercfg.o object file into the 'sftp-objs' macro in the Makefile.in file. That made the object file available to every executable target. This was probably not the right thing to do, but it worked for me. 3) Un-resolvable symbol 'bzero' during linking. Including on AIX solves the problem. In socket.h, in line 36 I changed the following: #ifdef __OSF1__ # include // bzero for FD_SET #endif to say: #if defined(__OSF1__) || defined(_AIX) # include // bzero for FD_SET #endif 4) The BIG_ENDIAN/LITTLE_ENDIAN mess. On AIX there is a file /usr/include/sys/machine.h that defines BIG_ENDIAN, LITTLE_ENDIAN and BYTE_ORDER macros. On RS/6000 machines BYTE_ORDER is defined as BIG_ENDIAN. However, LITTLE_ENDIAN is still defined which makes the sockutil.cpp throw an exception during the test run. So, in sockutil.cpp I have changed the block of code that says: // verify endianness #if defined(LITTLE_ENDIAN) if (isBigEndian()) { xfailure("LITTLE_ENDIAN is defined but isBigEndian() returns true"); } #elif defined(BIG_ENDIAN) if (!isBigEndian()) { xfailure("BIG_ENDIAN is defined but isBigEndian() returns false"); } #else xfailure("neither LITTLE_ENDIAN nor BIG_ENDIAN are defined"); #endif to this: #ifndef _AIX // verify endianness #if defined(LITTLE_ENDIAN) if (isBigEndian()) { xfailure("LITTLE_ENDIAN is defined but isBigEndian() returns true"); } #elif defined(BIG_ENDIAN) if (!isBigEndian()) { xfailure("BIG_ENDIAN is defined but isBigEndian() returns false"); } #else xfailure("neither LITTLE_ENDIAN nor BIG_ENDIAN are defined"); #endif #else #if BYTE_ORDER == LITTLE_ENDIAN if (isBigEndian()) { xfailure("LITTLE_ENDIAN is defined but isBigEndian() returns true"); } #elif BYTE_ORDER == BIG_ENDIAN if (!isBigEndian()) { xfailure("BIG_ENDIAN is defined but isBigEndian() returns false"); } #else xfailure("neither LITTLE_ENDIAN nor BIG_ENDIAN are defined"); #endif #endif Not too elegant, but works. Also in the same file (sockutil.cpp) there is a series of #ifdef - #elif tests that are used to determine the type of the address length argument for some of the socket calls. I added the test for AIX that says: ... #elif defined(_AIX) # define LENGTH_PARAM size_t ... -------------------------- That was it. After these changes were in, I ran the './configure - gmake - gmake check' and everything went OK. I hope this will help bringing this fine product to AIX users too. However, I do not have access to the latest AIX versions (not yet) and I can't say that this will work with the later (or the earlier for that matter) versions of AIX.