New automagic build system for newLISP

Notices and updates
Post Reply
TedWalther
Posts: 605
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC
Contact:

New automagic build system for newLISP

Post by TedWalther »

This build system does not in any way alter the current build system, it is available if you want to use it. For Mac, Linux, and BSD users I believe it already represents an improvement; it automatically detects if your system is 64 bits, and compiles accordingly.

It does not use autoconf, autotools, automake, or any other of those GNU tools, But it takes some of the good ideas and conventions from them, as explained by Nelson Beebe of the maths department of the University of Utah. This should make it even easier to package newLISP for the different Unix and POSIX variants.

To use it, simply download this patch and apply it: http://reactor-core.org/downloads/newli ... gure.patch

Then type ./configure. To use this system, you can't omit this step. Configure now takes the following options:

Code: Select all

--enable-readline
--disable--readline
--enable-utf8
--disable-utf8
--enable-ipv6
--disable-ipv6
Also, you can pass in the CC, CFLAGS, LIBS, and OBJS variables from your shell environment and they will be preserved and respected. Command line options will override them though, as is standard practice.

The script defaults to turning on all three knobs; UTF8, readline, and IPv6. The patch also fixes a syntax error in the IPv6 code.

Configure now generates two files, config.h, and makefile_configure

On my OpenBSD system, the config.h looks like this:

Code: Select all

/* This platform is using the LP64 memory model */
#define NEWLISP64

/* Operating System Type */
#define _BSD

/* UTF8 support was chosen */
#define SUPPORT_UTF8

/* READLINE support was chosen */
#define READLINE

/* IPv6 support was chosen */
#define IPV6

/* EOF */
Having the config.h file makes the Makefile smaller and easier to understand, because things aren't being defined on the commandline.

Here is what the resulting makefile_configure looks like:

Code: Select all

CC = cc
CFLAGS = -Wall -Wno-uninitialized -fno-strict-aliasing -DNEWCONFIG -O2 -c
LIBS = -lm -lreadline -lncurses
OBJS = 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 nl-utf8.o

default: $(OBJS)
        $(CC) $(OBJS) $(LIBS) -o newlisp
        strip newlisp

.c.o:
        $(CC) $(CFLAGS) $<

$(OBJS): primes.h protos.h makefile_configure
You notice there is one #define being defined on the commandline there, -DNEWCONFIG. This was necessary to make config.h only be #included when using this new config system, otherwise it would collide with the existing build system.

To compile newlisp, you type this command:

Code: Select all

./configure
make -f makefile_configure
make install
I am posting it here so it can get some broader testing before I complete it and send it to Lutz. It should already work out of the box for Linux, Mac, and BSD users. For everyone else, it should be fairly simple to update it to support your platform, in which case I hope you'd show me your modifications to make it work.

Also, by having all the knobs turned on, hopefully we can get IPv6 more broadly tested. And on those few platforms without readline, the --disable-readline options to configure will turn it off.

This system should free people from having to edit makefiles to tweak them for their system.

Any comments welcome.
Last edited by TedWalther on Mon Jun 15, 2009 10:04 pm, edited 1 time in total.

TedWalther
Posts: 605
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC
Contact:

Post by TedWalther »

Many improvements have been made, and the patch can now be downloaded here:

http://ted.affordableaffiliates.com/new ... gure.patch

Post Reply