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