INSTALL 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. There are two ways to build this code;
  2. (1) Manually
  3. (2) Using all-singing all-dancing (all-confusing) autotools, ie. autoconf,
  4. automake, and their little friends (autoheader, etc).
  5. =================
  6. Building Manually
  7. =================
  8. There is a basic "Makefile" in this directory that gets moved out of the way and
  9. ignored when building with autoconf et al. This Makefile is suitable for
  10. building tunala on Linux using gcc. Any other platform probably requires some
  11. tweaking. Here are the various bits you might need to do if you want to build
  12. this way and the default Makefile isn't sufficient;
  13. * Compiler: Edit the "CC" definition in Makefile
  14. * Headers, features: tunala.h controls what happens in the non-autoconf world.
  15. It, by default, assumes the system has *everything* (except autoconf's
  16. "config.h") so if a target system is missing something it must define the
  17. appropriate "NO_***" symbols in CFLAGS. These include;
  18. - NO_HAVE_UNISTD_H, NO_HAVE_FCNTL_H, NO_HAVE_LIMITS_H
  19. Indicates the compiling system doesn't have (or need) these header files.
  20. - NO_HAVE_STRSTR, NO_HAVE_STRTOUL
  21. Indicates the compiling system doesn't have these functions. Replacements
  22. are compiled and used in breakage.c
  23. - NO_HAVE_SELECT, NO_HAVE_SOCKET
  24. Pointless symbols - these indicate select() and/or socket() are missing in
  25. which case the program won't compile anyway.
  26. If you want to specify any of these, add them with "-D" prefixed to each in
  27. the CFLAGS definition in Makefile.
  28. * Compilation flags: edit DEBUG_FLAGS and/or CFLAGS directly to control the
  29. flags passed to the compiler. This can also be used to change the degree of
  30. optimisation.
  31. * Linker flags: some systems (eg. Solaris) require extra linker flags such as;
  32. -ldl, -lsocket, -lnsl, etc. If unsure, bring up the man page for whichever
  33. function is "undefined" when the linker fails - that usually indicates what
  34. you need to add. Make changes to the LINK_FLAGS symbol.
  35. * Linker command: if a different linker syntax or even a different program is
  36. required to link, edit the linker line directly in the "tunala:" target
  37. definition - it currently assumes the "CC" (compiler) program is used to link.
  38. ======================
  39. Building Automagically
  40. ======================
  41. Automagic building is handled courtesy of autoconf, automake, etc. There are in
  42. fact two steps required to build, and only the first has to be done on a system
  43. with these tools installed (and if I was prepared to bloat out the CVS
  44. repository, I could store these extra files, but I'm not).
  45. First step: "autogunk.sh"
  46. -------------------------
  47. The "./autogunk.sh" script will call all the necessary autotool commands to
  48. create missing files and run automake and autoconf. The result is that a
  49. "./configure" script should be generated and a "Makefile.in" generated from the
  50. supplied "Makefile.am". NB: This script also moves the "manual" Makefile (see
  51. above) out of the way and calls it "Makefile.plain" - the "ungunk" script
  52. reverses this to leave the directory it was previously.
  53. Once "ungunk" has been run, the resulting directory should be able to build on
  54. other systems without autoconf, automake, or libtool. Which is what the second
  55. step describes;
  56. Second step: "./configure"
  57. --------------------------
  58. The second step is to run the generated "./configure" script to create a
  59. config.h header for your system and to generate a "Makefile" (generated from
  60. "Makefile.in") tweaked to compile on your system. This is the standard sort of
  61. thing you see in GNU packages, for example, and the standard tricks also work.
  62. Eg. to override "configure"'s choice of compiler, set the CC environment
  63. variable prior to running configure, eg.
  64. CC=gcc ./configure
  65. would cause "gcc" to be used even if there is an otherwise preferable (to
  66. autoconf) native compiler on your system.
  67. After this run "make" and it should build the "tunala" executable.
  68. Notes
  69. -----
  70. - Some versions of autoconf (or automake?) generate a Makefile syntax that gives
  71. trouble to some "make" programs on some systems (eg. OpenBSD). If this
  72. happens, either build 'Manually' (see above) or use "gmake" instead of "make".
  73. I don't like this either but like even less the idea of sifting into all the
  74. script magic crud that's involved.
  75. - On a solaris system I tried, the "configure" script specified some broken
  76. compiler flags in the resulting Makefile that don't even get echoed to
  77. stdout/err when the error happens (evil!). If this happens, go into the
  78. generated Makefile, find the two affected targets ("%.o:" and "%.lo"), and
  79. remove the offending hidden option in the $(COMPILE) line all the sludge after
  80. the two first lines of script (ie. after the "echo" and the "COMPILE" lines).
  81. NB: This will probably only function if "--disable-shared" was used, otherwise
  82. who knows what would result ...