1ea906c41SOllivier Robert THIS TARBALL IS NOT A FULL DISTRIBUTION. 2ea906c41SOllivier Robert 3ea906c41SOllivier RobertThe contents of this tarball is designed to be incorporated into 42b15cb3dSCy Schubertsoftware packages that utilize the AutoOpts option automation package 52b15cb3dSCy Schubertand are intended to be installed on systems that may not have libopts 62b15cb3dSCy Schubertinstalled. It is redistributable under the terms of either the LGPL 72b15cb3dSCy Schubert(see COPYING.lgpl) or under the terms of the advertising clause free BSD 82b15cb3dSCy Schubertlicense (see COPYING.mbsd). 9ea906c41SOllivier Robert 10ea906c41SOllivier RobertUsage Instructions for autoconf/automake/libtoolized projects: 11ea906c41SOllivier Robert 12ea906c41SOllivier Robert1. Install the unrolled tarball into your package source tree, 13ea906c41SOllivier Robert copying ``libopts.m4'' to your autoconf macro directory. 14ea906c41SOllivier Robert 15ea906c41SOllivier Robert In your bootstrap (pre-configure) script, you can do this: 16ea906c41SOllivier Robert 17ea906c41SOllivier Robert rm -rf libopts libopts-* 18ea906c41SOllivier Robert gunzip -c `autoopts-config libsrc` | tar -xvf - 19ea906c41SOllivier Robert mv -f libopts-*.*.* libopts 20ea906c41SOllivier Robert cp -fp libopts/m4/*.m4 m4/. 21ea906c41SOllivier Robert 22ea906c41SOllivier Robert I tend to put my configure auxiliary files in "m4". 23ea906c41SOllivier Robert Whatever directory you choose, if it is not ".", then 24ea906c41SOllivier Robert be sure to tell autoconf about it with: 25ea906c41SOllivier Robert 26ea906c41SOllivier Robert AC_CONFIG_AUX_DIR(m4) 27ea906c41SOllivier Robert 28ea906c41SOllivier Robert This is one macro where you *MUST* remember to *NOT* quote 29ea906c41SOllivier Robert the argument. If you do, automake will get lost. 30ea906c41SOllivier Robert 312b15cb3dSCy Schubert2. Add an invocation of either LIBOPTS_CHECK or LIBOPTS_CHECK_NOBUILD 322b15cb3dSCy Schubert to your configure.ac file. See LIBOPTS_CHECK: below for details. 33ea906c41SOllivier Robert 34ea906c41SOllivier Robert3. Add the following to your top level ``Makefile.am'' file: 35ea906c41SOllivier Robert 36ea906c41SOllivier Robert if NEED_LIBOPTS 37ea906c41SOllivier Robert SUBDIRS += $(LIBOPTS_DIR) 38ea906c41SOllivier Robert endif 39ea906c41SOllivier Robert 402b15cb3dSCy Schubert where ``<...>'' can be whatever other files or directories you may 412b15cb3dSCy Schubert need. The SUBDIRS must be properly ordered. *PLEASE NOTE* it is 422b15cb3dSCy Schubert crucial that the SUBDIRS be set under the control of an automake 432b15cb3dSCy Schubert conditional. To work correctly, automake has to know the range of 442b15cb3dSCy Schubert possible values of SUBDIRS. It's a magical name with magical 452b15cb3dSCy Schubert properties. ``NEED_LIBOPTS'' will be correctly set by the 462b15cb3dSCy Schubert ``LIBOPTS_CHECK'' macro, above. 47ea906c41SOllivier Robert 48ea906c41SOllivier Robert4. Add ``$(LIBOPTS_CFLAGS)'' to relevant compiler flags and 49ea906c41SOllivier Robert ``$(LIBOPTS_LDADD)'' to relevant link options whereever 50ea906c41SOllivier Robert you need them in your build tree. 51ea906c41SOllivier Robert 52ea906c41SOllivier Robert5. Make sure your object files explicitly depend upon the 53ea906c41SOllivier Robert generated options header file. e.g.: 54ea906c41SOllivier Robert 55ea906c41SOllivier Robert $(prog_OBJECTS) : prog-opts.h 56ea906c41SOllivier Robert prog-opts.h : prog-opts.c 57ea906c41SOllivier Robert prog-opts.c : prog-opts.def 58ea906c41SOllivier Robert autogen prog-opts.def 59ea906c41SOllivier Robert 60ea906c41SOllivier Robert6. *OPTIONAL* -- 61ea906c41SOllivier Robert If you are creating man pages and texi documentation from 62ea906c41SOllivier Robert the program options, you will need these rules somewhere, too: 63ea906c41SOllivier Robert 64ea906c41SOllivier Robert man_MANS = prog.1 65ea906c41SOllivier Robert prog.1 : prog-opts.def 662b15cb3dSCy Schubert autogen -Tagman-cmd.tpl -bprog prog-opts.def 67ea906c41SOllivier Robert 682b15cb3dSCy Schubert invoke-prog.texi : prog-opts.def 692b15cb3dSCy Schubert autogen -Tagtexi-cmd.tpl prog-opts.def 70ea906c41SOllivier Robert 71ea906c41SOllivier RobertIf your package does not utilize the auto* tools, then you 72ea906c41SOllivier Robertwill need to hand craft the rules for building the library. 73ea906c41SOllivier Robert 742b15cb3dSCy SchubertLIBOPTS_CHECK: 752b15cb3dSCy Schubert 762b15cb3dSCy SchubertThe arguments to both macro are a relative path to the directory with 772b15cb3dSCy Schubertthe libopts source code. It is optional and defaults to "libopts". 782b15cb3dSCy SchubertThese macros work as follows: 792b15cb3dSCy Schubert 802b15cb3dSCy Schubert1. LIBOPTS_CHECK([libopts/rel/path/optional]) 812b15cb3dSCy Schubert 822b15cb3dSCy Schubert Adds two command-line options to the generated configure script, 832b15cb3dSCy Schubert --enable-local-libopts and --disable-libopts-install. AC_SUBST's 842b15cb3dSCy Schubert LIBOPTS_CFLAGS, LIBOPTS_LDADD, and LIBOPTS_DIR for use in 852b15cb3dSCy Schubert Makefile.am files. Adds Automake conditional NEED_LIBOPTS which 862b15cb3dSCy Schubert will be true when the local copy of libopts should be built. Uses 872b15cb3dSCy Schubert AC_CONFIG_FILES([$libopts-dir/Makefile]) to cause the local libopts 882b15cb3dSCy Schubert into the package build. If the optional relative path to libopts is 892b15cb3dSCy Schubert not provided, it defaults to simply "libopts". 902b15cb3dSCy Schubert 912b15cb3dSCy Schubert2. LIBOPTS_CHECK_NOBUILD([libopts/rel/path/optional]) 922b15cb3dSCy Schubert 932b15cb3dSCy Schubert This variant of LIBOPTS_CHECK is useful when multiple configure.ac 942b15cb3dSCy Schubert files in a package make use of a single libopts tearoff. In that 952b15cb3dSCy Schubert case, only one of the configure.ac files should build libopts and 962b15cb3dSCy Schubert others should simply use it. Consider this package arrangment: 972b15cb3dSCy Schubert 982b15cb3dSCy Schubert all-tools/ 992b15cb3dSCy Schubert configure.ac 1002b15cb3dSCy Schubert common-tools/ 1012b15cb3dSCy Schubert configure.ac 1022b15cb3dSCy Schubert libopts/ 1032b15cb3dSCy Schubert 1042b15cb3dSCy Schubert The parent package all-tools contains a subpackage common-tools 1052b15cb3dSCy Schubert which can be torn off and used independently. Programs configured 1062b15cb3dSCy Schubert by both configure.ac files link against the common-tools/libopts 1072b15cb3dSCy Schubert tearoff, when not using the system's libopts. The top-level 1082b15cb3dSCy Schubert configure.ac uses LIBOPTS_CHECK_NOBUILD([common-tools/libopts]), 1092b15cb3dSCy Schubert while common-tools/configure.ac uses LIBOPTS_CHECK. The difference 1102b15cb3dSCy Schubert is LIBOPTS_CHECK_NOBUILD will never build the libopts tearoff, 1112b15cb3dSCy Schubert leaving that to the subpackage configure.ac's LIBOPTS_CHECK. 1122b15cb3dSCy Schubert Specifically, LIBOPTS_CHECK_NOBUILD always results in the 1132b15cb3dSCy Schubert NEED_LIBOPTS Automake conditional being false, and does not invoke 1142b15cb3dSCy Schubert AC_CONFIG_FILES(path-to-libopts/Makefile). 1152b15cb3dSCy Schubert 116ea906c41SOllivier RobertLICENSING: 117ea906c41SOllivier Robert 118*a466cc55SCy SchubertThis material is Copyright (C) 1992-2018 by Bruce Korb. You are 1192b15cb3dSCy Schubertlicensed to use this under the terms of either the GNU Lesser General 1202b15cb3dSCy SchubertPublic License (see: COPYING.lgpl), or, at your option, the modified 1212b15cb3dSCy SchubertBerkeley Software Distribution License (see: COPYING.mbsd). Both of 1222b15cb3dSCy Schubertthese files should be included with this tarball. 123