blob: aea8eba5fac28cebff5ae4fe87095d7524917df0 [file] [log] [blame]
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001From 62651c5c7b4a391f16dbe1b09c6e220efe5c8a35 Mon Sep 17 00:00:00 2001
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08002From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Thu, 29 Mar 2018 15:12:17 +0800
4Subject: [PATCH] support pkgconfig
Patrick Williamsc124f4f2015-09-15 14:41:29 -05005
6Upstream-Status: Pending
7
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08008Rebase to 1.28
9
10Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Brad Bishop19323692019-04-05 15:28:33 -040011
12Refactored for 1.33
13Signed-off-by: Armin Kuster <akuster808@gmail.com>
Andrew Geisslerd1e89492021-02-12 15:35:20 -060014Signed-off-by: Zheng Ruoqin <zhengrq.fnst@cn.fujitsu.com>
William A. Kennington IIIac69b482021-06-02 12:28:27 -070015
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080016---
William A. Kennington IIIac69b482021-06-02 12:28:27 -070017 src/gpg-error.m4 | 159 +----------------------------------------------
18 1 file changed, 3 insertions(+), 156 deletions(-)
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080019
Andrew Geisslerd1e89492021-02-12 15:35:20 -060020diff --git a/src/gpg-error.m4 b/src/gpg-error.m4
William A. Kennington IIIac69b482021-06-02 12:28:27 -070021index d910754..76f045c 100644
Andrew Geisslerd1e89492021-02-12 15:35:20 -060022--- a/src/gpg-error.m4
23+++ b/src/gpg-error.m4
William A. Kennington IIIac69b482021-06-02 12:28:27 -070024@@ -27,156 +27,12 @@ dnl is added to the gpg_config_script_warn variable.
Patrick Williamsc124f4f2015-09-15 14:41:29 -050025 dnl
26 AC_DEFUN([AM_PATH_GPG_ERROR],
27 [ AC_REQUIRE([AC_CANONICAL_HOST])
28- gpg_error_config_prefix=""
29- dnl --with-libgpg-error-prefix=PFX is the preferred name for this option,
30- dnl since that is consistent with how our three siblings use the directory/
31- dnl package name in --with-$dir_name-prefix=PFX.
32- AC_ARG_WITH(libgpg-error-prefix,
Andrew Geisslerd1e89492021-02-12 15:35:20 -060033- AS_HELP_STRING([--with-libgpg-error-prefix=PFX],
Patrick Williamsc124f4f2015-09-15 14:41:29 -050034- [prefix where GPG Error is installed (optional)]),
35- [gpg_error_config_prefix="$withval"])
Andrew Geisslerd1e89492021-02-12 15:35:20 -060036-
Patrick Williamsc124f4f2015-09-15 14:41:29 -050037- dnl Accept --with-gpg-error-prefix and make it work the same as
38- dnl --with-libgpg-error-prefix above, for backwards compatibility,
39- dnl but do not document this old, inconsistently-named option.
40- AC_ARG_WITH(gpg-error-prefix,,
41- [gpg_error_config_prefix="$withval"])
Brad Bishop19323692019-04-05 15:28:33 -040042-
Patrick Williamsc124f4f2015-09-15 14:41:29 -050043- if test x"${GPG_ERROR_CONFIG}" = x ; then
44- if test x"${gpg_error_config_prefix}" != x ; then
45- GPG_ERROR_CONFIG="${gpg_error_config_prefix}/bin/gpg-error-config"
46- else
47- case "${SYSROOT}" in
48- /*)
49- if test -x "${SYSROOT}/bin/gpg-error-config" ; then
50- GPG_ERROR_CONFIG="${SYSROOT}/bin/gpg-error-config"
51- fi
52- ;;
53- '')
54- ;;
55- *)
56- AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.])
57- ;;
58- esac
59- fi
60- fi
Brad Bishop19323692019-04-05 15:28:33 -040061-
Patrick Williamsc124f4f2015-09-15 14:41:29 -050062- AC_PATH_PROG(GPG_ERROR_CONFIG, gpg-error-config, no)
Brad Bishop19323692019-04-05 15:28:33 -040063- min_gpg_error_version=ifelse([$1], ,1.33,$1)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050064- ok=no
Brad Bishop19323692019-04-05 15:28:33 -040065-
William A. Kennington IIIac69b482021-06-02 12:28:27 -070066- AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no)
67- if test "$GPGRT_CONFIG" != "no"; then
68- # Determine gpgrt_libdir
69- #
70- # Get the prefix of gpgrt-config assuming it's something like:
71- # <PREFIX>/bin/gpgrt-config
72- gpgrt_prefix=${GPGRT_CONFIG%/*/*}
73- possible_libdir1=${gpgrt_prefix}/lib
74- # Determine by using system libdir-format with CC, it's like:
75- # Normal style: /usr/lib
76- # GNU cross style: /usr/<triplet>/lib
77- # Debian style: /usr/lib/<multiarch-name>
78- # Fedora/openSUSE style: /usr/lib, /usr/lib32 or /usr/lib64
79- # It is assumed that CC is specified to the one of host on cross build.
80- if libdir_candidates=$(${CC:-cc} -print-search-dirs | \
81- sed -n -e "/^libraries/{s/libraries: =//;s/:/\n/gp}"); then
82- # From the output of -print-search-dirs, select valid pkgconfig dirs.
83- libdir_candidates=$(for dir in $libdir_candidates; do
84- if p=$(cd $dir 2>/dev/null && pwd); then
85- test -d "$p/pkgconfig" && echo $p;
Brad Bishop19323692019-04-05 15:28:33 -040086- fi
William A. Kennington IIIac69b482021-06-02 12:28:27 -070087- done)
Brad Bishop19323692019-04-05 15:28:33 -040088-
William A. Kennington IIIac69b482021-06-02 12:28:27 -070089- for possible_libdir0 in $libdir_candidates; do
90- # possible_libdir0:
91- # Fallback candidate, the one of system-installed (by $CC)
92- # (/usr/<triplet>/lib, /usr/lib/<multiarch-name> or /usr/lib32)
93- # possible_libdir1:
94- # Another candidate, user-locally-installed
95- # (<gpgrt_prefix>/lib)
96- # possible_libdir2
97- # Most preferred
98- # (<gpgrt_prefix>/<triplet>/lib,
99- # <gpgrt_prefix>/lib/<multiarch-name> or <gpgrt_prefix>/lib32)
100- if test "${possible_libdir0##*/}" = "lib"; then
101- possible_prefix0=${possible_libdir0%/lib}
102- possible_prefix0_triplet=${possible_prefix0##*/}
103- if test -z "$possible_prefix0_triplet"; then
104- continue
105- fi
106- possible_libdir2=${gpgrt_prefix}/$possible_prefix0_triplet/lib
107- else
108- possible_prefix0=${possible_libdir0%%/lib*}
109- possible_libdir2=${gpgrt_prefix}${possible_libdir0#$possible_prefix0}
110- fi
111- if test -f ${possible_libdir2}/pkgconfig/gpg-error.pc; then
112- gpgrt_libdir=${possible_libdir2}
113- elif test -f ${possible_libdir1}/pkgconfig/gpg-error.pc; then
114- gpgrt_libdir=${possible_libdir1}
115- elif test -f ${possible_libdir0}/pkgconfig/gpg-error.pc; then
116- gpgrt_libdir=${possible_libdir0}
117- fi
118- if test -n "$gpgrt_libdir"; then break; fi
119- done
Brad Bishop19323692019-04-05 15:28:33 -0400120- else
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700121- # When we cannot determine system libdir-format, use this:
122- gpgrt_libdir=${possible_libdir1}
Brad Bishop19323692019-04-05 15:28:33 -0400123- fi
124- else
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700125- unset GPGRT_CONFIG
126- fi
127-
128- if test -n "$gpgrt_libdir"; then
129- GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir"
130- if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then
131- GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error"
132- AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config])
133- gpg_error_config_version=`$GPG_ERROR_CONFIG --modversion`
134- else
135- unset GPGRT_CONFIG
136- fi
137- elif test "$GPG_ERROR_CONFIG" != "no"; then
Brad Bishop19323692019-04-05 15:28:33 -0400138- gpg_error_config_version=`$GPG_ERROR_CONFIG --version`
139- fi
140- if test "$GPG_ERROR_CONFIG" != "no"; then
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500141- req_major=`echo $min_gpg_error_version | \
142- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
143- req_minor=`echo $min_gpg_error_version | \
144- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500145- major=`echo $gpg_error_config_version | \
146- sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
147- minor=`echo $gpg_error_config_version | \
148- sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
149- if test "$major" -gt "$req_major"; then
150- ok=yes
151- else
152- if test "$major" -eq "$req_major"; then
153- if test "$minor" -ge "$req_minor"; then
154- ok=yes
155- fi
156- fi
157- fi
158- fi
Brad Bishop19323692019-04-05 15:28:33 -0400159- AC_MSG_CHECKING(for GPG Error - version >= $min_gpg_error_version)
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600160+ min_gpg_error_version=ifelse([$1], ,0.0,$1)
161+ PKG_CHECK_MODULES(GPG_ERROR, [gpg-error >= $min_gpg_error_version], [ok=yes], [ok=no])
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500162 if test $ok = yes; then
Brad Bishop19323692019-04-05 15:28:33 -0400163- GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG --cflags`
164- GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG --libs`
165- if test -z "$GPGRT_CONFIG"; then
166- GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG --mt --cflags 2>/dev/null`
167- GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG --mt --libs 2>/dev/null`
168- else
169- GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG --variable=mtcflags 2>/dev/null`
170- GPG_ERROR_MT_CFLAGS="$GPG_ERROR_CFLAGS${GPG_ERROR_CFLAGS:+ }$GPG_ERROR_MT_CFLAGS"
171- GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG --variable=mtlibs 2>/dev/null`
172- GPG_ERROR_MT_LIBS="$GPG_ERROR_LIBS${GPG_ERROR_LIBS:+ }$GPG_ERROR_MT_LIBS"
173- fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500174- AC_MSG_RESULT([yes ($gpg_error_config_version)])
175 ifelse([$2], , :, [$2])
Brad Bishop19323692019-04-05 15:28:33 -0400176 if test -z "$GPGRT_CONFIG"; then
177- gpg_error_config_host=`$GPG_ERROR_CONFIG --host 2>/dev/null || echo none`
178- else
179- gpg_error_config_host=`$GPG_ERROR_CONFIG --variable=host 2>/dev/null || echo none`
180+ gpg_error_config_host=`$PKG_CONFIG --variable=host gpg-error`
181 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500182 if test x"$gpg_error_config_host" != xnone ; then
183 if test x"$gpg_error_config_host" != x"$host" ; then
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700184@@ -192,15 +48,6 @@ AC_DEFUN([AM_PATH_GPG_ERROR],
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500185 fi
186 fi
187 else
188- GPG_ERROR_CFLAGS=""
189- GPG_ERROR_LIBS=""
190- GPG_ERROR_MT_CFLAGS=""
191- GPG_ERROR_MT_LIBS=""
192- AC_MSG_RESULT(no)
193 ifelse([$3], , :, [$3])
194 fi
Brad Bishop19323692019-04-05 15:28:33 -0400195- AC_SUBST(GPG_ERROR_CFLAGS)
196- AC_SUBST(GPG_ERROR_LIBS)
197- AC_SUBST(GPG_ERROR_MT_CFLAGS)
198- AC_SUBST(GPG_ERROR_MT_LIBS)
199 ])