README revision 1.1.1.2 1 1.1 kardel THIS TARBALL IS NOT A FULL DISTRIBUTION.
2 1.1 kardel
3 1.1 kardel The contents of this tarball is designed to be incorporated into
4 1.1.1.2 kardel software packages that utilize the AutoOpts option automation package
5 1.1.1.2 kardel and are intended to be installed on systems that may not have libopts
6 1.1.1.2 kardel installed. It is redistributable under the terms of either the LGPL
7 1.1.1.2 kardel (see COPYING.lgpl) or under the terms of the advertising clause free BSD
8 1.1.1.2 kardel license (see COPYING.mbsd).
9 1.1 kardel
10 1.1 kardel Usage Instructions for autoconf/automake/libtoolized projects:
11 1.1 kardel
12 1.1 kardel 1. Install the unrolled tarball into your package source tree,
13 1.1 kardel copying ``libopts.m4'' to your autoconf macro directory.
14 1.1 kardel
15 1.1 kardel In your bootstrap (pre-configure) script, you can do this:
16 1.1 kardel
17 1.1 kardel rm -rf libopts libopts-*
18 1.1 kardel gunzip -c `autoopts-config libsrc` | tar -xvf -
19 1.1 kardel mv -f libopts-*.*.* libopts
20 1.1 kardel cp -fp libopts/m4/*.m4 m4/.
21 1.1 kardel
22 1.1 kardel I tend to put my configure auxiliary files in "m4".
23 1.1 kardel Whatever directory you choose, if it is not ".", then
24 1.1 kardel be sure to tell autoconf about it with:
25 1.1 kardel
26 1.1 kardel AC_CONFIG_AUX_DIR(m4)
27 1.1 kardel
28 1.1 kardel This is one macro where you *MUST* remember to *NOT* quote
29 1.1 kardel the argument. If you do, automake will get lost.
30 1.1 kardel
31 1.1.1.2 kardel 2. Add an invocation of either LIBOPTS_CHECK or LIBOPTS_CHECK_NOBUILD
32 1.1.1.2 kardel to your configure.ac file. See LIBOPTS_CHECK: below for details.
33 1.1 kardel
34 1.1 kardel 3. Add the following to your top level ``Makefile.am'' file:
35 1.1 kardel
36 1.1 kardel if NEED_LIBOPTS
37 1.1 kardel SUBDIRS += $(LIBOPTS_DIR)
38 1.1 kardel endif
39 1.1 kardel
40 1.1.1.2 kardel where ``<...>'' can be whatever other files or directories you may
41 1.1.1.2 kardel need. The SUBDIRS must be properly ordered. *PLEASE NOTE* it is
42 1.1.1.2 kardel crucial that the SUBDIRS be set under the control of an automake
43 1.1.1.2 kardel conditional. To work correctly, automake has to know the range of
44 1.1.1.2 kardel possible values of SUBDIRS. It's a magical name with magical
45 1.1.1.2 kardel properties. ``NEED_LIBOPTS'' will be correctly set by the
46 1.1.1.2 kardel ``LIBOPTS_CHECK'' macro, above.
47 1.1 kardel
48 1.1 kardel 4. Add ``$(LIBOPTS_CFLAGS)'' to relevant compiler flags and
49 1.1 kardel ``$(LIBOPTS_LDADD)'' to relevant link options whereever
50 1.1 kardel you need them in your build tree.
51 1.1 kardel
52 1.1 kardel 5. Make sure your object files explicitly depend upon the
53 1.1 kardel generated options header file. e.g.:
54 1.1 kardel
55 1.1 kardel $(prog_OBJECTS) : prog-opts.h
56 1.1 kardel prog-opts.h : prog-opts.c
57 1.1 kardel prog-opts.c : prog-opts.def
58 1.1 kardel autogen prog-opts.def
59 1.1 kardel
60 1.1 kardel 6. *OPTIONAL* --
61 1.1 kardel If you are creating man pages and texi documentation from
62 1.1 kardel the program options, you will need these rules somewhere, too:
63 1.1 kardel
64 1.1 kardel man_MANS = prog.1
65 1.1 kardel prog.1 : prog-opts.def
66 1.1.1.2 kardel autogen -Tagman-cmd.tpl -bprog prog-opts.def
67 1.1 kardel
68 1.1.1.2 kardel invoke-prog.texi : prog-opts.def
69 1.1.1.2 kardel autogen -Tagtexi-cmd.tpl prog-opts.def
70 1.1 kardel
71 1.1 kardel If your package does not utilize the auto* tools, then you
72 1.1 kardel will need to hand craft the rules for building the library.
73 1.1 kardel
74 1.1.1.2 kardel LIBOPTS_CHECK:
75 1.1.1.2 kardel
76 1.1.1.2 kardel The arguments to both macro are a relative path to the directory with
77 1.1.1.2 kardel the libopts source code. It is optional and defaults to "libopts".
78 1.1.1.2 kardel These macros work as follows:
79 1.1.1.2 kardel
80 1.1.1.2 kardel 1. LIBOPTS_CHECK([libopts/rel/path/optional])
81 1.1.1.2 kardel
82 1.1.1.2 kardel Adds two command-line options to the generated configure script,
83 1.1.1.2 kardel --enable-local-libopts and --disable-libopts-install. AC_SUBST's
84 1.1.1.2 kardel LIBOPTS_CFLAGS, LIBOPTS_LDADD, and LIBOPTS_DIR for use in
85 1.1.1.2 kardel Makefile.am files. Adds Automake conditional NEED_LIBOPTS which
86 1.1.1.2 kardel will be true when the local copy of libopts should be built. Uses
87 1.1.1.2 kardel AC_CONFIG_FILES([$libopts-dir/Makefile]) to cause the local libopts
88 1.1.1.2 kardel into the package build. If the optional relative path to libopts is
89 1.1.1.2 kardel not provided, it defaults to simply "libopts".
90 1.1.1.2 kardel
91 1.1.1.2 kardel 2. LIBOPTS_CHECK_NOBUILD([libopts/rel/path/optional])
92 1.1.1.2 kardel
93 1.1.1.2 kardel This variant of LIBOPTS_CHECK is useful when multiple configure.ac
94 1.1.1.2 kardel files in a package make use of a single libopts tearoff. In that
95 1.1.1.2 kardel case, only one of the configure.ac files should build libopts and
96 1.1.1.2 kardel others should simply use it. Consider this package arrangment:
97 1.1.1.2 kardel
98 1.1.1.2 kardel all-tools/
99 1.1.1.2 kardel configure.ac
100 1.1.1.2 kardel common-tools/
101 1.1.1.2 kardel configure.ac
102 1.1.1.2 kardel libopts/
103 1.1.1.2 kardel
104 1.1.1.2 kardel The parent package all-tools contains a subpackage common-tools
105 1.1.1.2 kardel which can be torn off and used independently. Programs configured
106 1.1.1.2 kardel by both configure.ac files link against the common-tools/libopts
107 1.1.1.2 kardel tearoff, when not using the system's libopts. The top-level
108 1.1.1.2 kardel configure.ac uses LIBOPTS_CHECK_NOBUILD([common-tools/libopts]),
109 1.1.1.2 kardel while common-tools/configure.ac uses LIBOPTS_CHECK. The difference
110 1.1.1.2 kardel is LIBOPTS_CHECK_NOBUILD will never build the libopts tearoff,
111 1.1.1.2 kardel leaving that to the subpackage configure.ac's LIBOPTS_CHECK.
112 1.1.1.2 kardel Specifically, LIBOPTS_CHECK_NOBUILD always results in the
113 1.1.1.2 kardel NEED_LIBOPTS Automake conditional being false, and does not invoke
114 1.1.1.2 kardel AC_CONFIG_FILES(path-to-libopts/Makefile).
115 1.1.1.2 kardel
116 1.1 kardel LICENSING:
117 1.1 kardel
118 1.1.1.2 kardel This material is Copyright (c) 1992-2011 by Bruce Korb. You are
119 1.1.1.2 kardel licensed to use this under the terms of either the GNU Lesser General
120 1.1.1.2 kardel Public License (see: COPYING.lgpl), or, at your option, the modified
121 1.1.1.2 kardel Berkeley Software Distribution License (see: COPYING.mbsd). Both of
122 1.1.1.2 kardel these files should be included with this tarball.
123