I wrote: > config.libpath --help -> Bruno > config.rpath --help -> Bruno > declared.sh --help -> Bruno > install-reloc --help -> Bruno > libtool-next-version --help -> Bruno > libtool-reloc --help -> Bruno > reloc-ldflags --help -> Bruno > run-test --help -> Bruno
Done through the following set of patches. 2024-06-14 Bruno Haible <br...@clisp.org> relocatable-prog: Implement --help and --version for all programs. * build-aux/config.libpath (func_usage, func_version, func_fatal_error): New functions. Add command-line option processing. * build-aux/libtool-reloc (func_usage, func_version, func_fatal_error): New functions. Add command-line option processing. * build-aux/reloc-ldflags (func_usage, func_version, func_fatal_error): New functions. Add command-line option processing. 2024-06-14 Bruno Haible <br...@clisp.org> relocatable-prog-wrapper: Implement --help, --version for all programs. * build-aux/install-reloc (func_usage, func_version, func_fatal_error): New functions. (progname): Remove variable. Add command-line option processing. 2024-06-14 Bruno Haible <br...@clisp.org> havelib: Implement --help and --version for all programs. * build-aux/config.rpath (func_usage, func_version, func_fatal_error): New functions. Add command-line option processing. 2024-06-14 Bruno Haible <br...@clisp.org> Improve bug reporting address for some programs. * build-aux/declared.sh (func_usage): Change bug reporting address to bug-gnulib. (func_version): Bump year. * build-aux/libtool-next-version (func_usage): Change bug reporting address to bug-gnulib. * build-aux/run-test (func_usage): Change bug reporting address to bug-gnulib. (func_version): Bump year.
>From 2f5973bdc76ea3a5989af3ffb2eb1de520ac2169 Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Fri, 14 Jun 2024 02:35:40 +0200 Subject: [PATCH 1/4] Improve bug reporting address for some programs. * build-aux/declared.sh (func_usage): Change bug reporting address to bug-gnulib. (func_version): Bump year. Improve "Written by" line. * build-aux/libtool-next-version (func_usage): Change bug reporting address to bug-gnulib. * build-aux/run-test (func_usage): Change bug reporting address to bug-gnulib. (func_version): Bump year. Improve "Written by" line. --- ChangeLog | 12 ++++++++++++ build-aux/declared.sh | 7 ++++--- build-aux/libtool-next-version | 4 ++-- build-aux/run-test | 10 +++++----- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index a46eb4f1e5..5a7cd4b13b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2024-06-14 Bruno Haible <br...@clisp.org> + + Improve bug reporting address for some programs. + * build-aux/declared.sh (func_usage): Change bug reporting address to + bug-gnulib. + (func_version): Bump year. + * build-aux/libtool-next-version (func_usage): Change bug reporting + address to bug-gnulib. + * build-aux/run-test (func_usage): Change bug reporting address to + bug-gnulib. + (func_version): Bump year. + 2024-06-13 Bruno Haible <br...@clisp.org> Assume wchar_t. diff --git a/build-aux/declared.sh b/build-aux/declared.sh index 3886197bc3..4efdcec8bb 100755 --- a/build-aux/declared.sh +++ b/build-aux/declared.sh @@ -39,7 +39,7 @@ Options: --help print this help and exit --version print version information and exit -Report bugs to <br...@clisp.org>." +Send patches and bug reports to <bug-gnulib@gnu.org>." } # func_version @@ -47,11 +47,12 @@ Report bugs to <br...@clisp.org>." func_version () { echo "declared.sh (GNU gnulib)" - echo "Copyright (C) 2022 Free Software Foundation, Inc. + echo "Copyright (C) 2024 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law." - echo "Written by" "Bruno Haible" + echo + printf 'Written by %s.\n' "Bruno Haible" } # func_fatal_error message diff --git a/build-aux/libtool-next-version b/build-aux/libtool-next-version index 74602b22f0..ce87bc8b4a 100755 --- a/build-aux/libtool-next-version +++ b/build-aux/libtool-next-version @@ -42,7 +42,7 @@ # - It does not enforce that applying the third or fourth rule is only # possible after applying the second rule. -scriptversion=2022-01-27 +scriptversion=2024-06-13 # func_usage # outputs to stdout the --help usage message. @@ -63,7 +63,7 @@ Options: --help print this help and exit --version print version information and exit -Report bugs to <br...@clisp.org>." +Send patches and bug reports to <bug-gnulib@gnu.org>." } # func_version diff --git a/build-aux/run-test b/build-aux/run-test index 56d4a3a4df..94ef7fd912 100755 --- a/build-aux/run-test +++ b/build-aux/run-test @@ -39,7 +39,7 @@ configured with wrapper scripts, and CFLAGS=\"-g\" so that valgrind shows line numbers. -Report bugs to Bruno Haible." +Send patches and bug reports to <bug-gnulib@gnu.org>." } # func_version @@ -48,12 +48,12 @@ func_version () { echo "\ run-test (GNU gnulib) -Copyright (C) 2019 Free Software Foundation, Inc. +Copyright (C) 2024 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. - -Written by" "Bruno Haible" +There is NO WARRANTY, to the extent permitted by law." + echo + printf 'Written by %s.\n' "Bruno Haible" } # func_fatal_error message -- 2.34.1
>From 41f802cbcf41999eded06b21990dfd837075654c Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Fri, 14 Jun 2024 12:35:03 +0200 Subject: [PATCH 2/4] havelib: Implement --help and --version for all programs. * build-aux/config.rpath (func_usage, func_version, func_fatal_error): New functions. Add command-line option processing. --- ChangeLog | 7 ++++ build-aux/config.rpath | 87 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 84 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5a7cd4b13b..cfab56ad0c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2024-06-14 Bruno Haible <br...@clisp.org> + + havelib: Implement --help and --version for all programs. + * build-aux/config.rpath (func_usage, func_version, func_fatal_error): + New functions. + Add command-line option processing. + 2024-06-14 Bruno Haible <br...@clisp.org> Improve bug reporting address for some programs. diff --git a/build-aux/config.rpath b/build-aux/config.rpath index 3893ddd861..58870bd70d 100755 --- a/build-aux/config.rpath +++ b/build-aux/config.rpath @@ -1,6 +1,7 @@ #! /bin/sh # Output a system dependent set of variables, describing how to set the -# run time search path of shared libraries in an executable. +# run time search path of shared libraries in a binary (executable or +# shared library). # # Copyright 1996-2024 Free Software Foundation, Inc. # Taken from GNU libtool, 2001 @@ -9,15 +10,6 @@ # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# -# The first argument passed to this file is the canonical host specification, -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld -# should be set by the caller. -# -# The set of defined variables is at the end of this script. # Known limitations: # - On IRIX 6.5 with CC="cc", the run time search patch must not be longer @@ -25,6 +17,81 @@ # known workaround is to choose shorter directory names for the build # directory and/or the installation directory. +# func_usage +# outputs to stdout the --help usage message. +func_usage () +{ + echo "\ +Usage: config.rpath [OPTION] HOST + +Prints shell variable assignments that describe how to hardcode a directory +for the lookup of shared libraries into a binary (executable or shared library). + +The first argument passed to this file is the canonical host specification, + CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +or + CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM + +The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld +should be set by the caller. + +The set of defined variables is at the end of this script. + +Options: + --help print this help and exit + --version print version information and exit + +Send patches and bug reports to <bug-gnulib@gnu.org>." +} + +# func_version +# outputs to stdout the --version message. +func_version () +{ + echo "config.rpath (GNU gnulib, module havelib)" + echo "Copyright (C) 2024 Free Software Foundation, Inc. +License: All-Permissive. +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law." + echo + printf 'Written by %s.\n' "Bruno Haible" +} + +# func_fatal_error message +# outputs to stderr a fatal error message, and terminates the program. +func_fatal_error () +{ + echo "config.rpath: *** $1" 1>&2 + echo "config.rpath: *** Stop." 1>&2 + exit 1 +} + +# Command-line option processing. +while test $# -gt 0; do + case "$1" in + --help | --hel | --he | --h ) + func_usage + exit 0 ;; + --version | --versio | --versi | --vers | --ver | --ve | --v ) + func_version + exit 0 ;; + -- ) # Stop option processing + shift; break ;; + -* ) + func_fatal_error "unrecognized option: $1" + ;; + * ) + break ;; + esac +done + +if test $# -gt 1; then + func_fatal_error "too many arguments" +fi +if test $# -lt 1; then + func_fatal_error "too few arguments" +fi + # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a -- 2.34.1
>From aefdbfc43df11a8fc0fbd54161e5065a6ed3d26b Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Fri, 14 Jun 2024 12:50:45 +0200 Subject: [PATCH 3/4] relocatable-prog-wrapper: Implement --help, --version for all programs. * build-aux/install-reloc (func_usage, func_version, func_fatal_error): New functions. (progname): Remove variable. Add command-line option processing. --- ChangeLog | 8 +++ build-aux/install-reloc | 141 +++++++++++++++++++++++++++------------- 2 files changed, 104 insertions(+), 45 deletions(-) diff --git a/ChangeLog b/ChangeLog index cfab56ad0c..bd6d21d2c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2024-06-14 Bruno Haible <br...@clisp.org> + + relocatable-prog-wrapper: Implement --help, --version for all programs. + * build-aux/install-reloc (func_usage, func_version, func_fatal_error): + New functions. + (progname): Remove variable. + Add command-line option processing. + 2024-06-14 Bruno Haible <br...@clisp.org> havelib: Implement --help and --version for all programs. diff --git a/build-aux/install-reloc b/build-aux/install-reloc index 6a4c9faa2d..ea2e5cc6da 100755 --- a/build-aux/install-reloc +++ b/build-aux/install-reloc @@ -16,48 +16,102 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. -# Usage 1: -# install-reloc -- library_path_var library_path_value prefix destdir \ -# compile_command srcdir builddir config_h_dir exeext \ -# strip_command \ -# install_command... destprog -# where -# - library_path_var is the platform dependent runtime library path variable -# - library_path_value is a colon separated list of directories that contain -# the libraries at installation time (use this instead of -rpath) -# - prefix is the base directory at installation time -# - destdir is a string that is prepended to all file names at installation -# time; it is already prepended to destprog but not to library_path_value -# and prefix -# - compile_command is a C compiler compilation and linking command -# - srcdir is the directory where to find relocwrapper.c and its dependencies -# - builddir is the directory where to find built dependencies (namely, -# alloca.h and stdbool.h) -# - config_h_dir is the directory where to find config.h -# - exeext is platform dependent suffix of executables -# - strip_command is the command for stripping executables, or : if no -# stripping is desired -# - install_command is the install command line, excluding the final destprog -# - destprog is the destination program name -# Usage 2: -# env RELOC_LIBRARY_PATH_VAR=library_path_var \ -# RELOC_LIBRARY_PATH_VALUE=library_path_value \ -# RELOC_PREFIX=prefix \ -# RELOC_DESTDIR=destdir \ -# RELOC_COMPILE_COMMAND=compile_command \ -# RELOC_SRCDIR=srcdir \ -# RELOC_BUILDDIR=builddir \ -# RELOC_CONFIG_H_DIR=config_h_dir \ -# RELOC_EXEEXT=exeext \ -# RELOC_STRIP_PROG=strip_command \ -# RELOC_INSTALL_PROG=install_command... \ -# install-reloc prog1 ... destprog -# where destprog is either the destination program name (when only one program -# is specified) or the destination directory for all programs. -# install-reloc renames destprog to destprog.bin and installs a relocating -# wrapper in the place of destprog. +# func_usage +# outputs to stdout the --help usage message. +func_usage () +{ + echo "\ +Usage 1: + install-reloc -- library_path_var library_path_value prefix destdir \\ + compile_command srcdir builddir config_h_dir exeext \\ + strip_command \\ + install_command... destprog +where + - library_path_var is the platform dependent runtime library path variable + - library_path_value is a colon separated list of directories that contain + the libraries at installation time (use this instead of -rpath) + - prefix is the base directory at installation time + - destdir is a string that is prepended to all file names at installation + time; it is already prepended to destprog but not to library_path_value + and prefix + - compile_command is a C compiler compilation and linking command + - srcdir is the directory where to find relocwrapper.c and its dependencies + - builddir is the directory where to find built dependencies (namely, + alloca.h and stdbool.h) + - config_h_dir is the directory where to find config.h + - exeext is platform dependent suffix of executables + - strip_command is the command for stripping executables, or : if no + stripping is desired + - install_command is the install command line, excluding the final destprog + - destprog is the destination program name +Usage 2: + env RELOC_LIBRARY_PATH_VAR=library_path_var \\ + RELOC_LIBRARY_PATH_VALUE=library_path_value \\ + RELOC_PREFIX=prefix \\ + RELOC_DESTDIR=destdir \\ + RELOC_COMPILE_COMMAND=compile_command \\ + RELOC_SRCDIR=srcdir \\ + RELOC_BUILDDIR=builddir \\ + RELOC_CONFIG_H_DIR=config_h_dir \\ + RELOC_EXEEXT=exeext \\ + RELOC_STRIP_PROG=strip_command \\ + RELOC_INSTALL_PROG=install_command... \\ + install-reloc prog1 ... destprog + where destprog is either the destination program name (when only one program + is specified) or the destination directory for all programs. +Usage 3: + install-reloc OPTION + +Renames destprog to destprog.bin and installs a relocating wrapper +in the place of destprog. + +Options: + --help print this help and exit + --version print version information and exit + +Send patches and bug reports to <bug-gnulib@gnu.org>." +} + +# func_version +# outputs to stdout the --version message. +func_version () +{ + echo "install-reloc (GNU gnulib, module relocatable-prog-wrapper)" + echo "Copyright (C) 2024 Free Software Foundation, Inc. +License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html> +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law." + echo + printf 'Written by %s.\n' "Bruno Haible" +} + +# func_fatal_error message +# outputs to stderr a fatal error message, and terminates the program. +func_fatal_error () +{ + echo "install-reloc: *** $1" 1>&2 + echo "install-reloc: *** Stop." 1>&2 + exit 1 +} -progname=$0 +# Command-line option processing. +if test $# -eq 1; then + case "$1" in + --help | --hel | --he | --h ) + func_usage + exit 0 ;; + --version | --versio | --versi | --vers | --ver | --ve | --v ) + func_version + exit 0 ;; + -- ) # Usage 1 + break ;; + -* ) + func_fatal_error "unrecognized option: $1" + ;; + * ) # Usage 2 + break ;; + esac +fi if test $# -ge 12 && test "x$1" = "x--"; then # Get fixed position arguments. @@ -99,10 +153,7 @@ else strip_prog=$RELOC_STRIP_PROG install_prog=$RELOC_INSTALL_PROG # including the "-c" option else - echo "Usage: $0 -- library_path_var library_path_value prefix destdir" \ - "compile_command srcdir builddir config_h_dir exeext" \ - "strip_command" \ - "install_command... destprog" 1>&2 + func_usage 1>&2 exit 1 fi fi -- 2.34.1
>From f0caf1fffee582d7ef8c6f007f3a316ff2f54edf Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Fri, 14 Jun 2024 13:31:45 +0200 Subject: [PATCH 4/4] relocatable-prog: Implement --help and --version for all programs. * build-aux/config.libpath (func_usage, func_version, func_fatal_error): New functions. Add command-line option processing. * build-aux/libtool-reloc (func_usage, func_version, func_fatal_error): New functions. Add command-line option processing. * build-aux/reloc-ldflags (func_usage, func_version, func_fatal_error): New functions. Add command-line option processing. --- ChangeLog | 13 ++++++ build-aux/config.libpath | 82 +++++++++++++++++++++++++++++++---- build-aux/libtool-reloc | 61 +++++++++++++++++++++++++- build-aux/reloc-ldflags | 92 ++++++++++++++++++++++++++++++++++------ 4 files changed, 226 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index bd6d21d2c0..76d15ccf4f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2024-06-14 Bruno Haible <br...@clisp.org> + + relocatable-prog: Implement --help and --version for all programs. + * build-aux/config.libpath (func_usage, func_version, func_fatal_error): + New functions. + Add command-line option processing. + * build-aux/libtool-reloc (func_usage, func_version, func_fatal_error): + New functions. + Add command-line option processing. + * build-aux/reloc-ldflags (func_usage, func_version, func_fatal_error): + New functions. + Add command-line option processing. + 2024-06-14 Bruno Haible <br...@clisp.org> relocatable-prog-wrapper: Implement --help, --version for all programs. diff --git a/build-aux/config.libpath b/build-aux/config.libpath index 323b7669c8..173cd0d90b 100755 --- a/build-aux/config.libpath +++ b/build-aux/config.libpath @@ -23,14 +23,80 @@ # 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. -# -# The first argument passed to this file is the canonical host specification, -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# The environment variable LD should be set by the caller. -# -# The set of defined variables is at the end of this script. + +# func_usage +# outputs to stdout the --help usage message. +func_usage () +{ + echo "\ +Usage: config.libpath [OPTION] HOST + +Prints shell variable assignments that describe how to set the +run time search path of shared libraries in an executable at run time. + +The first argument passed to this file is the canonical host specification, + CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +or + CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM + +The environment variable LD should be set by the caller. + +The set of defined variables is at the end of this script. + +Options: + --help print this help and exit + --version print version information and exit + +Send patches and bug reports to <bug-gnulib@gnu.org>." +} + +# func_version +# outputs to stdout the --version message. +func_version () +{ + echo "config.libpath (GNU gnulib, module relocatable-prog)" + echo "Copyright (C) 2024 Free Software Foundation, Inc. +License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html> +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law." + echo + printf 'Written by %s.\n' "Bruno Haible" +} + +# func_fatal_error message +# outputs to stderr a fatal error message, and terminates the program. +func_fatal_error () +{ + echo "config.libpath: *** $1" 1>&2 + echo "config.libpath: *** Stop." 1>&2 + exit 1 +} + +# Command-line option processing. +while test $# -gt 0; do + case "$1" in + --help | --hel | --he | --h ) + func_usage + exit 0 ;; + --version | --versio | --versi | --vers | --ver | --ve | --v ) + func_version + exit 0 ;; + -- ) # Stop option processing + shift; break ;; + -* ) + func_fatal_error "unrecognized option: $1" + ;; + * ) + break ;; + esac +done + +if test $# -gt 1; then + func_fatal_error "too many arguments" +fi +if test $# -lt 1; then + func_fatal_error "too few arguments" +fi host="$1" host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` diff --git a/build-aux/libtool-reloc b/build-aux/libtool-reloc index 50c571dd0c..2f6e84d038 100755 --- a/build-aux/libtool-reloc +++ b/build-aux/libtool-reloc @@ -16,7 +16,43 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. -# Usage: libtool-reloc libtool LIBTOOL_ARGUMENTS +# func_usage +# outputs to stdout the --help usage message. +func_usage () +{ + echo "\ +Usage: libtool-reloc [OPTION]... libtool LIBTOOL_ARGUMENTS + +Invokes GNU libtool, with support for relocatable programs. + +Options: + --help print this help and exit + --version print version information and exit + +Send patches and bug reports to <bug-gnulib@gnu.org>." +} + +# func_version +# outputs to stdout the --version message. +func_version () +{ + echo "libtool-reloc (GNU gnulib, module relocatable-prog)" + echo "Copyright (C) 2024 Free Software Foundation, Inc. +License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html> +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law." + echo + printf 'Written by %s.\n' "Bruno Haible" +} + +# func_fatal_error message +# outputs to stderr a fatal error message, and terminates the program. +func_fatal_error () +{ + echo "libtool-reloc: *** $1" 1>&2 + echo "libtool-reloc: *** Stop." 1>&2 + exit 1 +} # Outputs a command and runs it. func_verbose () @@ -27,6 +63,29 @@ func_verbose () "$@" } +# Command-line option processing. +while test $# -gt 0; do + case "$1" in + --help | --hel | --he | --h ) + func_usage + exit 0 ;; + --version | --versio | --versi | --vers | --ver | --ve | --v ) + func_version + exit 0 ;; + -- ) # Stop option processing + shift; break ;; + -* ) + func_fatal_error "unrecognized option: $1" + ;; + * ) + break ;; + esac +done + +if test $# -lt 1; then + func_fatal_error "too few arguments" +fi + # Determine the mode from the arguments. mode= for arg diff --git a/build-aux/reloc-ldflags b/build-aux/reloc-ldflags index f6b636624f..828451b4ef 100755 --- a/build-aux/reloc-ldflags +++ b/build-aux/reloc-ldflags @@ -1,5 +1,5 @@ #! /bin/sh -# Output a system dependent linker command for putting a relocatable library +# Output a system dependent compiler option for putting a relocatable library # search path into an executable. # # Copyright 2003-2024 Free Software Foundation, Inc. @@ -22,18 +22,84 @@ # 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. -# -# The first argument passed to this file is the canonical host specification, -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# The environment variable LD should be set by the caller. -# -# The second argument is a colon separated list of directories that contain -# the libraries at installation time. -# -# The third argument is the directory into which the executable is going to be -# installed. + +# func_usage +# outputs to stdout the --help usage message. +func_usage () +{ + echo "\ +Usage: reloc-ldflags [OPTION]... HOST LIBRARY_PATH_VALUE INSTALLDIR + +Prints a system dependent compiler option for putting a relocatable library +search path into an executable. + +The first argument passed to this file is the canonical host specification, + CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +or + CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM + +The second argument is a colon separated list of directories that contain +the libraries at installation time. + +The third argument is the directory into which the executable is going to be +installed. + +The environment variable LD should be set by the caller. + +Options: + --help print this help and exit + --version print version information and exit + +Send patches and bug reports to <bug-gnulib@gnu.org>." +} + +# func_version +# outputs to stdout the --version message. +func_version () +{ + echo "reloc-ldflags (GNU gnulib, relocatable-prog)" + echo "Copyright (C) 2024 Free Software Foundation, Inc. +License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html> +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law." + echo + printf 'Written by %s.\n' "Bruno Haible" +} + +# func_fatal_error message +# outputs to stderr a fatal error message, and terminates the program. +func_fatal_error () +{ + echo "reloc-ldflags: *** $1" 1>&2 + echo "reloc-ldflags: *** Stop." 1>&2 + exit 1 +} + +# Command-line option processing. +while test $# -gt 0; do + case "$1" in + --help | --hel | --he | --h ) + func_usage + exit 0 ;; + --version | --versio | --versi | --vers | --ver | --ve | --v ) + func_version + exit 0 ;; + -- ) # Stop option processing + shift; break ;; + -* ) + func_fatal_error "unrecognized option: $1" + ;; + * ) + break ;; + esac +done + +if test $# -gt 3; then + func_fatal_error "too many arguments" +fi +if test $# -lt 3; then + func_fatal_error "too few arguments" +fi host="$1" host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -- 2.34.1