Quote from: "Lutz"
'opsys' is referenced in the C source a few times, mainly to feed into the newLISP 'sys-info' call in nl-filesys.c. Later in the code it gets incremented by the bits for UTF-8 and mode and id the versin is a library.
In newLISP .lsp source a built-in variable exists, called: ostype to code platform specific newLISP (mostly necessary for Win32).
I suggest you add:
#ifdef AIX
int opsys = 10;
char ostype[]="AIX";
#endif
I thought 10 would be the logical choice, but a bunch of the tests all compare for the sys-info return value(ie, opsys), which makes them fail in wierd ways when set to 10. Perhaps using something like <15 for all Unix, 16-31 for Windows, etc, to not interfer with the flag usage of the variable as well.
For now I'm reusing 4, since its semi close to Solaris, and the tests will all run. The tests were *key* to verifying the various porting issues I came across.
in newlisp.c and create a makefile_aix with -DAIX used in it. Then create aQuote
#ifdef AIX
...
#endif
section in newlisp.h and use #ifdef AIX and #ifndef AIX throughout the C source code.
Yep, already made a makefile_aix, changed makefile, build, etc. _AIX is defined by default when compiling under AIX (both GCC and native compilers) so I always use that.
The current system is not perfect but has served well through the years. I agree that #ifdef <capability> is much better then #ifdef <platform> through out the code, but for the makefiles it is better to have -DAIX, -DSOLAIRS, -DLINUX etc. The best probably would be to have #ifdef <platform> only be used in newlisp.h to bracket a group of #define <cabalities> for each platform.Quote
Right, thats how I usually do it. One .h that list all the capabilities based on the -DSOLARIS define at compile time, which then all other source is based on those caps/requirements. Thats how autoconf's config.h works.
If you send me a package compiling on AIX based on the latest development release, I can modify/integrate your changes for the next development release. Just "#ifdef AIX" you stuff into it and I see how I can streamline things further if you haven't done already. I will then send you a package back to make sure things work on both side.Quote
Will do. I'll get the prelim stuff packaged up shortly. Its built against 9.1.1, is that okay?
Over the years platforms have come and gone, it would be nice to have AIX among the standard makefiles as it probably will still be around for some time, and have it detected too in the 'build' and 'configure' scripts. These script use the UNIX utility uname to detect the platform.Quote
Already changed build to detect uname and use makefile_aix as required.
Last not least very welcome to newLISP and thanks for participating in porting efforts ;-)Quote
Looking forward to helping out where I can. Thanks for the reply!
Just FYI, build from xlc (native compiler):
Code Select
bash-2.04# gmake
./build
Discovered AIX
make -f makefile_aix
xlc -c -g -O2 newlisp.c
689 1500-010: (W) WARNING in main: Infinite loop. Program may not stop.
xlc -c -g -O2 nl-symbol.c
xlc -c -g -O2 nl-math.c
xlc -c -g -O2 nl-list.c
xlc -c -g -O2 nl-liststr.c
xlc -c -g -O2 nl-string.c
xlc -c -g -O2 nl-filesys.c
xlc -c -g -O2 nl-sock.c
xlc -c -g -O2 nl-import.c
xlc -c -g -O2 nl-xml.c
xlc -c -g -O2 nl-web.c
xlc -c -g -O2 nl-matrix.c
xlc -c -g -O2 nl-debug.c
xlc -c -g -O2 pcre.c
xlc newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-filesys.o nl-sock.o nl-import.o nl-xml.o nl-web.o nl-matrix.o nl-debug.o pcre.o -lm -ldl -o newlisp
And from gcc:
Code Select
bash-2.04# gmake
./build
Discovered AIX
make -f makefile_aix
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 newlisp.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 nl-symbol.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 nl-math.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 nl-list.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 nl-liststr.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 nl-string.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 nl-filesys.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 nl-sock.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 nl-import.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 nl-xml.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 nl-web.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 nl-matrix.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 nl-debug.c
gcc -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -c -g -O2 pcre.c
gcc newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-filesys.o nl-sock.o nl-import.o nl-xml.o nl-web.o nl-matrix.o nl-debug.o pcre.o -lm -ldl -o newlisp
Both compile clean with no warnings after the changes.