Simplify license variations, and add missing license texts.
* ChangeLog, ChangeLog.1996, ChangeLog.1997, ChangeLog.1998,
ChangeLog.1999, ChangeLog.2000, ChangeLog.2001, ChangeLog.2002,
ChangeLog.2003, ChangeLog.2004, ChangeLog.2005, ChangeLog.2006,
ChangeLog.2007, ChangeLog.2008, ChangeLog.2009, NEWS: Add
all-permissive license.
* HACKING, README, README.alpha, TODO: Relax license to RMS
encouraged all-permissive terms.
* libltdl/README: Ditto. I added the original license text in
2007, and there's no need for it to be so long for such a trivial
file.
* libltdl/config/getopt.m4sh, libltdl/general.m4sh: Cvs-utils is
dead, and I am the author of these files, so consolidated license
terms to match regular Libtool licensing.
* HACKING (Licensing Rules): Update wording, and list of files for
the all permissive license.
(GPL with CVS-Utils exception clause): Removed. No files have these
license any more.
(GPL with Libtool exception clause): Ditto, only libltdl/README
used to be distributed with this variation.
* AUTHORS: Add GPL license text.
2010-06-09 20:00:19 +08:00
|
|
|
m4_include([general.m4sh])m4_divert_push([KILL]) -*- Autoconf -*-
|
|
|
|
# getopt.m4sh -- getopt helper functions
|
2010-06-05 01:50:24 +08:00
|
|
|
#
|
2010-06-09 17:53:56 +08:00
|
|
|
# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
|
|
|
|
# Foundation, Inc.
|
2010-06-05 01:50:24 +08:00
|
|
|
# Written by Gary V. Vaughan, 2004
|
|
|
|
#
|
|
|
|
# This file is part of GNU Libtool.
|
|
|
|
#
|
|
|
|
# GNU Libtool is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License as
|
|
|
|
# published by the Free Software Foundation; either version 2 of
|
Simplify license variations, and add missing license texts.
* ChangeLog, ChangeLog.1996, ChangeLog.1997, ChangeLog.1998,
ChangeLog.1999, ChangeLog.2000, ChangeLog.2001, ChangeLog.2002,
ChangeLog.2003, ChangeLog.2004, ChangeLog.2005, ChangeLog.2006,
ChangeLog.2007, ChangeLog.2008, ChangeLog.2009, NEWS: Add
all-permissive license.
* HACKING, README, README.alpha, TODO: Relax license to RMS
encouraged all-permissive terms.
* libltdl/README: Ditto. I added the original license text in
2007, and there's no need for it to be so long for such a trivial
file.
* libltdl/config/getopt.m4sh, libltdl/general.m4sh: Cvs-utils is
dead, and I am the author of these files, so consolidated license
terms to match regular Libtool licensing.
* HACKING (Licensing Rules): Update wording, and list of files for
the all permissive license.
(GPL with CVS-Utils exception clause): Removed. No files have these
license any more.
(GPL with Libtool exception clause): Ditto, only libltdl/README
used to be distributed with this variation.
* AUTHORS: Add GPL license text.
2010-06-09 20:00:19 +08:00
|
|
|
# the License, or (at your option) any later version.
|
2010-06-05 01:50:24 +08:00
|
|
|
#
|
|
|
|
# As a special exception to the GNU General Public License, if you
|
|
|
|
# distribute this file as part of a program or library that contains
|
|
|
|
# a configuration script generated by Autoconf, you may include this
|
|
|
|
# file under the same distribution terms that you use for the rest
|
|
|
|
# of that program.
|
|
|
|
#
|
|
|
|
# GNU Libtool is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with GNU Libtool; see the file COPYING. If not, a copy
|
|
|
|
# can be downloaded from http://www.gnu.org/licenses/gpl.html,
|
|
|
|
# or obtained by writing to the Free Software Foundation, Inc.,
|
|
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* HACKING (Licensing Rules): Explain the various license texts
used for files distributed with Libtool, and update license text
to match.
* Makefile.am, Makefile.maint README, README.alpha, THANKS, TODO,
bootstrap, clcommit.m4sh, configure.ac, libltdl/Makefile.inc,
libltdl/README, libltdl/argz.c, libltdl/argz_.h,
libltdl/config/general.m4sh, libltdl/config/getopt.m4sh,
libltdl/config/ltmain.m4sh, libltdl/config/mailnotify.m4sh,
libltdl/config/mkstamp, libltdl/configure.ac,
libltdl/libltdl/lt__alloc.h, libltdl/libltdl/lt__dirent.h,
libltdl/libltdl/lt__glibc.h, libltdl/libltdl/lt__private.h,
libltdl/libltdl/lt__strl.h, libltdl/libltdl/lt_dlloader.h,
libltdl/libltdl/lt_error.h, libltdl/libltdl/lt_system.h,
libltdl/libltdl/slist.h, libltdl/loaders/dld_link.c,
libltdl/loaders/dlopen.c, libltdl/loaders/dyld.c,
libltdl/loaders/load_add_on.c, libltdl/loaders/loadlibrary.c,
libltdl/loaders/preopen.c, libltdl/loaders/shl_load.c,
libltdl/lt__alloc.c, libltdl/lt__dirent.c, libltdl/lt__strl.c,
libltdl/lt_dlloader.c, libltdl/lt_error.c, libltdl/ltdl.c,
libltdl/ltdl.h, libltdl/m4/argz.m4, libltdl/m4/libtool.m4,
libltdl/m4/ltdl.m4, libltdl/m4/ltoptions.m4,
libltdl/m4/ltsugar.m4, libltdl/m4/ltversion.in,
Jlibltdl/m4/ltversion.m4, libltdl/m4/lt~obsolete.m4,
libltdl/slist.c, libtoolize.m4sh, tests/am-subdir.at,
tests/cdemo-conf.test, tests/cdemo-exec.test,
tests/cdemo-make.test, tests/cdemo-shared.test,
tests/cdemo-static.test, tests/cdemo-undef.test,
tests/cdemo/Makefile.am, tests/cdemo/configure.ac,
tests/cdemo/foo.c, tests/cdemo/foo.h, tests/cdemo/main.c,
tests/cmdline_wrap.at, tests/convenience.at, tests/defs.m4sh,
tests/demo-conf.test, tests/demo-deplibs.test,
tests/demo-exec.test, tests/demo-hardcode.test,
tests/demo-inst.test, tests/demo-make.test,
tests/demo-nofast.test, tests/demo-noinst-link.test,
tests/demo-nopic.test, tests/demo-pic.test,
tests/demo-relink.test, tests/demo-shared.test,
tests/demo-static.test, tests/demo-unst.test,
tests/demo/Makefile.am, tests/demo/configure.ac,
tests/demo/dlmain.c, tests/demo/foo.c,
tests/demo/foo.h, tests/demo/hell1.c, tests/demo/hell2.c,
tests/demo/hello.c, tests/demo/main.c,
tests/depdemo-conf.test, tests/depdemo-exec.test,
tests/depdemo-inst.test, tests/depdemo-make.test,
tests/depdemo-nofast.test, tests/depdemo-relink.test,
tests/depdemo-shared.test, tests/depdemo-static.test,
tests/depdemo-unst.test, tests/depdemo/Makefile.am,
tests/depdemo/configure.ac, tests/depdemo/l1/Makefile.am,
tests/depdemo/l1/l1.c, tests/depdemo/l1/l1.h,
tests/depdemo/l2/Makefile.am, tests/depdemo/l2/l2.c,
tests/depdemo/l2/l2.h, tests/depdemo/l3/Makefile.am,
tests/depdemo/l3/l3.c, tests/depdemo/l3/l3.h,
tests/depdemo/l4/Makefile.am, tests/depdemo/l4/l4.c,
tests/depdemo/l4/l4.h, tests/depdemo/main.c,
tests/depdemo/sysdep.h, tests/deplibs-ident.at,
tests/destdir.at, tests/duplicate_conv.at,
tests/duplicate_deps.at, tests/duplicate_members.at,
tests/early-libtool.at, tests/export.at,
tests/f77demo-conf.test, tests/f77demo-exec.test,
tests/f77demo-make.test, tests/f77demo-shared.test,
tests/f77demo-static.test, tests/f77demo/Makefile.am,
tests/f77demo/configure.ac, tests/f77demo/cprogram.c,
tests/f77demo/foo.h, tests/f77demo/fooc.c,
tests/fail.at, tests/fcdemo-conf.test, tests/fcdemo-exec.test,
tests/fcdemo-make.test, tests/fcdemo-shared.test,
tests/fcdemo-static.test, tests/fcdemo/Makefile.am,
tests/fcdemo/configure.ac, tests/fcdemo/cprogram.c,
tests/fcdemo/foo.h, tests/fcdemo/fooc.c,
tests/inherited_flags.at, tests/libtoolize.at,
tests/link-2.test, tests/link-order.at, tests/link-order2.at,
tests/link.test, tests/lt_dlexit.at, tests/mdemo-conf.test,
tests/mdemo-dryrun.test, tests/mdemo-exec.test,
tests/mdemo-inst.test, tests/mdemo-make.test,
tests/mdemo-shared.test, tests/mdemo-static.test,
tests/mdemo-unst.test, tests/mdemo/Makefile.am,
tests/mdemo/configure.ac, tests/mdemo/foo.h, tests/mdemo/foo1.c,
tests/mdemo/foo2.c, tests/mdemo/main.c, tests/mdemo/mlib.c,
tests/mdemo/sub.c, tests/mdemo2-conf.test,
tests/mdemo2-exec.test, tests/mdemo2-make.test,
tests/mdemo2/Makefile.am, tests/mdemo2/configure.ac,
tests/mdemo2/main.c, tests/nomode.test, tests/nonrecursive.at,
tests/objectlist.test, tests/old-m4-iface.at,
tests/pdemo-conf.test, tests/pdemo-exec.test,
tests/pdemo-inst.test, tests/pdemo-make.test,
tests/pdemo/Makefile.am, tests/pdemo/configure.ac,
tests/pdemo/foo.h, tests/pdemo/longer_file_name_dlmain.c,
tests/pdemo/longer_file_name_foo.c,
tests/pdemo/longer_file_name_foo2.c,
tests/pdemo/longer_file_name_hell1.c,
tests/pdemo/longer_file_name_hell2.c,
tests/pdemo/longer_file_name_hello.c,
tests/pdemo/longer_file_name_main.c, tests/quote.test,
tests/recursive.at, tests/search-path.at, tests/sh.test,
tests/shlibpath.at, tests/standalone.at, tests/static.at,
tests/stresstest.at, tests/subproject.at, tests/suffix.test,
tests/tagdemo-conf.test, tests/tagdemo-exec.test,
tests/tagdemo-make.test, tests/tagdemo-shared.test,
tests/tagdemo-static.test, tests/tagdemo-undef.test,
tests/tagdemo/Makefile.am, tests/tagdemo/baz.cpp,
tests/tagdemo/baz.h, tests/tagdemo/configure.ac,
tests/tagdemo/conv.cpp, tests/tagdemo/conv.h,
tests/tagdemo/foo.cpp, tests/tagdemo/foo.h,
tests/tagdemo/main.cpp, tests/tagtrace.test,
tests/template.at, tests/testsuite.at: Apply correct license
text according to the new rules set out in HACKING.
2007-03-25 20:12:44 +08:00
|
|
|
|
2010-06-05 01:50:24 +08:00
|
|
|
# This file provides the M4SH_GETOPTS option processing compiler, and
|
|
|
|
# all necessary support at the m4 and shell-script levels.
|
|
|
|
#
|
|
|
|
# An m4sh script can include this file, and an M4SH_GETOPTS invocation
|
|
|
|
# that expands to a shell script option processing loop with similar
|
|
|
|
# abilites to a C program the uses getopt_long() to process it's command
|
|
|
|
# line options - although, unlike the C API, M4SH_GETOPTS also supplies
|
|
|
|
# the loop to step through and process the options.
|
|
|
|
#
|
|
|
|
# See the comment above M4SH_GETOPTS, below, for details.
|
* HACKING (Licensing Rules): Explain the various license texts
used for files distributed with Libtool, and update license text
to match.
* Makefile.am, Makefile.maint README, README.alpha, THANKS, TODO,
bootstrap, clcommit.m4sh, configure.ac, libltdl/Makefile.inc,
libltdl/README, libltdl/argz.c, libltdl/argz_.h,
libltdl/config/general.m4sh, libltdl/config/getopt.m4sh,
libltdl/config/ltmain.m4sh, libltdl/config/mailnotify.m4sh,
libltdl/config/mkstamp, libltdl/configure.ac,
libltdl/libltdl/lt__alloc.h, libltdl/libltdl/lt__dirent.h,
libltdl/libltdl/lt__glibc.h, libltdl/libltdl/lt__private.h,
libltdl/libltdl/lt__strl.h, libltdl/libltdl/lt_dlloader.h,
libltdl/libltdl/lt_error.h, libltdl/libltdl/lt_system.h,
libltdl/libltdl/slist.h, libltdl/loaders/dld_link.c,
libltdl/loaders/dlopen.c, libltdl/loaders/dyld.c,
libltdl/loaders/load_add_on.c, libltdl/loaders/loadlibrary.c,
libltdl/loaders/preopen.c, libltdl/loaders/shl_load.c,
libltdl/lt__alloc.c, libltdl/lt__dirent.c, libltdl/lt__strl.c,
libltdl/lt_dlloader.c, libltdl/lt_error.c, libltdl/ltdl.c,
libltdl/ltdl.h, libltdl/m4/argz.m4, libltdl/m4/libtool.m4,
libltdl/m4/ltdl.m4, libltdl/m4/ltoptions.m4,
libltdl/m4/ltsugar.m4, libltdl/m4/ltversion.in,
Jlibltdl/m4/ltversion.m4, libltdl/m4/lt~obsolete.m4,
libltdl/slist.c, libtoolize.m4sh, tests/am-subdir.at,
tests/cdemo-conf.test, tests/cdemo-exec.test,
tests/cdemo-make.test, tests/cdemo-shared.test,
tests/cdemo-static.test, tests/cdemo-undef.test,
tests/cdemo/Makefile.am, tests/cdemo/configure.ac,
tests/cdemo/foo.c, tests/cdemo/foo.h, tests/cdemo/main.c,
tests/cmdline_wrap.at, tests/convenience.at, tests/defs.m4sh,
tests/demo-conf.test, tests/demo-deplibs.test,
tests/demo-exec.test, tests/demo-hardcode.test,
tests/demo-inst.test, tests/demo-make.test,
tests/demo-nofast.test, tests/demo-noinst-link.test,
tests/demo-nopic.test, tests/demo-pic.test,
tests/demo-relink.test, tests/demo-shared.test,
tests/demo-static.test, tests/demo-unst.test,
tests/demo/Makefile.am, tests/demo/configure.ac,
tests/demo/dlmain.c, tests/demo/foo.c,
tests/demo/foo.h, tests/demo/hell1.c, tests/demo/hell2.c,
tests/demo/hello.c, tests/demo/main.c,
tests/depdemo-conf.test, tests/depdemo-exec.test,
tests/depdemo-inst.test, tests/depdemo-make.test,
tests/depdemo-nofast.test, tests/depdemo-relink.test,
tests/depdemo-shared.test, tests/depdemo-static.test,
tests/depdemo-unst.test, tests/depdemo/Makefile.am,
tests/depdemo/configure.ac, tests/depdemo/l1/Makefile.am,
tests/depdemo/l1/l1.c, tests/depdemo/l1/l1.h,
tests/depdemo/l2/Makefile.am, tests/depdemo/l2/l2.c,
tests/depdemo/l2/l2.h, tests/depdemo/l3/Makefile.am,
tests/depdemo/l3/l3.c, tests/depdemo/l3/l3.h,
tests/depdemo/l4/Makefile.am, tests/depdemo/l4/l4.c,
tests/depdemo/l4/l4.h, tests/depdemo/main.c,
tests/depdemo/sysdep.h, tests/deplibs-ident.at,
tests/destdir.at, tests/duplicate_conv.at,
tests/duplicate_deps.at, tests/duplicate_members.at,
tests/early-libtool.at, tests/export.at,
tests/f77demo-conf.test, tests/f77demo-exec.test,
tests/f77demo-make.test, tests/f77demo-shared.test,
tests/f77demo-static.test, tests/f77demo/Makefile.am,
tests/f77demo/configure.ac, tests/f77demo/cprogram.c,
tests/f77demo/foo.h, tests/f77demo/fooc.c,
tests/fail.at, tests/fcdemo-conf.test, tests/fcdemo-exec.test,
tests/fcdemo-make.test, tests/fcdemo-shared.test,
tests/fcdemo-static.test, tests/fcdemo/Makefile.am,
tests/fcdemo/configure.ac, tests/fcdemo/cprogram.c,
tests/fcdemo/foo.h, tests/fcdemo/fooc.c,
tests/inherited_flags.at, tests/libtoolize.at,
tests/link-2.test, tests/link-order.at, tests/link-order2.at,
tests/link.test, tests/lt_dlexit.at, tests/mdemo-conf.test,
tests/mdemo-dryrun.test, tests/mdemo-exec.test,
tests/mdemo-inst.test, tests/mdemo-make.test,
tests/mdemo-shared.test, tests/mdemo-static.test,
tests/mdemo-unst.test, tests/mdemo/Makefile.am,
tests/mdemo/configure.ac, tests/mdemo/foo.h, tests/mdemo/foo1.c,
tests/mdemo/foo2.c, tests/mdemo/main.c, tests/mdemo/mlib.c,
tests/mdemo/sub.c, tests/mdemo2-conf.test,
tests/mdemo2-exec.test, tests/mdemo2-make.test,
tests/mdemo2/Makefile.am, tests/mdemo2/configure.ac,
tests/mdemo2/main.c, tests/nomode.test, tests/nonrecursive.at,
tests/objectlist.test, tests/old-m4-iface.at,
tests/pdemo-conf.test, tests/pdemo-exec.test,
tests/pdemo-inst.test, tests/pdemo-make.test,
tests/pdemo/Makefile.am, tests/pdemo/configure.ac,
tests/pdemo/foo.h, tests/pdemo/longer_file_name_dlmain.c,
tests/pdemo/longer_file_name_foo.c,
tests/pdemo/longer_file_name_foo2.c,
tests/pdemo/longer_file_name_hell1.c,
tests/pdemo/longer_file_name_hell2.c,
tests/pdemo/longer_file_name_hello.c,
tests/pdemo/longer_file_name_main.c, tests/quote.test,
tests/recursive.at, tests/search-path.at, tests/sh.test,
tests/shlibpath.at, tests/standalone.at, tests/static.at,
tests/stresstest.at, tests/subproject.at, tests/suffix.test,
tests/tagdemo-conf.test, tests/tagdemo-exec.test,
tests/tagdemo-make.test, tests/tagdemo-shared.test,
tests/tagdemo-static.test, tests/tagdemo-undef.test,
tests/tagdemo/Makefile.am, tests/tagdemo/baz.cpp,
tests/tagdemo/baz.h, tests/tagdemo/configure.ac,
tests/tagdemo/conv.cpp, tests/tagdemo/conv.h,
tests/tagdemo/foo.cpp, tests/tagdemo/foo.h,
tests/tagdemo/main.cpp, tests/tagtrace.test,
tests/template.at, tests/testsuite.at: Apply correct license
text according to the new rules set out in HACKING.
2007-03-25 20:12:44 +08:00
|
|
|
|
|
|
|
|
2010-06-05 01:50:24 +08:00
|
|
|
# All internal macros begin with `m4go_'.
|
|
|
|
m4_pattern_forbid([^_?m4go_])
|
* HACKING (Licensing Rules): Explain the various license texts
used for files distributed with Libtool, and update license text
to match.
* Makefile.am, Makefile.maint README, README.alpha, THANKS, TODO,
bootstrap, clcommit.m4sh, configure.ac, libltdl/Makefile.inc,
libltdl/README, libltdl/argz.c, libltdl/argz_.h,
libltdl/config/general.m4sh, libltdl/config/getopt.m4sh,
libltdl/config/ltmain.m4sh, libltdl/config/mailnotify.m4sh,
libltdl/config/mkstamp, libltdl/configure.ac,
libltdl/libltdl/lt__alloc.h, libltdl/libltdl/lt__dirent.h,
libltdl/libltdl/lt__glibc.h, libltdl/libltdl/lt__private.h,
libltdl/libltdl/lt__strl.h, libltdl/libltdl/lt_dlloader.h,
libltdl/libltdl/lt_error.h, libltdl/libltdl/lt_system.h,
libltdl/libltdl/slist.h, libltdl/loaders/dld_link.c,
libltdl/loaders/dlopen.c, libltdl/loaders/dyld.c,
libltdl/loaders/load_add_on.c, libltdl/loaders/loadlibrary.c,
libltdl/loaders/preopen.c, libltdl/loaders/shl_load.c,
libltdl/lt__alloc.c, libltdl/lt__dirent.c, libltdl/lt__strl.c,
libltdl/lt_dlloader.c, libltdl/lt_error.c, libltdl/ltdl.c,
libltdl/ltdl.h, libltdl/m4/argz.m4, libltdl/m4/libtool.m4,
libltdl/m4/ltdl.m4, libltdl/m4/ltoptions.m4,
libltdl/m4/ltsugar.m4, libltdl/m4/ltversion.in,
Jlibltdl/m4/ltversion.m4, libltdl/m4/lt~obsolete.m4,
libltdl/slist.c, libtoolize.m4sh, tests/am-subdir.at,
tests/cdemo-conf.test, tests/cdemo-exec.test,
tests/cdemo-make.test, tests/cdemo-shared.test,
tests/cdemo-static.test, tests/cdemo-undef.test,
tests/cdemo/Makefile.am, tests/cdemo/configure.ac,
tests/cdemo/foo.c, tests/cdemo/foo.h, tests/cdemo/main.c,
tests/cmdline_wrap.at, tests/convenience.at, tests/defs.m4sh,
tests/demo-conf.test, tests/demo-deplibs.test,
tests/demo-exec.test, tests/demo-hardcode.test,
tests/demo-inst.test, tests/demo-make.test,
tests/demo-nofast.test, tests/demo-noinst-link.test,
tests/demo-nopic.test, tests/demo-pic.test,
tests/demo-relink.test, tests/demo-shared.test,
tests/demo-static.test, tests/demo-unst.test,
tests/demo/Makefile.am, tests/demo/configure.ac,
tests/demo/dlmain.c, tests/demo/foo.c,
tests/demo/foo.h, tests/demo/hell1.c, tests/demo/hell2.c,
tests/demo/hello.c, tests/demo/main.c,
tests/depdemo-conf.test, tests/depdemo-exec.test,
tests/depdemo-inst.test, tests/depdemo-make.test,
tests/depdemo-nofast.test, tests/depdemo-relink.test,
tests/depdemo-shared.test, tests/depdemo-static.test,
tests/depdemo-unst.test, tests/depdemo/Makefile.am,
tests/depdemo/configure.ac, tests/depdemo/l1/Makefile.am,
tests/depdemo/l1/l1.c, tests/depdemo/l1/l1.h,
tests/depdemo/l2/Makefile.am, tests/depdemo/l2/l2.c,
tests/depdemo/l2/l2.h, tests/depdemo/l3/Makefile.am,
tests/depdemo/l3/l3.c, tests/depdemo/l3/l3.h,
tests/depdemo/l4/Makefile.am, tests/depdemo/l4/l4.c,
tests/depdemo/l4/l4.h, tests/depdemo/main.c,
tests/depdemo/sysdep.h, tests/deplibs-ident.at,
tests/destdir.at, tests/duplicate_conv.at,
tests/duplicate_deps.at, tests/duplicate_members.at,
tests/early-libtool.at, tests/export.at,
tests/f77demo-conf.test, tests/f77demo-exec.test,
tests/f77demo-make.test, tests/f77demo-shared.test,
tests/f77demo-static.test, tests/f77demo/Makefile.am,
tests/f77demo/configure.ac, tests/f77demo/cprogram.c,
tests/f77demo/foo.h, tests/f77demo/fooc.c,
tests/fail.at, tests/fcdemo-conf.test, tests/fcdemo-exec.test,
tests/fcdemo-make.test, tests/fcdemo-shared.test,
tests/fcdemo-static.test, tests/fcdemo/Makefile.am,
tests/fcdemo/configure.ac, tests/fcdemo/cprogram.c,
tests/fcdemo/foo.h, tests/fcdemo/fooc.c,
tests/inherited_flags.at, tests/libtoolize.at,
tests/link-2.test, tests/link-order.at, tests/link-order2.at,
tests/link.test, tests/lt_dlexit.at, tests/mdemo-conf.test,
tests/mdemo-dryrun.test, tests/mdemo-exec.test,
tests/mdemo-inst.test, tests/mdemo-make.test,
tests/mdemo-shared.test, tests/mdemo-static.test,
tests/mdemo-unst.test, tests/mdemo/Makefile.am,
tests/mdemo/configure.ac, tests/mdemo/foo.h, tests/mdemo/foo1.c,
tests/mdemo/foo2.c, tests/mdemo/main.c, tests/mdemo/mlib.c,
tests/mdemo/sub.c, tests/mdemo2-conf.test,
tests/mdemo2-exec.test, tests/mdemo2-make.test,
tests/mdemo2/Makefile.am, tests/mdemo2/configure.ac,
tests/mdemo2/main.c, tests/nomode.test, tests/nonrecursive.at,
tests/objectlist.test, tests/old-m4-iface.at,
tests/pdemo-conf.test, tests/pdemo-exec.test,
tests/pdemo-inst.test, tests/pdemo-make.test,
tests/pdemo/Makefile.am, tests/pdemo/configure.ac,
tests/pdemo/foo.h, tests/pdemo/longer_file_name_dlmain.c,
tests/pdemo/longer_file_name_foo.c,
tests/pdemo/longer_file_name_foo2.c,
tests/pdemo/longer_file_name_hell1.c,
tests/pdemo/longer_file_name_hell2.c,
tests/pdemo/longer_file_name_hello.c,
tests/pdemo/longer_file_name_main.c, tests/quote.test,
tests/recursive.at, tests/search-path.at, tests/sh.test,
tests/shlibpath.at, tests/standalone.at, tests/static.at,
tests/stresstest.at, tests/subproject.at, tests/suffix.test,
tests/tagdemo-conf.test, tests/tagdemo-exec.test,
tests/tagdemo-make.test, tests/tagdemo-shared.test,
tests/tagdemo-static.test, tests/tagdemo-undef.test,
tests/tagdemo/Makefile.am, tests/tagdemo/baz.cpp,
tests/tagdemo/baz.h, tests/tagdemo/configure.ac,
tests/tagdemo/conv.cpp, tests/tagdemo/conv.h,
tests/tagdemo/foo.cpp, tests/tagdemo/foo.h,
tests/tagdemo/main.cpp, tests/tagtrace.test,
tests/template.at, tests/testsuite.at: Apply correct license
text according to the new rules set out in HACKING.
2007-03-25 20:12:44 +08:00
|
|
|
|
2010-06-21 20:49:29 +08:00
|
|
|
|
|
|
|
## --------------------------- ##
|
|
|
|
## 1. Backwards compatibility. ##
|
|
|
|
## --------------------------- ##
|
|
|
|
|
2010-06-12 01:12:09 +08:00
|
|
|
# We prefer m4sugar.m4 from Autoconf-2.64, but have fallbacks in this
|
|
|
|
# section that work back as far as Autoconf-2.61. This file is used
|
|
|
|
# at bootstrap time to generate the shell processing loop for ltmain.sh
|
|
|
|
# and libtoolize.in, so it's okay for the requirement to be tighter
|
|
|
|
# than the configure time Autoconf prerequisite version.
|
|
|
|
m4_version_prereq([2.61])
|
|
|
|
|
2010-06-21 20:49:29 +08:00
|
|
|
# m4_chomp(STRING)
|
|
|
|
# ----------------
|
|
|
|
# m4_chomp was not introduced until Autoconf-2.64. Currently we
|
|
|
|
# only use it indirectly via m4go_expand, below. This implementation
|
|
|
|
# is taken from Autoconf-2.65.
|
|
|
|
m4_ifndef([m4_chomp],
|
|
|
|
[m4_define([m4_chomp],
|
|
|
|
[m4_format([[%.*s]], m4_index(m4_translit([[$1]], [
|
|
|
|
/.], [/ ])[./.], [/.]), [$1])])])
|
|
|
|
|
|
|
|
# m4go_expand(ARG)
|
|
|
|
# ----------------
|
|
|
|
# M4SH_GETOPTS wants to pass unbalanced parentheses to m4_expand to
|
|
|
|
# build the branches of a shell `case' statement. That is only
|
|
|
|
# supported by the implementation of m4_expand in Autoconf-2.64 and
|
|
|
|
# newer. Since we want to be compatible back to at least
|
|
|
|
# Autoconf-2.62, reimplement our own 2.64 based m4_expand in the
|
|
|
|
# m4go_ namespace so that we can be compatible with Autoconf versions
|
|
|
|
# supporting either semantic.
|
|
|
|
m4_define([m4go_expand],
|
|
|
|
[m4_chomp(_$0([$1
|
|
|
|
]))])
|
|
|
|
|
|
|
|
m4_define([_m4go_expand], [$0_([$1], [(], -=<{($1)}>=-, [}>=-])])
|
|
|
|
|
|
|
|
m4_define([_m4go_ignore])
|
|
|
|
|
|
|
|
m4_define([_m4go_expand_],
|
|
|
|
[m4_if([$4], [}>=-],
|
|
|
|
[m4_changequote([-=<{$2], [)}>=-])$3m4_changequote([, ])],
|
|
|
|
[$0([$1], [($2], -=<{($2$1)}>=-, [}>=-])_m4go_ignore$2])])
|
|
|
|
|
|
|
|
|
2010-06-05 01:50:24 +08:00
|
|
|
## --------------------------------- ##
|
2010-06-21 20:49:29 +08:00
|
|
|
## 2. Low level string manipulation. ##
|
2010-06-05 01:50:24 +08:00
|
|
|
## --------------------------------- ##
|
* HACKING (Licensing Rules): Explain the various license texts
used for files distributed with Libtool, and update license text
to match.
* Makefile.am, Makefile.maint README, README.alpha, THANKS, TODO,
bootstrap, clcommit.m4sh, configure.ac, libltdl/Makefile.inc,
libltdl/README, libltdl/argz.c, libltdl/argz_.h,
libltdl/config/general.m4sh, libltdl/config/getopt.m4sh,
libltdl/config/ltmain.m4sh, libltdl/config/mailnotify.m4sh,
libltdl/config/mkstamp, libltdl/configure.ac,
libltdl/libltdl/lt__alloc.h, libltdl/libltdl/lt__dirent.h,
libltdl/libltdl/lt__glibc.h, libltdl/libltdl/lt__private.h,
libltdl/libltdl/lt__strl.h, libltdl/libltdl/lt_dlloader.h,
libltdl/libltdl/lt_error.h, libltdl/libltdl/lt_system.h,
libltdl/libltdl/slist.h, libltdl/loaders/dld_link.c,
libltdl/loaders/dlopen.c, libltdl/loaders/dyld.c,
libltdl/loaders/load_add_on.c, libltdl/loaders/loadlibrary.c,
libltdl/loaders/preopen.c, libltdl/loaders/shl_load.c,
libltdl/lt__alloc.c, libltdl/lt__dirent.c, libltdl/lt__strl.c,
libltdl/lt_dlloader.c, libltdl/lt_error.c, libltdl/ltdl.c,
libltdl/ltdl.h, libltdl/m4/argz.m4, libltdl/m4/libtool.m4,
libltdl/m4/ltdl.m4, libltdl/m4/ltoptions.m4,
libltdl/m4/ltsugar.m4, libltdl/m4/ltversion.in,
Jlibltdl/m4/ltversion.m4, libltdl/m4/lt~obsolete.m4,
libltdl/slist.c, libtoolize.m4sh, tests/am-subdir.at,
tests/cdemo-conf.test, tests/cdemo-exec.test,
tests/cdemo-make.test, tests/cdemo-shared.test,
tests/cdemo-static.test, tests/cdemo-undef.test,
tests/cdemo/Makefile.am, tests/cdemo/configure.ac,
tests/cdemo/foo.c, tests/cdemo/foo.h, tests/cdemo/main.c,
tests/cmdline_wrap.at, tests/convenience.at, tests/defs.m4sh,
tests/demo-conf.test, tests/demo-deplibs.test,
tests/demo-exec.test, tests/demo-hardcode.test,
tests/demo-inst.test, tests/demo-make.test,
tests/demo-nofast.test, tests/demo-noinst-link.test,
tests/demo-nopic.test, tests/demo-pic.test,
tests/demo-relink.test, tests/demo-shared.test,
tests/demo-static.test, tests/demo-unst.test,
tests/demo/Makefile.am, tests/demo/configure.ac,
tests/demo/dlmain.c, tests/demo/foo.c,
tests/demo/foo.h, tests/demo/hell1.c, tests/demo/hell2.c,
tests/demo/hello.c, tests/demo/main.c,
tests/depdemo-conf.test, tests/depdemo-exec.test,
tests/depdemo-inst.test, tests/depdemo-make.test,
tests/depdemo-nofast.test, tests/depdemo-relink.test,
tests/depdemo-shared.test, tests/depdemo-static.test,
tests/depdemo-unst.test, tests/depdemo/Makefile.am,
tests/depdemo/configure.ac, tests/depdemo/l1/Makefile.am,
tests/depdemo/l1/l1.c, tests/depdemo/l1/l1.h,
tests/depdemo/l2/Makefile.am, tests/depdemo/l2/l2.c,
tests/depdemo/l2/l2.h, tests/depdemo/l3/Makefile.am,
tests/depdemo/l3/l3.c, tests/depdemo/l3/l3.h,
tests/depdemo/l4/Makefile.am, tests/depdemo/l4/l4.c,
tests/depdemo/l4/l4.h, tests/depdemo/main.c,
tests/depdemo/sysdep.h, tests/deplibs-ident.at,
tests/destdir.at, tests/duplicate_conv.at,
tests/duplicate_deps.at, tests/duplicate_members.at,
tests/early-libtool.at, tests/export.at,
tests/f77demo-conf.test, tests/f77demo-exec.test,
tests/f77demo-make.test, tests/f77demo-shared.test,
tests/f77demo-static.test, tests/f77demo/Makefile.am,
tests/f77demo/configure.ac, tests/f77demo/cprogram.c,
tests/f77demo/foo.h, tests/f77demo/fooc.c,
tests/fail.at, tests/fcdemo-conf.test, tests/fcdemo-exec.test,
tests/fcdemo-make.test, tests/fcdemo-shared.test,
tests/fcdemo-static.test, tests/fcdemo/Makefile.am,
tests/fcdemo/configure.ac, tests/fcdemo/cprogram.c,
tests/fcdemo/foo.h, tests/fcdemo/fooc.c,
tests/inherited_flags.at, tests/libtoolize.at,
tests/link-2.test, tests/link-order.at, tests/link-order2.at,
tests/link.test, tests/lt_dlexit.at, tests/mdemo-conf.test,
tests/mdemo-dryrun.test, tests/mdemo-exec.test,
tests/mdemo-inst.test, tests/mdemo-make.test,
tests/mdemo-shared.test, tests/mdemo-static.test,
tests/mdemo-unst.test, tests/mdemo/Makefile.am,
tests/mdemo/configure.ac, tests/mdemo/foo.h, tests/mdemo/foo1.c,
tests/mdemo/foo2.c, tests/mdemo/main.c, tests/mdemo/mlib.c,
tests/mdemo/sub.c, tests/mdemo2-conf.test,
tests/mdemo2-exec.test, tests/mdemo2-make.test,
tests/mdemo2/Makefile.am, tests/mdemo2/configure.ac,
tests/mdemo2/main.c, tests/nomode.test, tests/nonrecursive.at,
tests/objectlist.test, tests/old-m4-iface.at,
tests/pdemo-conf.test, tests/pdemo-exec.test,
tests/pdemo-inst.test, tests/pdemo-make.test,
tests/pdemo/Makefile.am, tests/pdemo/configure.ac,
tests/pdemo/foo.h, tests/pdemo/longer_file_name_dlmain.c,
tests/pdemo/longer_file_name_foo.c,
tests/pdemo/longer_file_name_foo2.c,
tests/pdemo/longer_file_name_hell1.c,
tests/pdemo/longer_file_name_hell2.c,
tests/pdemo/longer_file_name_hello.c,
tests/pdemo/longer_file_name_main.c, tests/quote.test,
tests/recursive.at, tests/search-path.at, tests/sh.test,
tests/shlibpath.at, tests/standalone.at, tests/static.at,
tests/stresstest.at, tests/subproject.at, tests/suffix.test,
tests/tagdemo-conf.test, tests/tagdemo-exec.test,
tests/tagdemo-make.test, tests/tagdemo-shared.test,
tests/tagdemo-static.test, tests/tagdemo-undef.test,
tests/tagdemo/Makefile.am, tests/tagdemo/baz.cpp,
tests/tagdemo/baz.h, tests/tagdemo/configure.ac,
tests/tagdemo/conv.cpp, tests/tagdemo/conv.h,
tests/tagdemo/foo.cpp, tests/tagdemo/foo.h,
tests/tagdemo/main.cpp, tests/tagtrace.test,
tests/template.at, tests/testsuite.at: Apply correct license
text according to the new rules set out in HACKING.
2007-03-25 20:12:44 +08:00
|
|
|
|
2010-06-05 01:50:24 +08:00
|
|
|
# m4go_slice(STRING, BEGIN, END)
|
|
|
|
# ------------------------------
|
|
|
|
# Just like m4_substr(), except that both the BEGIN and END of the
|
|
|
|
# substring are given as offsets from the beginning of STRING, as
|
|
|
|
# returned by m4_index().
|
|
|
|
m4_define([m4go_slice],
|
|
|
|
[m4_substr([$1], [$2], m4_eval([$3-$2]))])
|
* HACKING (Licensing Rules): Explain the various license texts
used for files distributed with Libtool, and update license text
to match.
* Makefile.am, Makefile.maint README, README.alpha, THANKS, TODO,
bootstrap, clcommit.m4sh, configure.ac, libltdl/Makefile.inc,
libltdl/README, libltdl/argz.c, libltdl/argz_.h,
libltdl/config/general.m4sh, libltdl/config/getopt.m4sh,
libltdl/config/ltmain.m4sh, libltdl/config/mailnotify.m4sh,
libltdl/config/mkstamp, libltdl/configure.ac,
libltdl/libltdl/lt__alloc.h, libltdl/libltdl/lt__dirent.h,
libltdl/libltdl/lt__glibc.h, libltdl/libltdl/lt__private.h,
libltdl/libltdl/lt__strl.h, libltdl/libltdl/lt_dlloader.h,
libltdl/libltdl/lt_error.h, libltdl/libltdl/lt_system.h,
libltdl/libltdl/slist.h, libltdl/loaders/dld_link.c,
libltdl/loaders/dlopen.c, libltdl/loaders/dyld.c,
libltdl/loaders/load_add_on.c, libltdl/loaders/loadlibrary.c,
libltdl/loaders/preopen.c, libltdl/loaders/shl_load.c,
libltdl/lt__alloc.c, libltdl/lt__dirent.c, libltdl/lt__strl.c,
libltdl/lt_dlloader.c, libltdl/lt_error.c, libltdl/ltdl.c,
libltdl/ltdl.h, libltdl/m4/argz.m4, libltdl/m4/libtool.m4,
libltdl/m4/ltdl.m4, libltdl/m4/ltoptions.m4,
libltdl/m4/ltsugar.m4, libltdl/m4/ltversion.in,
Jlibltdl/m4/ltversion.m4, libltdl/m4/lt~obsolete.m4,
libltdl/slist.c, libtoolize.m4sh, tests/am-subdir.at,
tests/cdemo-conf.test, tests/cdemo-exec.test,
tests/cdemo-make.test, tests/cdemo-shared.test,
tests/cdemo-static.test, tests/cdemo-undef.test,
tests/cdemo/Makefile.am, tests/cdemo/configure.ac,
tests/cdemo/foo.c, tests/cdemo/foo.h, tests/cdemo/main.c,
tests/cmdline_wrap.at, tests/convenience.at, tests/defs.m4sh,
tests/demo-conf.test, tests/demo-deplibs.test,
tests/demo-exec.test, tests/demo-hardcode.test,
tests/demo-inst.test, tests/demo-make.test,
tests/demo-nofast.test, tests/demo-noinst-link.test,
tests/demo-nopic.test, tests/demo-pic.test,
tests/demo-relink.test, tests/demo-shared.test,
tests/demo-static.test, tests/demo-unst.test,
tests/demo/Makefile.am, tests/demo/configure.ac,
tests/demo/dlmain.c, tests/demo/foo.c,
tests/demo/foo.h, tests/demo/hell1.c, tests/demo/hell2.c,
tests/demo/hello.c, tests/demo/main.c,
tests/depdemo-conf.test, tests/depdemo-exec.test,
tests/depdemo-inst.test, tests/depdemo-make.test,
tests/depdemo-nofast.test, tests/depdemo-relink.test,
tests/depdemo-shared.test, tests/depdemo-static.test,
tests/depdemo-unst.test, tests/depdemo/Makefile.am,
tests/depdemo/configure.ac, tests/depdemo/l1/Makefile.am,
tests/depdemo/l1/l1.c, tests/depdemo/l1/l1.h,
tests/depdemo/l2/Makefile.am, tests/depdemo/l2/l2.c,
tests/depdemo/l2/l2.h, tests/depdemo/l3/Makefile.am,
tests/depdemo/l3/l3.c, tests/depdemo/l3/l3.h,
tests/depdemo/l4/Makefile.am, tests/depdemo/l4/l4.c,
tests/depdemo/l4/l4.h, tests/depdemo/main.c,
tests/depdemo/sysdep.h, tests/deplibs-ident.at,
tests/destdir.at, tests/duplicate_conv.at,
tests/duplicate_deps.at, tests/duplicate_members.at,
tests/early-libtool.at, tests/export.at,
tests/f77demo-conf.test, tests/f77demo-exec.test,
tests/f77demo-make.test, tests/f77demo-shared.test,
tests/f77demo-static.test, tests/f77demo/Makefile.am,
tests/f77demo/configure.ac, tests/f77demo/cprogram.c,
tests/f77demo/foo.h, tests/f77demo/fooc.c,
tests/fail.at, tests/fcdemo-conf.test, tests/fcdemo-exec.test,
tests/fcdemo-make.test, tests/fcdemo-shared.test,
tests/fcdemo-static.test, tests/fcdemo/Makefile.am,
tests/fcdemo/configure.ac, tests/fcdemo/cprogram.c,
tests/fcdemo/foo.h, tests/fcdemo/fooc.c,
tests/inherited_flags.at, tests/libtoolize.at,
tests/link-2.test, tests/link-order.at, tests/link-order2.at,
tests/link.test, tests/lt_dlexit.at, tests/mdemo-conf.test,
tests/mdemo-dryrun.test, tests/mdemo-exec.test,
tests/mdemo-inst.test, tests/mdemo-make.test,
tests/mdemo-shared.test, tests/mdemo-static.test,
tests/mdemo-unst.test, tests/mdemo/Makefile.am,
tests/mdemo/configure.ac, tests/mdemo/foo.h, tests/mdemo/foo1.c,
tests/mdemo/foo2.c, tests/mdemo/main.c, tests/mdemo/mlib.c,
tests/mdemo/sub.c, tests/mdemo2-conf.test,
tests/mdemo2-exec.test, tests/mdemo2-make.test,
tests/mdemo2/Makefile.am, tests/mdemo2/configure.ac,
tests/mdemo2/main.c, tests/nomode.test, tests/nonrecursive.at,
tests/objectlist.test, tests/old-m4-iface.at,
tests/pdemo-conf.test, tests/pdemo-exec.test,
tests/pdemo-inst.test, tests/pdemo-make.test,
tests/pdemo/Makefile.am, tests/pdemo/configure.ac,
tests/pdemo/foo.h, tests/pdemo/longer_file_name_dlmain.c,
tests/pdemo/longer_file_name_foo.c,
tests/pdemo/longer_file_name_foo2.c,
tests/pdemo/longer_file_name_hell1.c,
tests/pdemo/longer_file_name_hell2.c,
tests/pdemo/longer_file_name_hello.c,
tests/pdemo/longer_file_name_main.c, tests/quote.test,
tests/recursive.at, tests/search-path.at, tests/sh.test,
tests/shlibpath.at, tests/standalone.at, tests/static.at,
tests/stresstest.at, tests/subproject.at, tests/suffix.test,
tests/tagdemo-conf.test, tests/tagdemo-exec.test,
tests/tagdemo-make.test, tests/tagdemo-shared.test,
tests/tagdemo-static.test, tests/tagdemo-undef.test,
tests/tagdemo/Makefile.am, tests/tagdemo/baz.cpp,
tests/tagdemo/baz.h, tests/tagdemo/configure.ac,
tests/tagdemo/conv.cpp, tests/tagdemo/conv.h,
tests/tagdemo/foo.cpp, tests/tagdemo/foo.h,
tests/tagdemo/main.cpp, tests/tagtrace.test,
tests/template.at, tests/testsuite.at: Apply correct license
text according to the new rules set out in HACKING.
2007-03-25 20:12:44 +08:00
|
|
|
|
2010-06-05 01:50:24 +08:00
|
|
|
# m4go_trimn(STRING)
|
|
|
|
# -------------------
|
|
|
|
# Trim all leading and trailing newlines from STRING.
|
|
|
|
#
|
|
|
|
# Inspite of careful quoting, this macro is NOT robust to active
|
|
|
|
# symbols:
|
|
|
|
# | m4_define(active, ACTV)
|
|
|
|
# | m4go_trimn([[
|
|
|
|
# | start active finish
|
|
|
|
# | ]])
|
|
|
|
# => start ACTV fini
|
|
|
|
# The interaction between index counting and macro expansion also
|
|
|
|
# results in overtrimming in this example by 2 characters (the
|
|
|
|
# difference between the lengths of `active' and `ACTV'). Translation
|
|
|
|
# into French is just a coincidence.
|
|
|
|
#
|
|
|
|
# The implementation is surprisingly finicky: We use m4go_slice() to
|
|
|
|
# extract the middle section of the string, while using m4_bregexp() to
|
|
|
|
# return offset counts for the first and last non-newlines in STRING.
|
|
|
|
# But there are a number of corner cases:
|
|
|
|
# 1. Double quoted STRING works, (i.e m4go_trimn([[\nthe string\n]]. We
|
|
|
|
# achieve that by transliterating quote characters as well as
|
|
|
|
# newlines to the same character before counting off the offsets.
|
|
|
|
# 2. This needs a slightly different transliteration for each
|
|
|
|
# m4_bregexp() invocation, because we need to maintain balanced
|
|
|
|
# quotes in the argument and we don't want to swallow leading ']' or
|
|
|
|
# trailing '[' characters. So, we turn the quote we don't want to
|
|
|
|
# strip into a harmless ' '.
|
|
|
|
# 3. Because we're now effectively stripping the quotation with the
|
|
|
|
# m4_translit() calls, embedded commas can fool m4_bregexp() into
|
|
|
|
# thinking there are more arguments than we intended, so we turn
|
|
|
|
# them into spaces too.
|
|
|
|
# 4. Unbalanced parentheses would also confuse m4_bregexp(), so we also
|
|
|
|
# turn them into spaces. The upshot of that if STRING contains a
|
|
|
|
# macro invocation with arguments, it will be expanded in the result
|
|
|
|
# as if no arguments had been passed.
|
|
|
|
# 5. Comments are not ignored after stripping quote marks, so we have
|
|
|
|
# to turn them off for the duration.
|
|
|
|
# 6. Finally, we need to requote the result to account for the quotes
|
|
|
|
# we probably stripped. m4_quote() doesn't handle commas well, so
|
2010-06-21 20:49:29 +08:00
|
|
|
# we use m4go_expand() to requote without losing whitespace after
|
|
|
|
# any embedded commas.
|
2010-06-05 01:50:24 +08:00
|
|
|
m4_define([m4go_trimn],
|
2010-06-21 20:49:29 +08:00
|
|
|
[m4_changecom()m4go_expand([m4go_slice([$1], m4_bregexp(m4_translit([$1],[
|
2010-06-05 01:50:24 +08:00
|
|
|
[/,()]], [// ]), [[^/]]), m4_bregexp(m4_translit([$1], [
|
|
|
|
[/,()]], [/ /]), [/*$]))])[]m4_changecom([#])])
|
2004-09-23 09:16:41 +08:00
|
|
|
|
2010-06-05 01:50:24 +08:00
|
|
|
# m4go_untab(STRING)
|
|
|
|
# ------------------
|
|
|
|
# Trim leading TABs from each line of STRING.
|
|
|
|
m4_define([m4go_untab],
|
|
|
|
[m4_bpatsubst([$1], [^[ ]*], [])])
|
2004-09-23 09:16:41 +08:00
|
|
|
|
2010-06-05 01:50:24 +08:00
|
|
|
# m4go_unindent(STRING)
|
|
|
|
# ---------------------
|
|
|
|
# Completely unindent STRING: Remove the leading TABs from each line of
|
|
|
|
# STRING; trim leading newlines and trailing whitespace from STRING as
|
|
|
|
# a whole.
|
|
|
|
m4_define([m4go_unindent],
|
|
|
|
[m4_ifval([$1], [m4go_untab([m4go_trimn([$1])])])])
|
|
|
|
|
|
|
|
|
|
|
|
## ------------------------------ ##
|
2010-06-21 20:49:29 +08:00
|
|
|
## 3. Option processing compiler. ##
|
2010-06-05 01:50:24 +08:00
|
|
|
## ------------------------------ ##
|
|
|
|
|
|
|
|
# Shell fragments are piecemeal added to these macros for each
|
|
|
|
# invocation of m4go_option; eventually to be expanded into the compiled
|
|
|
|
# option parsing shell script by M4SH_GETOPTS:
|
|
|
|
|
|
|
|
m4_define([m4go_defaults], []) # initial shell option variable setings
|
|
|
|
m4_define([m4go_branches], []) # case branches to process options
|
|
|
|
|
|
|
|
# The initial entries in m4go_shortnoargs represent the (non-argument)
|
|
|
|
# options that are always accepted by the expanded processing loop. We
|
|
|
|
# also keep a list of short options that accept an option argument in
|
|
|
|
# the macro `m4go_shortargs', but we use `m4_append([m4go_shortargs],
|
|
|
|
# OPTION, [|])' to insert the separator pipe symbols - which requires
|
|
|
|
# that `m4go_shortargs' be undefined if the first option appended is not
|
|
|
|
# prefixed by a leading `|'.
|
2010-06-27 18:21:59 +08:00
|
|
|
m4_define([m4go_shortnoargs], [-\?*|-h*])
|
2010-06-05 01:50:24 +08:00
|
|
|
|
|
|
|
|
|
|
|
# M4SH_GETOPTS(SHORT-SPEC1, LONG-MATCH1, DEF1, INIT1,
|
|
|
|
# SHORT-SPEC2, LONG-MATCH2, DEF2, INIT2, ... [VALIDATION])
|
|
|
|
# ---------------------------------------------------------------------
|
|
|
|
# Declare a series of command line options with one letter (`-m') or
|
|
|
|
# long form `--message' formats, along with optional default values
|
|
|
|
# incase a given option is not provided by the user when the script is
|
|
|
|
# invoked, and validation code, for example to prevent specifying
|
|
|
|
# mutually exclusive options or omitting required options.
|
|
|
|
#
|
|
|
|
# After this macro has been called, the value of each option is
|
|
|
|
# available in a shell variable named `opt_' followed by the first part
|
|
|
|
# (i.e. up to the first '|' symbol) of the LONG-MATCHn argument with the
|
|
|
|
# leading `--` removed, and any further `-' converted to `_', or else if
|
|
|
|
# no long form option was provided, simple `opt_' followed by the short
|
|
|
|
# option letter. For example, the value supplied by the user as an
|
|
|
|
# argument to an option `--gpg-key-id' will be available in the shell
|
|
|
|
# variable $opt_gpg_key_id, `-c' with no long form option will be
|
|
|
|
# available as $opt_c and so on. Where an option doesn't take an
|
|
|
|
# argument, then the shell variable will be set to either `:' or `false'
|
|
|
|
# depending on whether the user set that option on the script command
|
|
|
|
# line - with one important exception: If the long form option name
|
|
|
|
# begins with `--no-', and does not require an option argument, then the
|
|
|
|
# variable name will be `opt_' followed by the rest of the option name
|
|
|
|
# with the leading `no_' removed; and it's value will be `false' if
|
|
|
|
# `--no-foo' was given on the command line, and `:' otherwise.
|
|
|
|
#
|
|
|
|
# Each option is declared by a set of 4 arguments as follows:
|
|
|
|
#
|
|
|
|
# SHORT-SPECn
|
|
|
|
# The short option letter, if any, for the nth option followed by
|
|
|
|
# any flags to denote special processing for this option. For
|
|
|
|
# example, `f?@'. See below for a list of the supported flags and
|
|
|
|
# their meaning. If you specify `h', `v' or `x', then the
|
|
|
|
# automatic processing of those short options for `--help',
|
|
|
|
# `--version' and `--debug' (resp.) will be overridden.
|
|
|
|
# LONG-MATCHn
|
|
|
|
# The long option list, including leading dashes for the nth
|
|
|
|
# option. The value for this option is used directly as a shell
|
|
|
|
# `case' branch to match the option, so you can specify multiple
|
|
|
|
# matches. For example, `--message|--mes*|--msg'. If you specify
|
|
|
|
# neither this argument nor a short option letter with
|
|
|
|
# SHORT-SPECn, then invalid shell code will be generated.
|
|
|
|
# DEFn If there is a default value for the nth option to take when it
|
|
|
|
# is not given on the command line when the script is executed,
|
|
|
|
# specify it here. Double quotes are added in the expanded shell
|
|
|
|
# script, so it is safe to use shell variables. For example,
|
|
|
|
# `$HOME/.foorc'.
|
|
|
|
# INITn Any option specific initialisation for the nth option should be
|
|
|
|
# specified in this argument. The shell code it contains is added
|
|
|
|
# directly to the case branch that matches the nth option, after
|
|
|
|
# the `opt_NAME' variable has been set, with the option argument
|
|
|
|
# (if any) still left in `$1'. This allows neat tricks such as
|
|
|
|
# injecting new arguments into the command line before the
|
|
|
|
# processing loop terminates. For example:
|
|
|
|
#
|
|
|
|
# `eval set -- `cat $rcfile` ${1+"$@"}'
|
|
|
|
#
|
|
|
|
# Note that, because we look inside the content of INITn to
|
|
|
|
# determine whether there are newlines to be stripped, double
|
|
|
|
# quoting the whele thing doesn't work. Instead, you'll need to
|
|
|
|
# quote active symbols yourself. Generally, you'll only need to
|
|
|
|
# worry about $n and $@, although if you use symbols that can be
|
|
|
|
# expanded by m4 you'll need to quote those too.
|
|
|
|
# VALIDATION
|
|
|
|
# The final argument, if any, should contain shell code to
|
|
|
|
# validate correctness of the processed options. This code is
|
|
|
|
# expanded after the option processing loop has exited, and before
|
|
|
|
# the conditional script exit if errors have been found. Try to
|
|
|
|
# show as many errors as possible before exiting the shell rather
|
|
|
|
# than bailing out on the first error discovered so that the user
|
|
|
|
# can correct all of them at once rather than just one between
|
|
|
|
# each reinvocation of the script.
|
|
|
|
#
|
|
|
|
# In addition to an option short form letter (e.g. `m'), each
|
|
|
|
# SHORT-SPECn argument can also list one or more of the following flags
|
|
|
|
# to place additional constraints on that option (only one of `?', `+'
|
|
|
|
# and `@' can be given in any SHORT-SPECn):
|
|
|
|
#
|
|
|
|
# =STRING
|
|
|
|
# The option does not take an argument, but when specified on the
|
|
|
|
# command line the `opt_' variable is set to STRING.
|
|
|
|
# ? The option takes an optional argument. Unless the next command
|
|
|
|
# line argument begins with a `-' it will be the value stored in
|
|
|
|
# this option's `opt_' shell variable. Otherwise the `opt_'
|
|
|
|
# variable will contain the INITn value.
|
|
|
|
# ! The option requires an argument. The next command line argument
|
|
|
|
# will be stored in this option's `opt_' shell variable, or else
|
|
|
|
# the INITn value, if any, will be stored if this option is not
|
|
|
|
# given on the command line.
|
|
|
|
# ; The same as `!', except that when the argument is given multiple
|
|
|
|
# times on the command line, each argument is appended to the
|
|
|
|
# `opt_' shell variable, along with a new-line to separate it from
|
|
|
|
# the previous argument.
|
|
|
|
# + The same as `!', except that each time the argument is supplied
|
|
|
|
# on the command line, it's value is stored in an `opt_' variable
|
|
|
|
# with `_n' appended to the variable name - where `n' is `1' for
|
|
|
|
# the first argument, `2, for the second and so on.
|
|
|
|
# @ The option argument must point to an existing file. The
|
|
|
|
# processing loop will automatically contain an additional check
|
|
|
|
# to ensure that the named file exists. `@' can be added to a
|
|
|
|
# SHORT-SPECn argument in addition to any other flags.
|
|
|
|
# ^ The value stored in the `opt_' variable is quoted by passing it
|
|
|
|
# through the shell function `func_quote_for_eval'.
|
|
|
|
#
|
|
|
|
# The M4SH_GETOPTS macro is implemented by first delegating to
|
|
|
|
# `_M4SH_GETOPTS', a shift4-loop that repeatedly calls `m4go_options',
|
|
|
|
# shifts away the 4 processed arguments, checks the number of remaining
|
|
|
|
# args and loops again until only 1 argument (VALIDATION) or 0 arguments
|
|
|
|
# (no VALIDATION code) remain. When all the processing is complete, we
|
|
|
|
# expand 'm4go_printopts' to write out the complete command line
|
|
|
|
# processing shell loop.
|
|
|
|
#
|
|
|
|
# Generally, you can combine the SHORT-SPECn flags in sensible ways,
|
|
|
|
# but no error checking is done. If you choose a combination that makes
|
|
|
|
# no sense, you'll probably end up with broken shell code.
|
|
|
|
m4_define([M4SH_GETOPTS],
|
|
|
|
[_$0($@)[]m4go_printopts])
|
|
|
|
m4_define([_M4SH_GETOPTS],
|
|
|
|
[m4_if([$#], 0, [],
|
|
|
|
[$#], 1, [m4_define([m4go_validation],[$1])],
|
|
|
|
[$#], 2, [m4_fatal([$0: too few arguments: $#: $2])],
|
|
|
|
[$#], 3, [m4_fatal([$0: too few arguments: $#: $3])],
|
|
|
|
[m4go_option($@)[]$0(m4_shiftn(4, $@))])])
|
|
|
|
|
|
|
|
|
|
|
|
# m4go_option(SHORT-SPEC, LONG-MATCH, DEFAULT, INIT)
|
|
|
|
# --------------------------------------------------
|
|
|
|
# This macro is a wrapper for `_m4go_option', which first extracts the
|
|
|
|
# short option letter (if any) from SHORT-SPEC, and then calculates the
|
|
|
|
# full `opt_' shell variable name for this option before delegating
|
|
|
|
# those results along with all of its own arguments to `_m4go_option'.
|
|
|
|
#
|
|
|
|
# Note that when the LONG-MATCH begins with `--no-', we add `~' to the
|
|
|
|
# list of SHORT-SPEC flags before calling `_m4go_option' to denote that
|
|
|
|
# the name of the `opt_' variable is reversed in the sense of the option
|
|
|
|
# name itself.That is, we want to start with the option being true, and
|
|
|
|
# set it to false if `--no-foo' is given on the command line.
|
|
|
|
#
|
|
|
|
# `m4_do' is used here to separate out the pushdef and popdef of the
|
|
|
|
# temporary `_short' macro used to held the extracted short option
|
|
|
|
# letter, if any.
|
|
|
|
m4_define([m4go_option],
|
|
|
|
[m4_do(
|
|
|
|
[m4_pushdef([_short],
|
|
|
|
m4_bmatch([$1],
|
|
|
|
[[?!;+@^]], m4_bpatsubst([$1], [[?!;+@^]*], []),
|
|
|
|
[^=], [],
|
|
|
|
[.], [[$1]],
|
|
|
|
[]))],
|
2010-06-21 20:49:29 +08:00
|
|
|
[_$0(opt_[]m4_ifval([$2],
|
2010-06-05 01:50:24 +08:00
|
|
|
m4_translit(m4_bpatsubst([$2], [^--\(no-\)?\([^|]+\).*$],
|
|
|
|
[\2]), -, _),
|
|
|
|
_short),
|
|
|
|
_short,
|
|
|
|
[$1]m4_bmatch([$2], [^--no-], [~]),
|
|
|
|
[$2],
|
|
|
|
[$3],
|
|
|
|
[$4])],
|
|
|
|
[m4_popdef([_short])])])
|
|
|
|
|
|
|
|
|
|
|
|
# _m4go_option(OPTION-NAME, SHORT-OPTION, SHORT-SPEC, LONG-MATCH,
|
|
|
|
# DEFAULT, INIT)
|
|
|
|
#----------------------------------------------------------------
|
|
|
|
# For this option, append the appropriate shell code fragments to:
|
|
|
|
# `m4go_defaults'
|
|
|
|
# A shell script fragment containing `opt_' variable
|
|
|
|
# initialisation according to DEFAULT, if necessary;
|
|
|
|
# `m4go_branches'
|
|
|
|
# The case branch to match any SHORT-OPTION or LONG-MATCH command
|
|
|
|
# line option, along with any automatic processing implied by
|
|
|
|
# SHORT-SPEC flags, and additional code from INIT;
|
|
|
|
# `m4go_shortargs'
|
|
|
|
# This match string accumulates all of the short options that
|
|
|
|
# accept option arguments, so that we can generate some additional
|
|
|
|
# code to split apart compacted option strings (`-xfoo' will be
|
|
|
|
# treated as if `-x foo' had been passed) in `m4go_printopts'.
|
|
|
|
# `m4go_shortnoargs'
|
|
|
|
# Similarly, accumulate short options that do not take option
|
|
|
|
# arguments, so that we can generate the code to split apart
|
|
|
|
# compacted options strings in `m4go_printopts' (`-xfoo' will be
|
|
|
|
# treated as if `-x -f -o -o' had been passed).
|
|
|
|
#
|
|
|
|
# The core of this macro switches the `m4go_branches' processing to an
|
|
|
|
# appropriate macro depending on what flags are present in SHORT-SPEC.
|
|
|
|
|
|
|
|
m4_define([_m4go_option],
|
|
|
|
[m4_do(
|
|
|
|
[m4_append([m4go_defaults],
|
|
|
|
m4_bmatch([$3],
|
2010-06-21 20:49:29 +08:00
|
|
|
[[?!;+@^]], [m4_ifval([$5], [m4_n([$1="$5"])])],
|
2010-06-05 01:50:24 +08:00
|
|
|
[~], [m4_n([$1=:])],
|
|
|
|
[m4_n([$1=false])]))],
|
|
|
|
[m4_append([m4go_branches], [[]dnl (
|
2010-06-21 20:49:29 +08:00
|
|
|
m4_join([|], [$4], m4_ifval([$2], [-$2])))
|
2010-06-05 01:50:24 +08:00
|
|
|
])],
|
|
|
|
[m4_append([m4go_branches],
|
|
|
|
[m4_bmatch([$3], [[!+@]],
|
|
|
|
[ test [$]# = 0 && func_missing_arg $opt && break
|
|
|
|
])m4_n(m4_bmatch([$3],
|
|
|
|
[\^], [ func_quote_for_eval "[$]1"
|
|
|
|
optarg="$func_quote_for_eval_result"],
|
|
|
|
[[?!;+@]], [ optarg="[$]1"]))[]dnl
|
|
|
|
m4_n(m4_bmatch([$3],
|
|
|
|
[+], [ $1_num=`expr 1 + ${$1_num-0}`
|
|
|
|
eval $1_${$1_num}=\"$optarg\"],
|
|
|
|
[?], [m4_bmatch([$3],
|
2010-06-21 20:49:29 +08:00
|
|
|
[@], [m4go_expand([m4go_optional_file_arg([$1])])],
|
|
|
|
[m4go_expand([m4go_optional_arg([$1])])])],
|
2010-06-05 01:50:24 +08:00
|
|
|
[[!@]], [ $1="$optarg"],
|
|
|
|
[;], [ $1="${$1+[$]$1
|
|
|
|
}$optarg"],
|
|
|
|
[~], [ $1=false],
|
|
|
|
[=.], [ $1="m4_bpatsubst([$3], [^.*=], [])"],
|
|
|
|
[ $1=:]))[]dnl
|
|
|
|
dnl only write the file_arg fragment when we didn't already write opt_file_arg:
|
|
|
|
m4_bmatch([$3], [@], [m4_bmatch([$3], [?], [],
|
2010-06-21 20:49:29 +08:00
|
|
|
[m4go_expand([m4go_file_arg([$1])])
|
2010-06-05 01:50:24 +08:00
|
|
|
])])m4_n(m4go_unindent([$6]))[]dnl
|
2010-06-05 05:19:11 +08:00
|
|
|
m4_bmatch([$3], [[!+;]], [ shift
|
2010-06-05 01:50:24 +08:00
|
|
|
]) ;;
|
|
|
|
])],
|
2010-06-21 20:49:29 +08:00
|
|
|
[m4_ifval([$2],
|
2010-06-05 01:50:24 +08:00
|
|
|
[m4_bmatch([$3],
|
|
|
|
[[?!;+@^~]], [m4_append([m4go_shortargs], [-$2*], [|])],
|
|
|
|
[m4_append([m4go_shortnoargs], [-$2*],
|
|
|
|
[|])])])])])
|
|
|
|
|
|
|
|
|
|
|
|
# m4go_optional_arg(OPTION-NAME)
|
|
|
|
# ------------------------------
|
|
|
|
# Expand to the case branch core code for processing a flag that takes
|
|
|
|
# an optional argument, and sets the `opt_' variable named by
|
|
|
|
# OPTION-NAME appropriately.
|
|
|
|
m4_define([m4go_optional_arg],
|
|
|
|
[ if test [$]# -gt 0; then
|
|
|
|
case $optarg in # ((
|
|
|
|
-*) ;;
|
|
|
|
*) $1="$optarg"; shift ;;
|
|
|
|
esac
|
|
|
|
fi])
|
|
|
|
|
|
|
|
# m4go_file_arg(OPTION-NAME)
|
|
|
|
# --------------------------
|
|
|
|
# As above, but for flags that require the name of an existing file as
|
|
|
|
# an argument.
|
|
|
|
m4_define([m4go_file_arg],
|
|
|
|
[ test -r "$optarg" || {
|
|
|
|
func_error "$opt: cannot read file \`$optarg'."
|
|
|
|
exit_cmd=exit
|
|
|
|
}])
|
|
|
|
|
|
|
|
# m4go_optional_file_arg(OPTION-NAME)
|
|
|
|
# -----------------------------------
|
|
|
|
# As above, but for options that optionally takes the name of an
|
|
|
|
# existing file as its argument.
|
|
|
|
m4_define([m4go_optional_file_arg],
|
|
|
|
[ if test [$]# -gt 0; then
|
|
|
|
case $optarg in # ((
|
|
|
|
-*) ;;
|
|
|
|
*) $1="$optarg"
|
|
|
|
test -r "$optarg" || {
|
|
|
|
func_error "$opt: cannot read file \`$optarg'."
|
|
|
|
exit_cmd=exit
|
|
|
|
}
|
|
|
|
shift ;;
|
|
|
|
esac
|
|
|
|
fi])
|
|
|
|
|
|
|
|
|
|
|
|
# m4go_printopts
|
|
|
|
# --------------
|
|
|
|
# This macro expands to the complete command line option processing
|
|
|
|
# loop, providing for user declared options from `M4SH_GETOPTS' as well
|
|
|
|
# as support for `-x|--debug', `-\?|-h|--help' and `--version'. The
|
|
|
|
# latter two extract their output from a stylized comment at the start
|
|
|
|
# of the script, and will not work correctly if the format is not
|
|
|
|
# followed precisely.
|
|
|
|
m4_define([m4go_printopts],
|
|
|
|
[
|
|
|
|
# Option defaults:
|
2010-06-10 22:02:48 +08:00
|
|
|
opt_debug=:
|
2010-06-05 01:50:24 +08:00
|
|
|
m4go_defaults
|
|
|
|
|
|
|
|
# Parse options once, thoroughly. This comes as soon as possible in the
|
|
|
|
# script to make things like `--version' happen as quickly as we can.
|
2010-06-12 01:12:09 +08:00
|
|
|
{
|
2010-06-05 01:50:24 +08:00
|
|
|
# this just eases exit handling
|
|
|
|
while test [$]# -gt 0; do
|
|
|
|
opt="[$]1"
|
|
|
|
shift
|
|
|
|
case $opt in
|
2010-06-10 22:02:48 +08:00
|
|
|
--debug|-x) opt_debug='set -x'
|
2010-06-05 01:50:24 +08:00
|
|
|
func_echo "enabling shell trace mode"
|
2010-06-10 22:02:48 +08:00
|
|
|
$opt_debug
|
2010-06-05 01:50:24 +08:00
|
|
|
;;
|
|
|
|
m4go_branches
|
|
|
|
-\?|-h) func_usage ;;
|
|
|
|
--help) func_help ;;
|
|
|
|
--version) func_version ;;
|
|
|
|
|
|
|
|
# Separate optargs to long options:
|
|
|
|
--*=*)
|
2010-06-12 01:12:09 +08:00
|
|
|
func_split_long_opt "$opt"
|
|
|
|
set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"[$]@"}
|
2010-06-05 01:50:24 +08:00
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
m4_ifset([m4go_shortargs], dnl (
|
|
|
|
[ # Separate optargs to short options:
|
|
|
|
]m4go_shortargs[)
|
2010-06-12 01:12:09 +08:00
|
|
|
func_split_short_opt "$opt"
|
|
|
|
set dummy "$func_split_short_opt_name" "$func_split_short_opt_arg" ${1+"[$]@"}
|
2010-06-05 01:50:24 +08:00
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
])m4_ifset([m4go_shortnoargs], dnl (
|
|
|
|
[ # Separate non-argument short options:
|
|
|
|
]m4go_shortnoargs[)
|
2010-06-12 01:12:09 +08:00
|
|
|
func_split_short_opt "$opt"
|
2010-06-27 18:21:59 +08:00
|
|
|
set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"[$]@"}
|
2010-06-05 01:50:24 +08:00
|
|
|
shift
|
|
|
|
;;
|
|
|
|
|
|
|
|
]) --) break ;;
|
|
|
|
-*) func_fatal_help "unrecognized option \`$opt'" ;;
|
|
|
|
*) set dummy "$opt" ${1+"[$]@"}; shift; break ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
m4_ifset([m4go_validation],
|
|
|
|
[
|
|
|
|
# Validate options:
|
|
|
|
m4go_validation
|
|
|
|
])
|
|
|
|
# Bail if the options were screwed
|
|
|
|
$exit_cmd $EXIT_FAILURE
|
|
|
|
}
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
## ------------------------- ##
|
2010-06-21 20:49:29 +08:00
|
|
|
## 4. Supporting Shell Code. ##
|
2010-06-05 01:50:24 +08:00
|
|
|
## ------------------------- ##
|
|
|
|
|
|
|
|
# The shell functions below are expanded verbatim into the shell script
|
|
|
|
# at `m4_include([getopt.m4sh]', which are necessary for the correct
|
|
|
|
# operation of the automatic `--version' and `--help' options, among
|
|
|
|
# others.
|
|
|
|
|
2010-06-08 12:44:26 +08:00
|
|
|
m4_divert_pop([KILL])M4SH_VERBATIM([[
|
2004-09-23 09:16:41 +08:00
|
|
|
# func_version
|
|
|
|
# Echo version message to standard output and exit.
|
|
|
|
func_version ()
|
|
|
|
{
|
2010-06-10 22:02:48 +08:00
|
|
|
$opt_debug
|
|
|
|
|
2009-01-30 01:53:13 +08:00
|
|
|
$SED -n '/(C)/!b go
|
|
|
|
:more
|
2009-02-01 22:24:00 +08:00
|
|
|
/\./!{
|
2009-01-30 01:53:13 +08:00
|
|
|
N
|
2010-06-09 17:53:56 +08:00
|
|
|
s/\n# / /
|
2009-01-30 01:53:13 +08:00
|
|
|
b more
|
|
|
|
}
|
|
|
|
:go
|
|
|
|
/^# '$PROGRAM' (GNU /,/# warranty; / {
|
2006-01-22 00:44:41 +08:00
|
|
|
s/^# //
|
|
|
|
s/^# *$//
|
2007-03-06 08:46:56 +08:00
|
|
|
s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
|
2006-01-22 00:44:41 +08:00
|
|
|
p
|
2004-12-30 20:03:39 +08:00
|
|
|
}' < "$progpath"
|
2005-02-03 06:15:02 +08:00
|
|
|
exit $?
|
2004-09-23 09:16:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
# func_usage
|
|
|
|
# Echo short help message to standard output and exit.
|
|
|
|
func_usage ()
|
|
|
|
{
|
2010-06-10 22:02:48 +08:00
|
|
|
$opt_debug
|
|
|
|
|
2010-06-05 01:50:24 +08:00
|
|
|
$SED -n '/^# Usage:/,/^# *.*--help/ {
|
2006-01-22 00:44:41 +08:00
|
|
|
s/^# //
|
|
|
|
s/^# *$//
|
|
|
|
s/\$progname/'$progname'/
|
|
|
|
p
|
2004-12-30 20:03:39 +08:00
|
|
|
}' < "$progpath"
|
2008-11-23 21:38:24 +08:00
|
|
|
echo
|
2004-09-23 09:16:41 +08:00
|
|
|
$ECHO "run \`$progname --help | more' for full usage"
|
2005-02-03 06:15:02 +08:00
|
|
|
exit $?
|
2004-09-23 09:16:41 +08:00
|
|
|
}
|
|
|
|
|
Man pages for libtoolize and libtool, --help-all.
* Makefile.am (dist_man1_MANS, update_mans): New macros.
($(srcdir)/doc/libtool.1, $(srcdir)/doc/libtoolize.1): New
rules. Use --help-all for libtool.
(MAINTAINERCLEANFILES): New macro. Add dist_man1_MANS.
(BUILT_SOURCES): Add libtoolize.
* configure.ac: Check for help2man, set HELP2MAN.
* doc/libtool.texi: Add @direntry for libtool-invocation.
(Invoking libtool): Document -h, --help-all. Reorder mode
description for consistency.
(Compile mode): Do not document -Wl,FLAG and -XCClinker here.
(Link mode): Document -Wc,FLAG here, reformat a bit.
* libtoolize.m4sh: Reformat --help output a bit, to help
help2man.
* libltdl/config/ltmain.m4sh: Likewise. Also, set PROGRAM to
`libtool', not `ltmain.sh', so the former is used in the man
page.
New argument `--help-all'. If given, call func_help and
func_mode_help several times, beating output in shape with sed.
(func_mode_help): Do not exit here.
* libltdl/config/getopt.m4sh (func_usage): Work with different
indentations, but require comment hash in first column, when
grepping for '-h' in usage to end short help.
(func_help): Accept optional argument to not exit.
* NEWS, THANKS: Update.
Suggestion by Karl Berry.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2008-09-20 14:50:50 +08:00
|
|
|
# func_help [NOEXIT]
|
|
|
|
# Echo long help message to standard output and exit,
|
|
|
|
# unless 'noexit' is passed as argument.
|
2004-09-23 09:16:41 +08:00
|
|
|
func_help ()
|
|
|
|
{
|
2010-06-10 22:02:48 +08:00
|
|
|
$opt_debug
|
|
|
|
|
2004-12-30 20:03:39 +08:00
|
|
|
$SED -n '/^# Usage:/,/# Report bugs to/ {
|
2010-06-13 18:28:58 +08:00
|
|
|
:print
|
2006-01-22 00:44:41 +08:00
|
|
|
s/^# //
|
|
|
|
s/^# *$//
|
|
|
|
s*\$progname*'$progname'*
|
2006-02-15 17:33:47 +08:00
|
|
|
s*\$host*'"$host"'*
|
2006-01-22 00:44:41 +08:00
|
|
|
s*\$SHELL*'"$SHELL"'*
|
|
|
|
s*\$LTCC*'"$LTCC"'*
|
|
|
|
s*\$LTCFLAGS*'"$LTCFLAGS"'*
|
|
|
|
s*\$LD*'"$LD"'*
|
|
|
|
s/\$with_gnu_ld/'"$with_gnu_ld"'/
|
|
|
|
s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
|
|
|
|
s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
|
|
|
|
p
|
2010-06-13 18:28:58 +08:00
|
|
|
d
|
|
|
|
}
|
|
|
|
/^# .* home page:/b print
|
|
|
|
/^# General help using/b print
|
|
|
|
' < "$progpath"
|
Man pages for libtoolize and libtool, --help-all.
* Makefile.am (dist_man1_MANS, update_mans): New macros.
($(srcdir)/doc/libtool.1, $(srcdir)/doc/libtoolize.1): New
rules. Use --help-all for libtool.
(MAINTAINERCLEANFILES): New macro. Add dist_man1_MANS.
(BUILT_SOURCES): Add libtoolize.
* configure.ac: Check for help2man, set HELP2MAN.
* doc/libtool.texi: Add @direntry for libtool-invocation.
(Invoking libtool): Document -h, --help-all. Reorder mode
description for consistency.
(Compile mode): Do not document -Wl,FLAG and -XCClinker here.
(Link mode): Document -Wc,FLAG here, reformat a bit.
* libtoolize.m4sh: Reformat --help output a bit, to help
help2man.
* libltdl/config/ltmain.m4sh: Likewise. Also, set PROGRAM to
`libtool', not `ltmain.sh', so the former is used in the man
page.
New argument `--help-all'. If given, call func_help and
func_mode_help several times, beating output in shape with sed.
(func_mode_help): Do not exit here.
* libltdl/config/getopt.m4sh (func_usage): Work with different
indentations, but require comment hash in first column, when
grepping for '-h' in usage to end short help.
(func_help): Accept optional argument to not exit.
* NEWS, THANKS: Update.
Suggestion by Karl Berry.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2008-09-20 14:50:50 +08:00
|
|
|
ret=$?
|
|
|
|
if test -z "$1"; then
|
|
|
|
exit $ret
|
|
|
|
fi
|
2004-09-23 09:16:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
# func_missing_arg argname
|
|
|
|
# Echo program name prefixed message to standard error and set global
|
|
|
|
# exit_cmd.
|
|
|
|
func_missing_arg ()
|
|
|
|
{
|
2010-06-10 22:02:48 +08:00
|
|
|
$opt_debug
|
|
|
|
|
2010-06-05 01:50:24 +08:00
|
|
|
func_error "missing argument for $1."
|
2004-09-23 09:16:41 +08:00
|
|
|
exit_cmd=exit
|
|
|
|
}
|
|
|
|
|
2010-06-12 01:12:09 +08:00
|
|
|
|
|
|
|
# func_split_short_opt shortopt
|
|
|
|
# Set func_split_short_opt_name and func_split_short_opt_arg shell
|
2010-06-29 17:32:46 +08:00
|
|
|
# variables after splitting SHORTOPT after the 2nd character.
|
2010-06-12 01:12:09 +08:00
|
|
|
func_split_short_opt ()
|
|
|
|
{
|
|
|
|
my_sed_short_opt='1s/^\(..\).*$/\1/;q'
|
|
|
|
my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
|
|
|
|
|
|
|
|
func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
|
2010-06-27 18:21:59 +08:00
|
|
|
func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
|
2010-07-08 19:47:59 +08:00
|
|
|
} # func_split_short_opt may be replaced by extended shell implementation
|
2010-06-12 01:12:09 +08:00
|
|
|
|
|
|
|
|
|
|
|
# func_split_long_opt longopt
|
|
|
|
# Set func_split_long_opt_name and func_split_long_opt_arg shell
|
|
|
|
# variables after splitting LONGOPT at the `=' sign.
|
|
|
|
func_split_long_opt ()
|
|
|
|
{
|
|
|
|
my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
|
|
|
|
my_sed_long_arg='1s/^--[^=]*=//'
|
|
|
|
|
|
|
|
func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
|
|
|
|
func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
|
2010-07-08 19:47:59 +08:00
|
|
|
} # func_split_long_opt may be replaced by extended shell implementation
|
2010-06-12 01:12:09 +08:00
|
|
|
|
2004-09-23 09:16:41 +08:00
|
|
|
exit_cmd=:
|
2007-03-06 08:46:56 +08:00
|
|
|
]])
|
|
|
|
|