diff options
-rw-r--r-- | configure.ac | 8 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/gpg-error-config-head.in | 17 | ||||
-rw-r--r-- | src/gpg-error-config-main.sh | 142 | ||||
-rw-r--r-- | src/gpg-error-config.in (renamed from src/pkgconf-funcs.sh) | 160 |
5 files changed, 162 insertions, 167 deletions
diff --git a/configure.ac b/configure.ac index 9a2d8ba..58957b7 100644 --- a/configure.ac +++ b/configure.ac @@ -634,13 +634,7 @@ AC_CONFIG_FILES([src/Makefile tests/Makefile]) AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpg-error.asd]) AC_CONFIG_FILES([src/versioninfo.rc src/gpg-error.w32-manifest]) AC_CONFIG_FILES([src/gpg-error.pc]) -AC_CONFIG_FILES([src/gpg-error-config-head]) -AC_CONFIG_COMMANDS([gen-gpg-error-config], [ -cat src/gpg-error-config-head \ - $srcdir/src/pkgconf-funcs.sh \ - $srcdir/src/gpg-error-config-main.sh > src/gpg-error-config -chmod +x src/gpg-error-config -]) +AC_CONFIG_FILES([src/gpg-error-config], [chmod +x src/gpg-error-config]) AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am index 98e3b94..c1efb94 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -96,7 +96,7 @@ EXTRA_DIST = mkstrtable.awk err-sources.h.in err-codes.h.in \ mkerrcodes.awk mkerrcodes1.awk mkerrcodes2.awk mkerrcodes.c \ mkheader.c gpg-error.h.in mkw32errmap.c w32-add.h w32ce-add.h \ err-sources.h err-codes.h \ - gpg-error-config-head.in pkgconf-funcs.sh gpg-error-config-main.sh \ + gpg-error-config.in \ gpg-error.pc.in \ gpg-error.m4 gpgrt.m4 \ gpg-error.vers gpg-error.def.in \ diff --git a/src/gpg-error-config-head.in b/src/gpg-error-config-head.in deleted file mode 100644 index c6219f2..0000000 --- a/src/gpg-error-config-head.in +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc. -# -# This file is free software; as a special exception the author gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. -# -# This file is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# SPDX-License-Identifier: FSFULLR - -prefix=@prefix@ -datarootdir=@datarootdir@ -datadir=@datadir@ -PKG_CONFIG_PATH="$PKG_CONFIG_PATH${PKG_CONFIG_PATH:+:}${datadir}/pkgconfig" -# diff --git a/src/gpg-error-config-main.sh b/src/gpg-error-config-main.sh deleted file mode 100644 index 1ead597..0000000 --- a/src/gpg-error-config-main.sh +++ /dev/null @@ -1,142 +0,0 @@ - -myname=${0##*/} -if [ $myname = gpgrt-config ]; then - myname="gpg-error-config" -fi - -usage() -{ - cat <<EOF -Usage: $myname [OPTIONS] -Options: - [--mt] (must be the first option) - [--prefix] - [--exec-prefix] - [--version] - [--libs] - [--cflags] -EOF - exit $1 -} - -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 - -modules="" -output_var="" -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 - ;; - --exec-prefix) - # In future, use --variable=exec_prefix instead. - output_var=exec_prefix - ;; - --version) - # In future, use --modversion instead. - output_attr=Version - delimiter=" -" - ;; - --modversion) - output_attr=Version - delimiter=" -" - ;; - --cflags) - opt_cflags=yes - ;; - --libs) - opt_libs=yes - ;; - --variable=*) - output_var=${1#*=} - ;; - --host) - # In future, use --variable=host instead. - output_var=host - ;; - --help) - usage 0 - ;; - *) - modules="$modules $1" - ;; - esac - shift -done - -if [ $myname = "gpg-error-config" -a -z "$modules" ]; then - read_config_file ${myname%-config} $PKG_CONFIG_PATH - 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)" - 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) -fi - -for p in $pkg_list; do - read_config_file $p $PKG_CONFIG_PATH - 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 [ -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 - 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" diff --git a/src/pkgconf-funcs.sh b/src/gpg-error-config.in index 7073f81..d5e2f3b 100644 --- a/src/pkgconf-funcs.sh +++ b/src/gpg-error-config.in @@ -1,3 +1,21 @@ +#!/bin/sh +# Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc. +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This file is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# SPDX-License-Identifier: FSFULLR + +prefix=@prefix@ +datarootdir=@datarootdir@ +datadir=@datadir@ +PKG_CONFIG_PATH="$PKG_CONFIG_PATH${PKG_CONFIG_PATH:+:}${datadir}/pkgconfig" +# + #### start of pkgconf-funcs # @@ -230,3 +248,145 @@ all_required_config_files () { } #### end of pkgconf-funcs + +myname=${0##*/} +if [ $myname = gpgrt-config ]; then + myname="gpg-error-config" +fi + +usage() +{ + cat <<EOF +Usage: $myname [OPTIONS] +Options: + [--mt] (must be the first option) + [--prefix] + [--exec-prefix] + [--version] + [--libs] + [--cflags] +EOF + exit $1 +} + +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 + +modules="" +output_var="" +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 + ;; + --exec-prefix) + # In future, use --variable=exec_prefix instead. + output_var=exec_prefix + ;; + --version) + # In future, use --modversion instead. + output_attr=Version + delimiter=" +" + ;; + --modversion) + output_attr=Version + delimiter=" +" + ;; + --cflags) + opt_cflags=yes + ;; + --libs) + opt_libs=yes + ;; + --variable=*) + output_var=${1#*=} + ;; + --host) + # In future, use --variable=host instead. + output_var=host + ;; + --help) + usage 0 + ;; + *) + modules="$modules $1" + ;; + esac + shift +done + +if [ $myname = "gpg-error-config" -a -z "$modules" ]; then + read_config_file ${myname%-config} $PKG_CONFIG_PATH + 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)" + 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) +fi + +for p in $pkg_list; do + read_config_file $p $PKG_CONFIG_PATH + 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 [ -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 + 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" |