libtool/config/getopt.m4sh
Ralf Wildenhues e49e871547 * config/getopt.m4sh (func_version, func_usage, func_help):
Use `$SED -n' instead of `$SED RANGE {..}; d' as AIX sed cannot
handle the latter.
(func_help): start autoconf and automake in subshells to avoid
error messages from ash or Bourne shell if not available.
2004-12-30 12:03:39 +00:00

85 lines
2.6 KiB
Plaintext

m4_if([# getopt.m4sh -- getopt helper functions -*- Autoconf -*-
# Written by Gary V. Vaughan <gary@gnu.org>, 2004
# Copyright (C) 2004 Free Software Foundation, Inc.
# This is free software; see the source for copying conditions. There is NO
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# This program 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 the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS 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 this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
])dnl
m4_include([general.m4sh])
# func_version
# Echo version message to standard output and exit.
func_version ()
{
$SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
s/^# //; s/^# *$//;
s/\((C)\)[[ 0-9,-]]*\( [[1-9]][[0-9]]*\)/\1\2/;
p;
}' < "$progpath"
exit $EXIT_SUCCESS
}
# func_usage
# Echo short help message to standard output and exit.
func_usage ()
{
$SED -n '/^# Usage:/,/# -h/ {
s/^# //; s/^# *$//;
s/\$progname/'$progname'/;
p;
}' < "$progpath"
$ECHO
$ECHO "run \`$progname --help | more' for full usage"
exit $EXIT_SUCCESS
}
# func_help
# Echo long help message to standard output and exit.
func_help ()
{
$SED -n '/^# Usage:/,/# Report bugs to/ {
s/^# //; s/^# *$//;
s*\$progname*'$progname'*;
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;
}' < "$progpath"
exit $EXIT_SUCCESS
}
# func_missing_arg argname
# Echo program name prefixed message to standard error and set global
# exit_cmd.
func_missing_arg ()
{
func_error "missing argument for $1"
exit_cmd=exit
}
exit_cmd=: