#!/bin/sh

PACKAGE=newlisp
VERSION=10.7.5

rm -f config.h makefile_build makefile_install

# this script tries to discover the OS platform and configuration
# and then makes newLISP using the appropiate makefile
# if this script fails and for other special flavors, like
# making shared libraries etc., type: 
#
#      make help
# to see all options specified in Makefile
#
# to change $(prefix) edit prefix in Makefile

# Generate a config.h file with all our different option settings that are set
# by #define

# Now we set the default values for our new Makefile
DEFAULT_CC="cc"
DARWIN_CC="${DEFAULT_CC}"
LINUX_CC="gcc"
BSD_CC="${DEFAULT_CC}"
SUNOS_CC="gcc"
AIX_CC="xlc_r"
TRU64_CC="cc"
WIN32_CC="gcc"
OS2_CC="${DEFAULT_CC}"

DEFAULT_CFLAGS=" -Wall -Wno-uninitialized -fno-strict-aliasing -O2 -c"
DARWIN_CFLAGS=" -Wall -Wno-long-long -Wno-strict-aliasing -O2 -c"
LINUX_CFLAGS=" -Wall -Wno-long-long -Wno-strict-aliasing -O2 -c"
BSD_CFLAGS=" -Wall -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -O2 -c"
SUNOS_CFLAGS=" -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -O2 -c"
AIX_XLCFLAGS=" -O2 -c"
AIX_GCCFLAGS=" -Wall -pedantic -Wno-uninitialized -Wno-long-long -fno-strict-aliasing -O2 -c"
TRU64_CFLAGS=" -ieee -pedantic -O3 -c -D_POSIX_PII_SOCKET"
WIN32_CFLAGS=" -Wall -Wno-uninitialized -Wno-long-long -O1 -c"
OS2_CFLAGS=" -Wall -pedantic -Wno-uninitialized -Wno-long-long -Wno-strict-aliasing -O2 -c -s"

DEFAULT_LDFLAGS="-lm"
DARWIN_LDFLAGS="${DEFAULT_LDFLAGS}"
LINUX_LDFLAGS="-lm -ldl"
BSD_LDFLAGS="${DEFAULT_LDFLAGS}"
SUNOS_LDFLAGS="-lm -ldl -lrt -lsocket -lnsl"
AIX_LDFLAGS="-lm -ldl -lrt -lnsl"
TRU64_LDFLAGS="-lm -lrt -ldb -lbsd"
WIN32_LDFLAGS="-lws2_32"
OS2_LDFLAGS="-Zomf -Zmt -lm -ldl"

DEFAULT_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-json.o nl-web.o nl-matrix.o nl-debug.o pcre.o"

DEFAULT_STRIP="strip"
WIN32_STRIP="strip"

DEFAULT_TARG="newlisp"
WIN32_TARG="newlisp.exe"
OS2_TARG="newlisp.exe"

echo
case `uname` in 
	Darwin) true ${os_type:=MAC_OSX} ;;
	Linux)  true ${os_type:=LINUX} ;;
	FreeBSD) true ${os_type:=_BSD} ;;
	NetBSD) true ${os_type:=_BSD} ;;
	OpenBSD) true ${os_type:=_BSD} ;;
	SunOS) true ${os_type:=SUNOS} ;;
	AIX) true ${os_type:=AIX} ;; 
	OSF1) true ${os_type:=TRU64} ;;
	MINGW*) true ${os_type:=WINDOWS} ;;
	OS/2) true ${os_type:=OS2} ;;
	*)
		echo Could not discover your OS platform use one of the following commands:
		make help
		exit
		;;
esac

echo "Detected Operating System ${os_type}"

if   [ ${os_type} = MAC_OSX ] ; then
	DEFAULT_CFLAGS="${DARWIN_CFLAGS}"
elif [ ${os_type} = LINUX ] ; then
	DEFAULT_CFLAGS="${LINUX_CFLAGS}"
	DEFAULT_LDFLAGS="${LINUX_LDFLAGS}"
elif [ ${os_type} = _BSD ] ; then
	DEFAULT_CFLAGS="${BSD_CFLAGS}"
elif [ ${os_type} = SUNOS ] ; then
	DEFAULT_CFLAGS="${SUNOS_CFLAGS}"
	DEFAULT_LDFLAGS="${SUNOS_LDFLAGS}"
elif [ ${os_type} = AIX ] ; then
	DEFAULT_CC="${AIX_CC}"
	DEFAULT_CFLAGS="${AIX_XLCFLAGS}"
	true ${enable_readline:=no};
elif [ ${os_type} = TRU64 ] ; then
	DEFAULT_CC="${TRU64_CC}"
	DEFAULT_CFLAGS="${TRU64_CFLAGS}"
	DEFAULT_LDFLAGS="${TRU64_LDFLAGS}"
elif [ ${os_type} = WINDOWS ] ; then
	DEFAULT_CC="${WIN32_CC}"
	DEFAULT_CFLAGS="${WIN32_CFLAGS}"
	DEFAULT_LDFLAGS="${WIN32_LDFLAGS}"
	DEFAULT_OBJS="${DEFAULT_OBJS} win-util.o win-path.o"
	DEFAULT_STRIP="${WIN32_STRIP}"
	DEFAULT_TARG="${WIN32_TARG}"
	true ${enable_readline:=no};
	true ${enable_utf8:=no};
elif [ ${os_type} = OS2 ] ; then
	DEFAULT_CFLAGS="${OS2_CFLAGS}"
	DEFAULT_LDFLAGS="${OS2_LDFLAGS}"
	DEFAULT_TARG="${OS2_TARG}"
	true ${enable_readline:=yes};
fi

# Only LP64 and ILP32 memory models are officially supported, but we'll try to
# support the others too.
cat > test-memorymodel.c <<EOF
/* test-memorymodel.c Ted Walther <ted@reactor-core.org>
 *
 * return a string with the type of memory model the current compiler is using.
 */

#include <stdio.h>

int
main(int argc, char** argv) {
	short sc = sizeof(char) * 8;
	short ss = sizeof(short) * 8;
	short si = sizeof(int) * 8;
	short sl = sizeof(long) * 8;
	short sp = sizeof(void*) * 8;

	if (si == 32 && sl == 64 && sp == 64) { printf("LP64\n"); return 0; }
	if (si == 64 && sl == 64 && sp == 64) { printf("ILP64\n"); return 0; }
	if (si == 32 && sl == 32 && sp == 64) { printf("LLP64\n"); return 0; }
	if (si == 32 && sl == 32 && sp == 32) { printf("ILP32\n"); return 0; }
	if (si == 16 && sl == 32 && sp == 32) { printf("LP32\n"); return 0; }
	printf("UNKNOWN\n"); return 1;
}
EOF
${CC:-${DEFAULT_CC}} test-memorymodel.c -o test-memorymodel 2>/dev/null
true ${memory_model:=`./test-memorymodel`}
echo "Detected memory model `./test-memorymodel`"
rm -f test-memorymodel*

# time_t is 64 bits on modern platforms.  Support this.
cat > test-time-t.c <<EOF
#include <stdio.h>
#include <time.h>

int
main(int argc, char** argv) {
	short bits = sizeof(time_t) * 8;

	if (bits == 64) { printf("64BIT"); return 0; }
	if (bits == 32) { printf("32BIT"); return 0; }
	printf("UNSUPPORTED\n"); return 1;
}
EOF
${CC:-${DEFAULT_CC}} test-time-t.c -o test-time-t 2>/dev/null
true ${time_t_size:=`./test-time-t`}
echo "Detected time_t size `./test-time-t`"
rm -f test-time-t*

# If we can't compile with readline, and the environment variables don't
# specify otherwise, we will disable it.
cat > test-readline.c <<EOF
/* test-readline.c Fri Jul 10 14:57:33 PDT 2009 Ted Walther <ted@reactor-core.org>
 *
 * code for testing the compiler options to use for libreadline
 */

#include <stdio.h>
#include <stdlib.h>

#include <readline/readline.h>
#include <readline/history.h>

char **
test_completion (char * text, int start, int end) {
	return NULL;
}

int
main(int argc, char** argv) {

	rl_readline_name = "test";
	rl_attempted_completion_function = (CPPFunction *)test_completion;
	readline(NULL);
	add_history("test");

	exit(0);
}
EOF
for cclibreadline in "-lreadline" "-lreadline -lncurses" "-lreadline -ltermcap" "-lreadline -lterminfo"; do
	if ${CC:-${DEFAULT_CC}} test-readline.c ${cclibreadline} -o test-readline 2>/dev/null ; then
		true ${enable_readline:=yes};
		DEFAULT_RLFLAGS="${cclibreadline}";
		echo "Detected readline flags: ${cclibreadline}";
		break;
	fi
done
true ${enable_readline:=no};
rm -f test-readline*

# If we can't compile with ffi, and the environment variables don't
# specify otherwise, we will disable it.
cat > test-ffi.c <<EOF
/* test-ffi.c Fri Jul 10 14:57:33 PDT 2009 Ted Walther <ted@reactor-core.org>
 *
 * code for testing the compiler options to use for libffi
 */

#include <stdio.h>
#include <ffi.h>

int main(int argc, char** argv) {
       ffi_cif cif;
       ffi_type *args[1];
       void *values[1];
       char *s;
       int rc;
     
       args[0] = &ffi_type_pointer;
       values[0] = &s;
     
       if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
     		       &ffi_type_uint, args) == FFI_OK)
         {
           s = "Hello World!";
           ffi_call(&cif, puts, &rc, values);
         }
     
       return 0;
}
EOF
for cclibffi in "-lffi"; do
	if ${CC:-${DEFAULT_CC}} test-ffi.c ${DEFAULT_LDFLAGS} ${cclibffi} -o test-ffi 2>/dev/null ; then
		true ${enable_ffi:=yes};
		DEFAULT_FFIFLAGS="${cclibffi}";
		echo "Detected ffi flags: ${cclibffi}";
		break;
	fi
done
true ${enable_ffi:=no};
rm -f test-ffi*

# Safe defaults; 
true ${enable_utf8:=yes};

# Default values to control how the Makefile is generated
true ${enable_static:=no};
true ${enable_debug:=no};

for nlc_arg in "$@"; do
	if test -n "$nlc_prev"; then
		eval "$nlc_prev=\$nlc_arg"
		nlc_prev=
		continue
	fi
	case "${nlc_arg}" in
		--*=*) nlc_optarg=`echo "$nlc_arg" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
		*) nlc_optarg= ;;
	esac
case "${nlc_arg}" in
	--enable-utf8) enable_utf8=yes; ;;
	--disable-utf8) enable_utf8=no; ;;
	--enable-readline) enable_readline=yes; ;;
	--disable-readline) enable_readline=no; ;;
        --enable-ffi) enable_ffi=yes; ;;
        --disable-ffi) enable_ffi=no; ;;
	--enable-static) enable_static=yes; ;;
	--disable-static) enable_static=no; ;;
	--enable-debug) enable_debug=yes; ;;
	--disable-debug) enable_debug=no; ;;
	--LP64)  memory_model=LP64; ;;
	--ILP64) memory_model=ILP64; ;;
	--LLP64) memory_model=LLP64; ;;
	--LP32)  memory_model=LP32; ;;
	--ILP32) memory_model=ILP32; ;;
	--prefix) nlc_prev=prefix ;;
	--prefix=*) prefix="$nlc_optarg" ;;
	--exec-prefix) nlc_prev=exec_prefix ;;
	--exec-prefix=*) exec_prefix="$nlc_optarg" ;;
	--bindir) nlc_prev=bindir ;;
	--bindir=*) bindir="$nlc_optarg" ;;
	--mandir) nlc_prev=mandir ;;
	--mandir=*) mandir="$nlc_optarg" ;;
	--man1dir) nlc_prev=man1dir ;;
	--man1dir=*) man1dir="$nlc_optarg" ;;
	--docdir) nlc_prev=docdir ;;
	--docdir=*) docdir="$nlc_optarg" ;;
	--datadir) nlc_prev=datadir ;;
	--datadir=*) datadir="$nlc_optarg" ;;
	--help) cat <<EOF
Usage: ./configure-alt [options]
     --help              # Show this help message.

     --prefix=dir        # standard GNU option
     --exec-prefix=dir   # standard GNU option
     --bindir=dir        # standard GNU option
     --datadir=dir       # standard GNU option
     --docdir=dir        # standard GNU option
     --mandir=dir        # standard GNU option
     --man1dir=dir       # standard GNU option

     --enable-utf8       # (default) Enable UTF8 support
     --disable-utf8      # Disable UTF8 support
     --enable-readline   # (default) Enable readline support
     --disable-readline  # Disable readline support
     --enable-ffi        # (default) Enable foreign function interface
     --disable-ffi       # Disable foreign function interface
     --enable-static     # Link newlisp statically, suitable for use in chroot jails
     --disable-static    # (default) Link newlisp dynamically
     --enable-debug      # Include debugging information in the newlisp binary
     --disable-debug     # (default) Compile without debugging information
     --LP64              # Use LP64 memory model, overriding auto-detection
     --ILP64             # Use ILP64 memory model, overriding auto-detection    
     --LLP64             # Use LLP64 memory model, overriding auto-detection
     --LP32              # Use LP32 memory model, overriding auto-detection
     --ILP32             # Use ILP32 memory model, overriding auto-detection
EOF
	exit; ;;	
	*) echo "Unrecognized option, ignoring: ${arg}" ;;
esac
done

if [ -z "$prefix" ] ; then prefix="/usr/local"; fi
if [ -z "$exec_prefix" ] ; then exec_prefix="$prefix"; fi
if [ -z "$bindir" ] ; then bindir="${exec_prefix}/bin"; fi
if [ -z "$datarootdir" ] ; then datarootdir="${prefix}/share"; fi
if [ -z "$datadir" ] ; then datadir="${datarootdir}"; fi
if [ -z "$docdir" ] ; then docdir="${datarootdir}/doc/${PACKAGE}"; fi
if [ -z "$mandir" ] ; then mandir="${prefix}/man"; fi
if [ -z "$man1dir" ] ; then man1dir="${mandir}/man1"; fi
if [ -z "$pkgdatadir" ] ; then pkgdatadir="${datadir}/${PACKAGE}-${VERSION}"; fi

cat >> config.h <<EOF
/* This file was generated automatically by ./configure-alt */

#define NEWLISPDIR "${pkgdatadir}"

EOF

cat >> config.h <<EOF
/* Operating System Type */
#define ${os_type}

/* Memory model for the platform */
#define MEMORY_MODEL_${memory_model}

EOF


if [ $memory_model = LP64 ] ; then
	cat >> config.h <<EOF
/* This platform is using the LP64 memory model.  Adding legacy #define */
#define NEWLISP64

EOF
fi

if [ $time_t_size = 64BIT ] ; then
	cat >> config.h <<EOF
/* Large values of time_t are supported. */
#define TIME_T_64

EOF
fi

if [ $enable_utf8 = yes ] ; then
	DEFAULT_OBJS="${DEFAULT_OBJS} nl-utf8.o"
	cat >> config.h <<EOF
/* UTF8 support was chosen */
#define SUPPORT_UTF8

EOF
echo "UTF-8 is enabled"
fi

if [ $enable_readline = yes ] ; then
	cat >> config.h <<EOF
/* READLINE support was chosen */
#define READLINE

EOF
	echo "readline support is enabled"
else
	DEFAULT_RLFLAGS=""
	cat <<EOF
readline support is disabled

To enable readline support, use the --enable-readline option, and specify the
proper libraries to link by setting the RLFLAGS variable when running
configure.  Also if necessary, use the INCLUDES variable to specify where the
readline header files are.

EOF
fi

if [ $enable_ffi = yes ] ; then
	cat >> config.h <<EOF
/* FFI support was chosen */
#define FFI

EOF
	echo "ffi support is enabled"
else
	cat <<EOF
ffi support is disabled

To enable ffi support, use the --enable-ffi option, and specify the proper
libraries to link by setting the FFIFLAGS variable when running configure.
Also if necessary, use the INCLUDES variable to specify where the ffi header
files are.

EOF
fi

echo "/* EOF */" >> config.h

if [ $enable_static = yes ] ; then
	DEFAULT_LDFLAGS="${DEFAULT_LDFLAGS} -static"
	echo "Static linking enabled"
fi

if [ $enable_debug = yes ] ; then
	DEFAULT_CFLAGS="${DEFAULT_CFLAGS} -g"
	DEFAULT_LDFLAGS="${DEFAULT_LDFLAGS} -g"
	echo "Debugging enabled"
fi

cat >test-archflag.c <<EOF
#include <stdio.h>

int
main(int argc, char** argv) {
  printf("Hello World.\n");
}
EOF

DEFAULT_ARCHFLAGS=""
if   [ $memory_model = LP64 ] ; then
	if   [ $os_type = AIX -a ${CC:-${DEFAULT_CC}} = xlc_r ] ; then
		DEFAULT_ARCHFLAGS="-q64"
	elif [ $os_type = AIX -a ${CC:-${DEFAULT_CC}} = gcc ] ; then
    DEFAULT_ARCHFLAGS="-maix64"
  else
    if ${CC:-${DEFAULT_CC}} -m64 -o test-archflag test-archflag.c 2>/dev/null; then
      DEFAULT_ARCHFLAGS="-m64"
    fi
	fi
elif [ $memory_model = ILP32 ] ; then
    if ${CC:-${DEFAULT_CC}} -m32 -o test-archflag test-archflag.c 2>/dev/null; then
      DEFAULT_ARCHFLAGS="-m32"
    fi
fi
rm -f test-archflag*

STRIPBINARY="	\$(STRIP) \$(TARG)"
LINKSTAGE="	\$(CC) \$(OBJS) \$(ARCHFLAGS) \$(LDFLAGS) \$(RLFLAGS) \$(FFIFLAGS) -o \$(TARG)"
COMPILEOBJS="	\$(CC) \$(ARCHFLAGS) \$(CFLAGS) -DNEWCONFIG $<"

if [ $os_type = OS2 ] ; then
	STRIPBINARY=""
elif [ $os_type = AIX -a $memory_model = LP64 ] ; then
	LINKSTAGE=" OBJECT_MODE=64 \$(CC) \$(OBJS) \$(ARCHFLAGS) \$(LDFLAGS) \$(RLFLAGS) \$(FFIFLAGS) -o \$(TARG)"
fi

# Now let us make the Makefile (makefile_build)
cat > makefile_build <<EOF
# makefile for newLISP v. 10.1.x generated by the configure script (configure-alt)
CC = ${CC:-${DEFAULT_CC}}
CFLAGS = ${CFLAGS:-${DEFAULT_CFLAGS}} ${INCLUDES}
LDFLAGS = ${LDFLAGS:-${DEFAULT_LDFLAGS}}
OBJS = ${OBJS:-${DEFAULT_OBJS}}
STRIP = ${STRIP:-${DEFAULT_STRIP}}
TARG = ${TARG:-${DEFAULT_TARG}}
RLFLAGS = ${RLFLAGS:-${DEFAULT_RLFLAGS}}
FFIFLAGS = ${FFIFLAGS:-${DEFAULT_FFIFLAGS}}
ARCHFLAGS = ${ARCHFLAGS:-${DEFAULT_ARCHFLAGS}}

default: \$(OBJS)
${LINKSTAGE}
${STRIPBINARY}

.c.o:
${COMPILEOBJS}

\$(OBJS): primes.h protos.h config.h makefile_build
EOF

cat > makefile_install <<EOF
# This file was generated automatically by ./configure-alt

package=${PACKAGE}
version=${VERSION}
prefix=\$(DESTDIR)${prefix}
exec_prefix=\$(DESTDIR)${exec_prefix}
bindir=\$(DESTDIR)${bindir}
datarootdir=\$(DESTDIR)${datarootdir}
datadir=\$(DESTDIR)${datadir}
pkgdatadir=\$(DESTDIR)${pkgdatadir}
docdir=\$(DESTDIR)${docdir}
mandir=\$(DESTDIR)${mandir}
man1dir=\$(DESTDIR)${man1dir}

install:
	-install -d \$(pkgdatadir)
	-install -d \$(pkgdatadir)/modules
	-install -d \$(pkgdatadir)/util
	-install -d \$(docdir)
	-install -d \$(man1dir)
	-install -d \$(bindir)
	-rm -f \$(bindir)/newlisp
	-install -m 755  newlisp \$(bindir)/\$(package)-\$(version)
	-cd \$(bindir); ln -s \$(package)-\$(version) newlisp
	-install -m 755 util/newlispdoc \$(bindir)/newlispdoc
	-install -m 644 util/syntax.cgi \$(pkgdatadir)/util/syntax.cgi
	-install -m 644 util/newlisp.vim \$(pkgdatadir)/util/newlisp.vim
	-install -m 644 doc/COPYING \$(docdir)/COPYING
	-install -m 644 doc/CREDITS \$(docdir)/CREDITS
	-install -m 644 doc/newlisp_manual.html \$(docdir)/newlisp_manual.html
	-install -m 644 doc/newlisp_index.html \$(docdir)/newlisp_index.html
	-install -m 644 doc/manual_frame.html \$(docdir)/manual_frame.html
	-install -m 644 doc/CodePatterns.html \$(docdir)/CodePatterns.html
	-install -m 644 doc/newLISPdoc.html \$(docdir)/newLISPdoc.html
	-install -m 644 doc/newLISP-${version}-Release.html \$(docdir)/newLISP-${version}-Release.html
	-install -m 644 doc/newlisp.1 \$(man1dir)/newlisp.1
	-install -m 644 doc/newlispdoc.1 \$(man1dir)/newlispdoc.1
	-install -m 644 modules/canvas.lsp \$(pkgdatadir)/modules/canvas.lsp
	-install -m 644 modules/cgi.lsp \$(pkgdatadir)/modules/cgi.lsp
	-install -m 644 modules/crypto.lsp \$(pkgdatadir)/modules/crypto.lsp
	-install -m 644 modules/ftp.lsp \$(pkgdatadir)/modules/ftp.lsp
	-install -m 644 modules/getopts.lsp \$(pkgdatadir)/modules/getopts.lsp
	-install -m 644 modules/gsl.lsp \$(pkgdatadir)/modules/gsl.lsp
	-install -m 644 modules/infix.lsp \$(pkgdatadir)/modules/infix.lsp
	-install -m 644 modules/macro.lsp \$(pkgdatadir)/modules/macro.lsp
	-install -m 644 modules/mysql.lsp \$(pkgdatadir)/modules/mysql.lsp
	-install -m 644 modules/odbc.lsp \$(pkgdatadir)/modules/odbc.lsp
	-install -m 644 modules/plot.lsp \$(pkgdatadir)/modules/plot.lsp
	-install -m 644 modules/pop3.lsp \$(pkgdatadir)/modules/pop3.lsp
	-install -m 644 modules/postgres.lsp \$(pkgdatadir)/modules/postgres.lsp
	-install -m 644 modules/postscript.lsp \$(pkgdatadir)/modules/postscript.lsp
	-install -m 644 modules/smtp.lsp \$(pkgdatadir)/modules/smtp.lsp
	-install -m 644 modules/smtpx.lsp \$(pkgdatadir)/modules/smtpx.lsp
	-install -m 644 modules/sqlite3.lsp \$(pkgdatadir)/modules/sqlite3.lsp
	-install -m 644 modules/stat.lsp \$(pkgdatadir)/modules/stat.lsp
	-install -m 644 modules/unix.lsp \$(pkgdatadir)/modules/unix.lsp
	-install -m 644 modules/xmlrpc-client.lsp \$(pkgdatadir)/modules/xmlrpc-client.lsp
	-install -m 644 modules/zlib.lsp \$(pkgdatadir)/modules/zlib.lsp


uninstall:
	-rm  \$(bindir)/\$(package)
	-rm  \$(bindir)/\$(package)-\$(version)
	-rm  \$(bindir)/newlispdoc
	-rm  \$(bindir)/newlisp-edit
	-rm  -rf \$(pkgdatadir)
	-rm  -rf \$(docdir)
	-rm  \$(man1dir)/newlisp.1
	-rm  \$(man1dir)/newlispdoc.1

install_home uninstall_home:
	@echo "This option is disabled; please use the prefix variables at the configure stage."

# End of file
EOF

cat <<EOF

Variables:

	package=${PACKAGE}
	version=${VERSION}
	prefix=${prefix}
	exec_prefix=${exec_prefix}
	bindir=${bindir}
	datarootdir=${datarootdir}
	datadir=${datadir}
	pkgdatadir=${pkgdatadir}
	docdir=${docdir}
	mandir=${mandir}
	man1dir=${man1dir}

Type "make" to build your newlisp binary.
EOF

