aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2018-10-26 06:14:56 +0000
committerNIIBE Yutaka <[email protected]>2018-10-26 06:14:56 +0000
commitaec676c9ca2da4feb2970f6ce036179afe778b25 (patch)
tree12a404bb036c0988a8acc142b87dfeaac9153549
parentgpg-error.m4: Better backward compatibility support. (diff)
downloadlibgpg-error-aec676c9ca2da4feb2970f6ce036179afe778b25.tar.gz
libgpg-error-aec676c9ca2da4feb2970f6ce036179afe778b25.zip
gpgrt-config: Clean up the implementation.
* src/gpgrt-config.in: Fix copyright notice. (--exists): Support new option of pkg-config. (--mt): Relax usage. (--api-version): Support old option. (default_module): New. (usage): Only show pkg-config compatible options. Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--src/gpgrt-config.in63
1 files changed, 38 insertions, 25 deletions
diff --git a/src/gpgrt-config.in b/src/gpgrt-config.in
index d0b9a32..9df01b7 100644
--- a/src/gpgrt-config.in
+++ b/src/gpgrt-config.in
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+# Copyright (C) 2018 g10 Code GmbH
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
@@ -198,7 +198,9 @@ find_file_in_path () {
read_config_file () {
if ! find_file_in_path $1.pc $2; then
- echo "Can't find $1.pc" 1>&2
+ if [ -z "$want_exists" ]; then
+ echo "Can't find $1.pc" 1>&2
+ fi
exit 1
fi
read_config_from_stdin $RESULT < $RESULT
@@ -461,24 +463,22 @@ sysroot () {
#### end of functions for this script
myname=${0##*/}
-# Just for a while for testing
-myname=${myname%-new}
-##############################
if [ $myname = gpgrt-config ]; then
- myname="gpg-error-config"
+ default_module="gpg-error"
+else
+ default_module=${myname%-config}
fi
usage()
{
cat <<EOF
-Usage: $myname [OPTIONS]
+Usage: gpgrt-config [OPTIONS] MODULES
Options:
- [--mt] (must be the first option)
- [--prefix]
- [--exec-prefix]
- [--version]
+ [--exists]
+ [--modversion]
[--libs]
[--cflags]
+ [--variable=VARNAME]
EOF
exit $1
}
@@ -487,19 +487,13 @@ if test $# -eq 0; then
usage 1 1>&2
fi
-if [ "$1" != "--mt" ]; then
- mt=no
-else
- # In future, use --variable=mtcflags or --variable=mtlibs
- mt=yes
- shift
-fi
module_list=""
want_var=""
want_attr=""
want_cflags=""
want_libs=""
+want_exists=""
cflags=""
libs=""
@@ -509,6 +503,8 @@ mtlibs=""
delimiter=" "
output=""
+mt="no"
+
VAR_list=VAR_pc_sysrootdir
if [ -z "$PKG_CONFIG_SYSROOT_DIR" ]; then
VAR_pc_sysrootdir="/"
@@ -518,6 +514,7 @@ fi
while test $# -gt 0; do
case $1 in
+ #### pkg-config incompatible options: begin
--prefix)
# In future, use --variable=prefix instead.
want_var=prefix
@@ -532,11 +529,27 @@ while test $# -gt 0; do
delimiter="
"
;;
+ --api-version)
+ # In future, use --variable=api_version instead.
+ want_var=api_version
+ ;;
+ --host)
+ # In future, use --variable=host instead.
+ want_var=host
+ ;;
+ --mt)
+ # In future, use --variable=mtcflags or --variable=mtlibs.
+ mt=yes
+ ;;
+ #### pkg-config incompatible options: end
--modversion)
want_attr=Version
delimiter="
"
;;
+ --exists)
+ want_exists=yes
+ ;;
--cflags)
want_cflags=yes
;;
@@ -546,10 +559,6 @@ while test $# -gt 0; do
--variable=*)
want_var=${1#*=}
;;
- --host)
- # In future, use --variable=host instead.
- want_var=host
- ;;
--help)
usage 0
;;
@@ -567,9 +576,9 @@ done
if [ -z "$module_list" ]; then
- module_list=${myname%-config}
+ module_list=$default_module
elif expr match "$module_list" "=\|!=\|<\|>\|<=\|>=" >/dev/null; then
- module_list="${myname%-config} $module_list"
+ module_list="$default_module $module_list"
fi
all_required_config_files $module_list
@@ -612,4 +621,8 @@ if [ -z "$want_var" -a -z "$want_attr" ]; then
fi
fi
-echo "$output"
+if [ -z "$want_exists" ]; then
+ echo "$output"
+fi
+
+exit 0