From 78af09ce13969b64f121ae5990e66fb7f1cd3f1d Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Fri, 2 Nov 2018 11:31:01 +0900 Subject: gpgrt-config: Don't support variable reference in --libdir option. * src/gpgrt-config: Simplify --libdir support, remove variable substituion. * src/gpg-error.m4: Expand possible ${prefix}, ${exec_prefix} in libdir. Simplify invocation of gpgrt-config. * src/gpgrt.m4: Likewise. -- The --libdir option for configure can include variable reference like --libdir='${exec_prefix}/lib/x86_64-linux-gnu', and this expression should be expanded (the variable should be substituted) beforehand to determine if there is gpg-error.pc file or not. Signed-off-by: NIIBE Yutaka --- src/gpg-error.m4 | 20 ++++++++++++++++---- src/gpgrt-config | 42 +++++------------------------------------- src/gpgrt.m4 | 18 +++++++++++++++--- 3 files changed, 36 insertions(+), 44 deletions(-) diff --git a/src/gpg-error.m4 b/src/gpg-error.m4 index 3bfa601..a9d572f 100644 --- a/src/gpg-error.m4 +++ b/src/gpg-error.m4 @@ -64,8 +64,20 @@ AC_DEFUN([AM_PATH_GPG_ERROR], min_gpg_error_version=ifelse([$1], ,1.33,$1) ok=no - if test -f $libdir/pkgconfig/gpg-error.pc; then - gpgrt_libdir=$libdir + if test "$prefix" = NONE ; then + prefix_option_expanded=/usr/local + else + prefix_option_expanded="$prefix" + fi + if test "$exec_prefix" = NONE ; then + exec_prefix_option_expanded=$prefix_option_expanded + else + exec_prefix_option_expanded=$(prefix=$prefix_option_expanded eval echo $exec_prefix) + fi + libdir_option_expanded=$(prefix=$prefix_option_expanded exec_prefix=$exec_prefix_option_expanded eval echo $libdir) + + if test -f $libdir_option_expanded/pkgconfig/gpg-error.pc; then + gpgrt_libdir=$libdir_option_expanded else if crt1_path=$(${CC:-cc} -print-file-name=crt1.o 2>/dev/null); then if possible_libdir=$(cd ${crt1_path%/*} && pwd 2>/dev/null); then @@ -81,7 +93,7 @@ AC_DEFUN([AM_PATH_GPG_ERROR], if test "$GPGRT_CONFIG" = "no"; then unset GPGRT_CONFIG else - GPGRT_CONFIG="$GPGRT_CONFIG --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$gpgrt_libdir" + GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir" if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config]) @@ -117,7 +129,7 @@ AC_DEFUN([AM_PATH_GPG_ERROR], if test "$GPGRT_CONFIG" = "no"; then unset GPGRT_CONFIG else - GPGRT_CONFIG="$GPGRT_CONFIG --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$gpgrt_libdir" + GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir" if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config]) diff --git a/src/gpgrt-config b/src/gpgrt-config index 9ff0b3a..9aec4f6 100755 --- a/src/gpgrt-config +++ b/src/gpgrt-config @@ -417,7 +417,7 @@ sysroot () { # Show usage usage () { cat <&2 - echo "When LIBDIR has variable references for prefix and/or exec_prefix," 1>&2 - echo "you should provide --prefix=PREFIX option and/or" 1>&2 - echo "--exec-prefix=EXEC_PREFIX option, too" 1>&2 exit 1 fi diff --git a/src/gpgrt.m4 b/src/gpgrt.m4 index 912b103..55c3ff0 100644 --- a/src/gpgrt.m4 +++ b/src/gpgrt.m4 @@ -69,8 +69,20 @@ AC_DEFUN([AM_PATH_GPGRT], fi fi - if test -f $libdir/pkgconfig/gpg-error.pc; then - gpgrt_libdir=$libdir + if test "$prefix" = NONE ; then + prefix_option_expanded=/usr/local + else + prefix_option_expanded="$prefix" + fi + if test "$exec_prefix" = NONE ; then + exec_prefix_option_expanded=$prefix_option_expanded + else + exec_prefix_option_expanded=$(prefix=$prefix_option_expanded eval echo $exec_prefix) + fi + libdir_option_expanded=$(prefix=$prefix_option_expanded exec_prefix=$exec_prefix_option_expanded eval echo $libdir) + + if test -f $libdir_option_expanded/pkgconfig/gpg-error.pc; then + gpgrt_libdir=$libdir_option_expanded else if crt1_path=$(${CC:-cc} -print-file-name=crt1.o 2>/dev/null); then if possible_libdir=$(cd ${crt1_path%/*} && pwd 2>/dev/null); then @@ -84,7 +96,7 @@ AC_DEFUN([AM_PATH_GPGRT], if test -n "$gpgrt_libdir"; then AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no) if test "$GPGRT_CONFIG" != "no"; then - GPGRT_CONFIG="$GPGRT_CONFIG --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$gpgrt_libdir" + GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir" fi fi min_gpgrt_version=ifelse([$1], ,1.33,$1) -- cgit v1.2.3