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