Prerequisites:
 - cygwin requires optional cygwin packages "gcc", "make" and "bison"
 - on solaris and linux, compilation works with: gcc 3.4.6 and make 3.82, eg:
module add gcc/3.4.6 
module add make/3.82  
(if 3.82 not available, try 3.81 or 3.80)

1.  Copy the file gawk-4.1.4.tar.gz to /tmp
2.  cd /tmp
3.  rm -rf gawk-4.1.4
4.  gzip -d gawk-4.1.4.tar.gz && tar xf gawk-4.1.4.tar
5.  If Linux/cygwin: cp ~/moshell/commonjars/src/gawkextension/filefuncs.c /tmp/gawk-4.1.4/extension
6a. If solaris/sparc, 
          - cp ~/moshell/commonjars/src/gawkextension/filefuncs.solaris.c /tmp/gawk-4.1.4/extension/filefuncs.c
          - include the file libgcc_s.so.1 from /app/gcc/3.4.6/lib and store it in moshell/commonjars/lib/solaris
6b. If solaris/x86, run the command:
          - cp ~/moshell/commonjars/src/gawkextension/filefuncs.sol86.c /tmp/gawk-4.1.4/extension/filefuncs.c
          - setenv CFLAGS "-O2 -fno-schedule-insns2"
6c. If Linux (32bit/64bit) copy the file readline-7.0.tar.gz from ftp://ftp.gnu.org/gnu/readline/ to /tmp
          - gzip -d readline-7.0.tar.gz && tar xf readline-7.0.tar && cd readline-7.0
          - ./configure --enable-static --prefix=/tmp/readline70 && make && make install
7.  cd /tmp/gawk-4.1.4
8a. if Linux: ./configure --with-readline=/tmp/readline70 && make    (we statically link readline on linux because on some systems the shared readline library is incompatible with our gawk)
    Important: check with ldd that the gawk does not have dependency to shared readline !!!
8b. else:           ./configure && make
9.  strip gawk
10. strip extension/.libs/filefuncs.so
11. update mos2emInfo["gawk_version"] in moshell/prog.awk

#testing of the lib:
./gawk -l extension/.libs/filefuncs 'BEGIN{usleep(100000);system("ls -l extension/time.c");chmod(00666,"extension/time.c");system("ls -l extension/time.c");chmod(00644,"extension/time.c");print mkdir("/tmp/test",0777);system("ls -ld /tmp/test");system("rmdir /tmp/test");system("ls -ld /tmp/test");print "touch testfile: "touch("testfile");system("ls -l testfile");print "rm testfile: "unlink("testfile");system("ls -l testfile");ctrl_c_disable();ctrl_c_enable();delete table;print scandir("/home/eanzmagn/moshell",table);for(i in table) print i,table[i]}'

./gawk.solaris -l commonjars/lib/solaris/filefuncs 'BEGIN{usleep(5000000);system("ls -l commonjars/pm/PARAM_RNC_V_8_0.txt");chmod(00666,"commonjars/pm/PARAM_RNC_V_8_0.txt");system("ls -l commonjars/pm/PARAM_RNC_V_8_0.txt");chmod(00644,"commonjars/pm/PARAM_RNC_V_8_0.txt");print mkdir("/tmp/test",0777);system("ls -ld /tmp/test");system("rmdir /tmp/test");system("ls -ld /tmp/test");print "touch testfile: "touch("testfile");system("ls -l testfile");print "rm testfile: "unlink("testfile");system("ls -l testfile");delete table;print scandir("/home/eanzmagn/moshell",table);for(i in table) print i,table[i];ctrl_c_disable();ctrl_c_enable()}'

#machines used: esekilxxen1231 (linux32), esekilxxen1250 (linux64), esekits1088 (solaris10/sparc), eswki51komp (solaris10/x86)