You are looking at historical revision 3574 of this page. It may differ significantly from its current revision.
Using the gnu autotools with compiled code
This builds on Generating the smallest possible, self-contained executable and adds support for using the GNU Autotools (autoconf, automake, etc.).
Again, we start with our simple hello.scm:
$ cat hello.scm (display "Hello, world!\n") $ chicken hello.scm -explicit-use -uses library
Now we copy library.c, runtime.c, chicken.h and chicken-defaults.h from the CHICKEN source distribution into the current directory. (If your source directory doesn't have chicken-defaults.h, the make chicken-defaults.h command will build it for you.)
Next we need a Makefile.am and configure.in:
$ cat Makefile.am bin_PROGRAMS = hello hello_SOURCES = hello.c runtime.c library.c hello_LDADD = -lm
$ cat configure.in AC_INIT(hello, 1.0.0) AM_INIT_AUTOMAKE() AC_CONFIG_SRCDIR([chicken.h]) AC_CONFIG_HEADER([chicken-config.h]) # Checks for programs. AC_PROG_CC # Checks for header files. AC_FUNC_ALLOCA AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS([alloca.a stdint.h limits.h malloc.h stdint.h stdlib.h string.h sys/time.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_SIZE_T AC_HEADER_TIME AC_STRUCT_TM AC_C_VOLATILE # Checks for library functions. AC_FUNC_MALLOC AC_FUNC_REALLOC AC_TYPE_SIGNAL AC_FUNC_STAT AC_CHECK_FUNCS([floor memset modf pow strerror strncasecmp strpbrk]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT
(This is mostly generated by autoscan)
You should now have the following files:
Makefile.am chicken.h chicken-defaults.h configure.in hello.c library.c runtime.c
Running a few autotools in the appropriate order, we generate the rest of the required infrastructure:
$ aclocal $ autoheader $ automake --foreign -a --copy configure.in: installing `./install-sh' configure.in: installing `./mkinstalldirs' configure.in: installing `./missing' Makefile.am: installing `./depcomp' $ autoconf
Now you could put all files in the directory into a tarball and install it on most UNIX machines (For more exotic platforms, some tweaking of configure.in might be needed, though).
Build and installation can now be performed in the usual manner:
$ ./configure $ make $ make install