This file includes the notes I took prior to and during my attempts to configure Skandha4 via automake/autoconf (as opposed to the original Sconfigure/Smake setup). The file is kinda random, but includes some thoughts about what we hoped to achieve, why we went with autoconf, how far I got with various parts, and some more pieces that need to be completed.
When I left off in September 1999, skandha4 would compile and "make check" was working for all of the pub modules plus the xsk3 module. As of this writing, bit-rot has set in and the compilation dies when it hits xgt, due to conflicts with the GLUT header files.
This version of the code has been checked into CVS, as a branch off the main code body tagged "autoconf". If anybody wants to experiment with it, just check out that branch and have at it. (Run the "configure" script to generate the necessary Makefiles, then run "make". Oh, and if you try this from a directory other than the source dir, you'll need to run "configure" twice -- the first time through, a few things break because there's no "info" dir yet. See the notes below for details.)
If you're new to autoconf/automake, here are a couple of sites that I found useful when learning about them:
Good luck!
Kevin Hinshaw
July 6, 2000
Ideas for the reorganization of Skandha ======================================= September 4, 1999 What are the basic features we want to support? * local compilation/testing (prior to install) * installation * user customization * compiling for multiple platforms Where to stash lisp code? * installed directory /usr/local/share/skandha/4 * locally compiled ${HOME}/src/skandha4/*/*/lsp * user's extras ${HOME}/.skandha Local customization * Jim proposed a new dir "local", which would contain - systems file - modules file Idea: could we turn each module into a library? What mechanisms have we discussed for fixing libraries problem? =============================================================== 1. new systems file(s) (one includes MINC libs, one doesn't) + easy short-term fix - perpetuates our system file split problem 2. Jim's "local" dir + allows customization by installer - probably won't work out-of-the-box without hacking (though templates would help) - if there's just one of each file, loses multi-platform support 3. let modules specify libs they need + leaving out a module would leave out its libs - more work 4. use DLL's (called "loadable modules" by Jeff?) + don't have to choose modules/libs when compiling + could work with option 3 - even more work 5. rely on autoconfig to only include available libs + allows multi-platform config (without replicating source) + much better long-term solution + could work with options 3 and/or 4 - even more work What do other packages do? ========================== * The Gimp - installed scripts in PREFIX/share/gimp/scripts (not in source tree though -- where do they come from?) - user has .gimp dir for scripts, brushes, etc. - source tree - basic app in "app" dir - other dirs: data, docs, help, plug-ins, ... * Emacs - installed data in PREFIX/share/emacs - contains dirs for versions (e.g. 20.3), plus site-lisp - user has .emacs file (which can load other code from anywhere) Multi-Platform Support ====================== The current setup requires replication of the whole source tree, with one copy for each platform where compilation will take place. Is there a way to allow for one copy of the source code, but multiple copies of platform-dependent files? What files are platform-dependent? * .o files * Makefiles * libraries * binaries Answer: autoconf will handle all of this! You can build the package away from the source code, which lets you have multiple platform-dependent build directories. Abolishing Sconfigure/Smake =========================== What do these two scripts create? Sconfigure ==> $LIB/Makefile.def mostly path defs $LIB/slisp_host link to systems file Smake ==> $BIN/$APP skandha4 script $SRC/$APP/Makefile app's makefile $SRC/$APP/Makefile.def more paths/defs $SRC/$APP/xmodules.h includes for module headers $SRC/$APP/info/ref.texi app's top-level info file What changes need to be made? ============================= * compilation - use autoconfig (and get rid of Sconfigure/Smake) * install - machine-independent code in $prefix/share/skandha - lsp (for what currently goes into /usr/local/xlisp) - fonts (for hershey.fnt) - preserve module hierarchy for lisp code? - use something like (require "xmri/xmri-lib") - would require changing lots o' require statements (could be automated though, since locations are known?) * user - add ~/.skandha to search path Questions ========= Q: How to move libs/binaries to more sensible places? Q: How/when to use maintainer mode? Q: How to conditionally include whole modules? A: Use modules file, as before. configure script loops over list and does what's necessary for each. Q: Can the list of included libraries be machine-dependent? (e.g. we need glut on linux, but not sgi) A: Yes. Based on the results of AC_CANONICAL_HOST, we can include different libs depending on the architecture. (For example, I set things up to only look for the GL library on SGIs.) Q: Could we put a modules file in each build dir, and use that for configuration? Should start off as a copy of master list, but could then be edited to include only certain modules. A: Yes. (It's on the to-do list.) Q: Why does "make" die on xg? - works the second time, but looks like the library isn't properly set up. A: Looks like it was confused by .o files in the source tree. (It worked the first time when I removed them.) Q: breaking on retina -- why? A: Have to use gmake instead of make. Useful autoconf macros ====================== * AC_MSG_CHECKING (feature-description) prints message that a feature is being checked Autoconf to-do list =================== * add "lab" modules * link problems - how do I get module-dependent required libs (e.g. libtiff)? * copy modules list into build dir (if one isn't there already) * shell script template - set install variables - fix tmp_mnt for paths in skandha4 script (happens when you do "pwd" on box that mounts your home dir) - change lib/bin locations? * make sure build's info dir exists before trying to write to it! * are dependencies working? - I modified xtif.c and recompiled -- the object and lib files were modified, but the final link didn't happen - make skandha4 depend on @MODULE_LIBS@ ? * add AC_DEFINE(HAVE_OPENGL) to OpenGL macro - will add a #define to config.h - use result in xgt/c/drivers/driverlist.h to decide what to include - for libGL, look for HAVE_LIBGL * add AC_DEFINE(HAVE_XMODULE) for each module? - might help tests Andrew is trying to do right now - how to get info to lisp level? - environment var - have C code for a module define something like *xmodule-exists* * AC_PROG_AWK to set AWK - do we still need it? I only see it in depend target in Makefile.x * move lib/bin files to better spots? * try moving all the extra scripts from top level to an "aux" dir - use AC_CONFIG_AUX_DIR(dir) to tell autoconf - includes things like config.sub, install-sh, texinfo.tex, etc. * info docs - generated info files are staying in source dir -- can we move them to the build dir? * move xmodules.h into top-level include dir? * make sure all files get listed somewhere in a Makefile.am (so that they go into the distribution) * breaks on gyrus - no tiff.h/tiffio.h (fixed, by copying from irix 5.3 box) - can't find glut & company - can't find libtiff. from config.log: configure:2728: gcc -o conftest -g -O2 conftest.c -ltiff 1>&5 ld32: FATAL 12: Expecting n32 objects: /usr/freeware/lib/libtiff.so is o32. Finished items ============== * generate xmodules.h (1999Sep16) * test code (1999Sep16) - automake supports a TESTS target - entries need to be programs (executables or scripts) - could I generate 1-line scripts with configure? - instead of using TESTS, I added a "check" target to each Makefile.am, which invokes skandha. Also added a top-level rule that greps for errors during testing. * info docs - had to redefine the .texi target in top level info/Makefile.am so that generated files (ref.texi) would be included properly - skandha-specific documentation was moved from the skandha/info dir to the top-level info dir * tiff.h problem - finding tiff.h in top-level "include" dir instead of installed copy - could remove that dir from search path (in xg.3d.fileio/c/Makefile.am) - should we even *have* local copies of tiff.h and tiffio.h? - Jeff recommends removing them, then adding proper autoconf logic to compile around xtif.c if necessary * major linking problems (1999Sep17) - separate lib for each module isn't working!!! - worked around by specifying final link rule by hand - used --[start/end]-group to group the module libs together, so that linker will keep scanning the group to resolve inter-dependencies - should probably find a better solution * MAKE CHECK RUNS for all pub modules (+ xsk3) !!! (1999Sep17!) * I/O in "make check" - Some check code tries to load data (e.g. TIFF files) as part of its testing. This causes problems if the data is a local file, because the test may be running in a completely separate build dir. To resolve this, I created templates for those tests (e.g. xtiftest.lsp.in) which use the @srcdir@ var to create a build-specific copy of the test. Not pretty, but it works for now, and there aren't many tests that need to worry about this. * link problems (1999Sep23) - earlier trick with start/end-group isn't recognized on SGI - dealt with one-lib-per-module by squishing all libs into one master lib right before the final link (thanks Darren!) * MAKE CHECK runs on linux *and* SGI (1999Sep23) - had to hack the link line on SGI, but that's all * how do I test for glut, Mesa, etc? (1999Sep27) - current rules aren't finding them - looks like .so files are the problem? when I try to link against them with a simple test program, I get lots of errors. ANSWER: needed to add dependencies when checking for the libs. I modified MDL_HAVE_OPENGL to do it, and it works! * MAKE CHECK runs on linux *and* retina (1999Sep27) - no hacking! - dying on gyrus because of libtiff problem Wishful thinking ================ * add a debug flag to the skandha script * only regenerate xmodules.h if we have to - right now it gets remade anytime we run configure, which forces everything to recompile Random notes while adding autoconf ================================== * xf1v looks like a dead structure, though it still has code in xg.3d. Get rid of it? * Is HOSTTYPE ever used? (set in skandha4 script) * see automake's notes about "built sources" when dealing with xvol-code.c * in app's Makefile (old version), why is "-grep '\*\*\*\*' check.log" at the end of the "depend" rule instead of the check rule? * it would be nice to make a "new-module" script that would create all the right subdirs and files for a new skandha module * "make check" hangs if it can't find a test file. Why? * working with mdl_have_opengl - not finding X libs/includes on SGI - in a non-standard place? Try adding with: ./configure --x-libraries=/usr/lib --x-includes=/usr/include/X11 - weird -- these *are* among the locations searched. See def'n for AC_PATH_X_DIRECT in /usr/share/autoconf/acspecific.m4. - notes about the AC_PATH_X rule - uses two macros to find X: AC_PATH_X_XMKMF and XC_PATH_X_DIRECT - the first one uses Imake to find the libs and headers - succeeds on linux - fails on SGI (because Imake isn't installed right?) - the second one hunts in a bunch of known locations - if it can include X headers using just <...>, then it won't add anything (this is the case on both SGI and linux) - succeeds on linux - succeeds on gyrus - succeeds on retina (I thought it failed, but it seems to be finding both headers and libs without any special additions) - when opengl macro checks for X, results are same as my test, EXCEPT for gyrus - my test adds -L/usr/lib to X_LIBS - the opengl macro adds nothing - caching problems - GL_LIBS and GL_CFLAGS get set right the first time, but not later when the cache kicks in. How do I save their values in the cache too? - I *finally* got them cached. These m4 macros are REALLY picky about spacing and quoting!!! - not finding mesa libs on linux, even though they are there - .so problem? - When testing opengl macro on SGI, I keep getting `!: Not found' while running configure. Why? - looks like a problem with mdl macro stmts starting "if ! ..." - try changing to "if test ! ..." - even worse on gyrus -- goes into infinite loop! - looks like there's a problem with AC_HELP_STRING, which is used by MDL_HAVE_OPENGL. I bypassed it for now.