blob: 3066613d423843c5bc6788f432128d0d7c4afb7b [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From ec309e20b5a27d42a5fb915c328d61e924ab5f19 Mon Sep 17 00:00:00 2001
2From: 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>
11---
12 configure.ac | 1 +
13 src/Makefile.am | 4 ++-
14 src/gpg-error.m4 | 71 +++--------------------------------------------------
15 src/gpg-error.pc.in | 11 +++++++++
16 4 files changed, 18 insertions(+), 69 deletions(-)
17 create mode 100644 src/gpg-error.pc.in
18
19diff --git a/configure.ac b/configure.ac
20index aca9300..f7794e9 100644
21--- a/configure.ac
22+++ b/configure.ac
23@@ -621,6 +621,7 @@ AC_CONFIG_FILES([src/Makefile tests/Makefile])
Patrick Williamsc124f4f2015-09-15 14:41:29 -050024 AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpg-error.asd])
25 AC_CONFIG_FILES([src/versioninfo.rc src/gpg-error.w32-manifest])
26 AC_CONFIG_FILES([src/gpg-error-config], [chmod +x src/gpg-error-config])
27+AC_CONFIG_FILES([src/gpg-error.pc])
28
29 AC_OUTPUT
30
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080031diff --git a/src/Makefile.am b/src/Makefile.am
32index 268c2ab..95f8459 100644
33--- a/src/Makefile.am
34+++ b/src/Makefile.am
35@@ -87,6 +87,8 @@ bin_SCRIPTS = gpg-error-config
36 nodist_bin_SCRIPTS = gpgrt-config
Patrick Williamsc124f4f2015-09-15 14:41:29 -050037 m4datadir = $(datadir)/aclocal
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080038 m4data_DATA = gpg-error.m4 gpgrt.m4
Patrick Williamsc124f4f2015-09-15 14:41:29 -050039+pkgconfigdir = $(libdir)/pkgconfig
40+pkgconfig_DATA = gpg-error.pc
41
42 EXTRA_DIST = mkstrtable.awk err-sources.h.in err-codes.h.in \
43 mkerrnos.awk errnos.in README \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080044@@ -94,7 +96,7 @@ EXTRA_DIST = mkstrtable.awk err-sources.h.in err-codes.h.in \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050045 mkheader.c gpg-error.h.in mkw32errmap.c w32-add.h w32ce-add.h \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080046 err-sources.h err-codes.h gpg-error-config.in gpg-error.m4 gpgrt.m4 \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050047 gpg-error.vers gpg-error.def.in \
48- versioninfo.rc.in gpg-error.w32-manifest.in \
49+ versioninfo.rc.in gpg-error.w32-manifest.in gpg-error.pc \
50 $(lock_obj_pub)
51
52 BUILT_SOURCES = err-sources.h err-codes.h code-to-errno.h code-from-errno.h \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080053diff --git a/src/gpg-error.m4 b/src/gpg-error.m4
54index 60c88d8..2ef7e3e 100644
55--- a/src/gpg-error.m4
56+++ b/src/gpg-error.m4
57@@ -26,73 +26,13 @@ dnl is added to the gpg_config_script_warn variable.
Patrick Williamsc124f4f2015-09-15 14:41:29 -050058 dnl
59 AC_DEFUN([AM_PATH_GPG_ERROR],
60 [ AC_REQUIRE([AC_CANONICAL_HOST])
61- gpg_error_config_prefix=""
62- dnl --with-libgpg-error-prefix=PFX is the preferred name for this option,
63- dnl since that is consistent with how our three siblings use the directory/
64- dnl package name in --with-$dir_name-prefix=PFX.
65- AC_ARG_WITH(libgpg-error-prefix,
66- AC_HELP_STRING([--with-libgpg-error-prefix=PFX],
67- [prefix where GPG Error is installed (optional)]),
68- [gpg_error_config_prefix="$withval"])
69-
70- dnl Accept --with-gpg-error-prefix and make it work the same as
71- dnl --with-libgpg-error-prefix above, for backwards compatibility,
72- dnl but do not document this old, inconsistently-named option.
73- AC_ARG_WITH(gpg-error-prefix,,
74- [gpg_error_config_prefix="$withval"])
75+ min_gpg_error_version=ifelse([$1], ,0.0,$1)
76
77- if test x"${GPG_ERROR_CONFIG}" = x ; then
78- if test x"${gpg_error_config_prefix}" != x ; then
79- GPG_ERROR_CONFIG="${gpg_error_config_prefix}/bin/gpg-error-config"
80- else
81- case "${SYSROOT}" in
82- /*)
83- if test -x "${SYSROOT}/bin/gpg-error-config" ; then
84- GPG_ERROR_CONFIG="${SYSROOT}/bin/gpg-error-config"
85- fi
86- ;;
87- '')
88- ;;
89- *)
90- AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.])
91- ;;
92- esac
93- fi
94- fi
95+ PKG_CHECK_MODULES(GPG_ERROR, [gpg-error >= $min_gpg_error_version], [ok=yes], [ok=no])
96
97- AC_PATH_PROG(GPG_ERROR_CONFIG, gpg-error-config, no)
98- min_gpg_error_version=ifelse([$1], ,0.0,$1)
99- AC_MSG_CHECKING(for GPG Error - version >= $min_gpg_error_version)
100- ok=no
101- if test "$GPG_ERROR_CONFIG" != "no" \
102- && test -f "$GPG_ERROR_CONFIG" ; then
103- req_major=`echo $min_gpg_error_version | \
104- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
105- req_minor=`echo $min_gpg_error_version | \
106- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
107- gpg_error_config_version=`$GPG_ERROR_CONFIG $gpg_error_config_args --version`
108- major=`echo $gpg_error_config_version | \
109- sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
110- minor=`echo $gpg_error_config_version | \
111- sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
112- if test "$major" -gt "$req_major"; then
113- ok=yes
114- else
115- if test "$major" -eq "$req_major"; then
116- if test "$minor" -ge "$req_minor"; then
117- ok=yes
118- fi
119- fi
120- fi
121- fi
122 if test $ok = yes; then
123- GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG $gpg_error_config_args --cflags`
124- GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG $gpg_error_config_args --libs`
125- GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG $gpg_error_config_args --mt --cflags 2>/dev/null`
126- GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG $gpg_error_config_args --mt --libs 2>/dev/null`
127- AC_MSG_RESULT([yes ($gpg_error_config_version)])
128 ifelse([$2], , :, [$2])
129- gpg_error_config_host=`$GPG_ERROR_CONFIG $gpg_error_config_args --host 2>/dev/null || echo none`
130+ gpg_error_config_host=`$PKG_CONFIG --variable=host gpg-error`
131 if test x"$gpg_error_config_host" != xnone ; then
132 if test x"$gpg_error_config_host" != x"$host" ; then
133 AC_MSG_WARN([[
134@@ -107,11 +47,6 @@ AC_DEFUN([AM_PATH_GPG_ERROR],
135 fi
136 fi
137 else
138- GPG_ERROR_CFLAGS=""
139- GPG_ERROR_LIBS=""
140- GPG_ERROR_MT_CFLAGS=""
141- GPG_ERROR_MT_LIBS=""
142- AC_MSG_RESULT(no)
143 ifelse([$3], , :, [$3])
144 fi
145 AC_SUBST(GPG_ERROR_CFLAGS)
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800146diff --git a/src/gpg-error.pc.in b/src/gpg-error.pc.in
147new file mode 100644
148index 0000000..bc0b174
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500149--- /dev/null
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800150+++ b/src/gpg-error.pc.in
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500151@@ -0,0 +1,11 @@
152+prefix=@prefix@
153+exec_prefix=@exec_prefix@
154+libdir=@libdir@
155+includedir=@includedir@
156+host=@GPG_ERROR_CONFIG_HOST@
157+
158+Name: gpg-error
159+Description: a library that defines common error values for all GnuPG components
160+Version: @VERSION@
161+Libs: -L${libdir} -lgpg-error
162+Cflags: -I${includedir}
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800163--
1641.8.3.1
165