1181834Sroberto THIS TARBALL IS NOT A FULL DISTRIBUTION. 2181834Sroberto 3181834SrobertoThe contents of this tarball is designed to be incorporated into 4285612Sdelphijsoftware packages that utilize the AutoOpts option automation package 5285612Sdelphijand are intended to be installed on systems that may not have libopts 6285612Sdelphijinstalled. It is redistributable under the terms of either the LGPL 7285612Sdelphij(see COPYING.lgpl) or under the terms of the advertising clause free BSD 8285612Sdelphijlicense (see COPYING.mbsd). 9181834Sroberto 10181834SrobertoUsage Instructions for autoconf/automake/libtoolized projects: 11181834Sroberto 12181834Sroberto1. Install the unrolled tarball into your package source tree, 13181834Sroberto copying ``libopts.m4'' to your autoconf macro directory. 14181834Sroberto 15181834Sroberto In your bootstrap (pre-configure) script, you can do this: 16181834Sroberto 17181834Sroberto rm -rf libopts libopts-* 18181834Sroberto gunzip -c `autoopts-config libsrc` | tar -xvf - 19181834Sroberto mv -f libopts-*.*.* libopts 20181834Sroberto cp -fp libopts/m4/*.m4 m4/. 21181834Sroberto 22181834Sroberto I tend to put my configure auxiliary files in "m4". 23181834Sroberto Whatever directory you choose, if it is not ".", then 24181834Sroberto be sure to tell autoconf about it with: 25181834Sroberto 26181834Sroberto AC_CONFIG_AUX_DIR(m4) 27181834Sroberto 28181834Sroberto This is one macro where you *MUST* remember to *NOT* quote 29181834Sroberto the argument. If you do, automake will get lost. 30181834Sroberto 31285612Sdelphij2. Add an invocation of either LIBOPTS_CHECK or LIBOPTS_CHECK_NOBUILD 32285612Sdelphij to your configure.ac file. See LIBOPTS_CHECK: below for details. 33181834Sroberto 34181834Sroberto3. Add the following to your top level ``Makefile.am'' file: 35181834Sroberto 36181834Sroberto if NEED_LIBOPTS 37181834Sroberto SUBDIRS += $(LIBOPTS_DIR) 38181834Sroberto endif 39181834Sroberto 40285612Sdelphij where ``<...>'' can be whatever other files or directories you may 41285612Sdelphij need. The SUBDIRS must be properly ordered. *PLEASE NOTE* it is 42285612Sdelphij crucial that the SUBDIRS be set under the control of an automake 43285612Sdelphij conditional. To work correctly, automake has to know the range of 44285612Sdelphij possible values of SUBDIRS. It's a magical name with magical 45285612Sdelphij properties. ``NEED_LIBOPTS'' will be correctly set by the 46285612Sdelphij ``LIBOPTS_CHECK'' macro, above. 47181834Sroberto 48181834Sroberto4. Add ``$(LIBOPTS_CFLAGS)'' to relevant compiler flags and 49181834Sroberto ``$(LIBOPTS_LDADD)'' to relevant link options whereever 50181834Sroberto you need them in your build tree. 51181834Sroberto 52181834Sroberto5. Make sure your object files explicitly depend upon the 53181834Sroberto generated options header file. e.g.: 54181834Sroberto 55181834Sroberto $(prog_OBJECTS) : prog-opts.h 56181834Sroberto prog-opts.h : prog-opts.c 57181834Sroberto prog-opts.c : prog-opts.def 58181834Sroberto autogen prog-opts.def 59181834Sroberto 60181834Sroberto6. *OPTIONAL* -- 61181834Sroberto If you are creating man pages and texi documentation from 62181834Sroberto the program options, you will need these rules somewhere, too: 63181834Sroberto 64181834Sroberto man_MANS = prog.1 65181834Sroberto prog.1 : prog-opts.def 66285612Sdelphij autogen -Tagman-cmd.tpl -bprog prog-opts.def 67181834Sroberto 68285612Sdelphij invoke-prog.texi : prog-opts.def 69285612Sdelphij autogen -Tagtexi-cmd.tpl prog-opts.def 70181834Sroberto 71181834SrobertoIf your package does not utilize the auto* tools, then you 72181834Srobertowill need to hand craft the rules for building the library. 73181834Sroberto 74285612SdelphijLIBOPTS_CHECK: 75285612Sdelphij 76285612SdelphijThe arguments to both macro are a relative path to the directory with 77285612Sdelphijthe libopts source code. It is optional and defaults to "libopts". 78285612SdelphijThese macros work as follows: 79285612Sdelphij 80285612Sdelphij1. LIBOPTS_CHECK([libopts/rel/path/optional]) 81285612Sdelphij 82285612Sdelphij Adds two command-line options to the generated configure script, 83285612Sdelphij --enable-local-libopts and --disable-libopts-install. AC_SUBST's 84285612Sdelphij LIBOPTS_CFLAGS, LIBOPTS_LDADD, and LIBOPTS_DIR for use in 85285612Sdelphij Makefile.am files. Adds Automake conditional NEED_LIBOPTS which 86285612Sdelphij will be true when the local copy of libopts should be built. Uses 87285612Sdelphij AC_CONFIG_FILES([$libopts-dir/Makefile]) to cause the local libopts 88285612Sdelphij into the package build. If the optional relative path to libopts is 89285612Sdelphij not provided, it defaults to simply "libopts". 90285612Sdelphij 91285612Sdelphij2. LIBOPTS_CHECK_NOBUILD([libopts/rel/path/optional]) 92285612Sdelphij 93285612Sdelphij This variant of LIBOPTS_CHECK is useful when multiple configure.ac 94285612Sdelphij files in a package make use of a single libopts tearoff. In that 95285612Sdelphij case, only one of the configure.ac files should build libopts and 96285612Sdelphij others should simply use it. Consider this package arrangment: 97285612Sdelphij 98285612Sdelphij all-tools/ 99285612Sdelphij configure.ac 100285612Sdelphij common-tools/ 101285612Sdelphij configure.ac 102285612Sdelphij libopts/ 103285612Sdelphij 104285612Sdelphij The parent package all-tools contains a subpackage common-tools 105285612Sdelphij which can be torn off and used independently. Programs configured 106285612Sdelphij by both configure.ac files link against the common-tools/libopts 107285612Sdelphij tearoff, when not using the system's libopts. The top-level 108285612Sdelphij configure.ac uses LIBOPTS_CHECK_NOBUILD([common-tools/libopts]), 109285612Sdelphij while common-tools/configure.ac uses LIBOPTS_CHECK. The difference 110285612Sdelphij is LIBOPTS_CHECK_NOBUILD will never build the libopts tearoff, 111285612Sdelphij leaving that to the subpackage configure.ac's LIBOPTS_CHECK. 112285612Sdelphij Specifically, LIBOPTS_CHECK_NOBUILD always results in the 113285612Sdelphij NEED_LIBOPTS Automake conditional being false, and does not invoke 114285612Sdelphij AC_CONFIG_FILES(path-to-libopts/Makefile). 115285612Sdelphij 116181834SrobertoLICENSING: 117181834Sroberto 118285612SdelphijThis material is Copyright (C) 1992-2015 by Bruce Korb. You are 119285612Sdelphijlicensed to use this under the terms of either the GNU Lesser General 120285612SdelphijPublic License (see: COPYING.lgpl), or, at your option, the modified 121285612SdelphijBerkeley Software Distribution License (see: COPYING.mbsd). Both of 122285612Sdelphijthese files should be included with this tarball. 123