aboutsummaryrefslogtreecommitdiffstats
path: root/src/gpg-error-config-main.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpg-error-config-main.sh')
-rw-r--r--src/gpg-error-config-main.sh70
1 files changed, 41 insertions, 29 deletions
diff --git a/src/gpg-error-config-main.sh b/src/gpg-error-config-main.sh
index 0a0dd0f..1ead597 100644
--- a/src/gpg-error-config-main.sh
+++ b/src/gpg-error-config-main.sh
@@ -37,27 +37,28 @@ output_attr=""
opt_cflags=no
opt_libs=no
output=""
+delimiter=" "
while test $# -gt 0; do
case $1 in
--prefix)
# In future, use --variable=prefix instead.
output_var=prefix
- break
;;
--exec-prefix)
# In future, use --variable=exec_prefix instead.
output_var=exec_prefix
- break
;;
--version)
# In future, use --modversion instead.
output_attr=Version
- break
+ delimiter="
+"
;;
--modversion)
output_attr=Version
- break
+ delimiter="
+"
;;
--cflags)
opt_cflags=yes
@@ -67,12 +68,10 @@ while test $# -gt 0; do
;;
--variable=*)
output_var=${1#*=}
- break
;;
--host)
# In future, use --variable=host instead.
output_var=host
- break
;;
--help)
usage 0
@@ -84,22 +83,27 @@ while test $# -gt 0; do
shift
done
-if [ -z "$modules" ]; then
- modules=${myname%-config}
-fi
-
-if [ myname = "gpg-error-config" -a -z "$modules" ]; then
+if [ $myname = "gpg-error-config" -a -z "$modules" ]; then
read_config_file ${myname%-config} $PKG_CONFIG_PATH
- cflags="$(get_attr Cflags)"
- libs="$(get_attr Libs)"
+ if [ -n "$output_var" ]; then
+ output="$output${output:+ }$(get_var $output_var)"
+ elif [ -n "$output_attr" ]; then
+ output="$output${output:+ }$(get_attr $output_attr)"
+ else
+ cflags="$(get_attr Cflags)"
+ libs="$(get_attr Libs)"
- mtcflags="$(get_var mtcflags)"
- mtlibs="$(get_var mtlibs)"
+ mtcflags="$(get_var mtcflags)"
+ mtlibs="$(get_var mtlibs)"
+ fi
requires="$(get_attr Requires)"
cleanup_vars_attrs
pkg_list=$(all_required_config_files $requires)
else
+ if [ -z "$modules" ]; then
+ modules=${myname%-config}
+ fi
cflags=""
libs=""
pkg_list=$(all_required_config_files $modules)
@@ -107,24 +111,32 @@ fi
for p in $pkg_list; do
read_config_file $p $PKG_CONFIG_PATH
- cflags="$cflags $(get_attr Cflags)"
- libs="$libs $(get_attr Libs)"
+ if [ -n "$output_var" ]; then
+ output="$output${output:+$delimiter}$(get_var $output_var)"
+ elif [ -n "$output_attr" ]; then
+ output="$output${output:+$delimiter}$(get_attr $output_attr)"
+ else
+ cflags="$cflags${cflags:+ }$(get_attr Cflags)"
+ libs="$libs${libs:+ }$(get_attr Libs)"
+ fi
cleanup_vars_attrs
done
-if [ $opt_cflags = yes ]; then
- output="$output $(list_only_once $cflags)"
- # Backward compatibility to old gpg-error-config
- if [ $mt = yes ]; then
- output="$output $mtcflags"
+if [ -z "$output_var" -a -z "$output_attr" ]; then
+ if [ $opt_cflags = yes ]; then
+ output="$output $(list_only_once $cflags)"
+ # Backward compatibility to old gpg-error-config
+ if [ $mt = yes ]; then
+ output="$output $mtcflags"
+ fi
fi
-fi
-if [ $opt_libs = yes ]; then
- output="$output $(list_only_once_for_libs $libs)"
- # Backward compatibility to old gpg-error-config
- if [ $mt = yes ]; then
- output="$output $mtlibs"
+ if [ $opt_libs = yes ]; then
+ output="$output $(list_only_once_for_libs $libs)"
+ # Backward compatibility to old gpg-error-config
+ if [ $mt = yes ]; then
+ output="$output $mtlibs"
+ fi
fi
fi
-echo $output
+echo "$output"