aboutsummaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorIngo Klöcker <[email protected]>2022-08-22 17:09:54 +0000
committerIngo Klöcker <[email protected]>2022-08-22 17:09:54 +0000
commit1522813888257aafb6d108b49fb7b24005d2693a (patch)
treebbbc48f69db01ba48195b0c8ec8102f9dbbf8692 /configure.ac
parentbuild: Update ax_cxx_compile_stdcxx macro (diff)
downloadgpgme-1522813888257aafb6d108b49fb7b24005d2693a.tar.gz
gpgme-1522813888257aafb6d108b49fb7b24005d2693a.zip
build: Omit -I... and -L... for standard paths in pkgconfig file
* configure.ac (GPGME_CONFIG_CFLAGS): Prefix with -I${includedir} for non-standard include paths. (GPGME_CONFIG_LIBS): Prefix with -L${libdir} for non-standard library paths. * src/gpgme.pc.in (Cflags): Remove hard-coded -I${includedir}. (Libs): Remove hard-coded -L${libdir}. -- This helps prevent problems when building/linking something that depends on gpgme (installed in standard path) and some other library (installed in a standard path and a custom path). See T6136 for related changes in libgpg-error.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac36
1 files changed, 35 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index aed0762f..e7fe04a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -850,11 +850,45 @@ AH_BOTTOM([
])
-# Substitution used for gpgme-config
+# Substitution used for gpgme-config and gpgme.pc
GPGME_CONFIG_LIBS="-lgpgme"
GPGME_CONFIG_CFLAGS=""
GPGME_CONFIG_HOST="$host"
GPGME_CONFIG_AVAIL_LANG="$enabled_languages"
+
+case "$includedir" in
+ /usr/include|/include) ;;
+ '${prefix}/include')
+ if test "$prefix" != / -a "$prefix" != /usr; then
+ if test -z "$GPGME_CONFIG_CFLAGS"; then
+ GPGME_CONFIG_CFLAGS="-I\${includedir}"
+ else
+ GPGME_CONFIG_CFLAGS="-I\${includedir} $GPGME_CONFIG_CFLAGS"
+ fi
+ fi
+ ;;
+ *)
+ if test -z "$GPGME_CONFIG_CFLAGS"; then
+ GPGME_CONFIG_CFLAGS="-I\${includedir}"
+ else
+ GPGME_CONFIG_CFLAGS="-I\${includedir} $GPGME_CONFIG_CFLAGS"
+ fi
+ ;;
+esac
+case "$libdir" in
+ /usr/lib|/usr/lib64|/lib|/lib64) ;;
+ '${exec_prefix}/lib'|'${exec_prefix}/lib64')
+ if test "$exec_prefix" = "NONE"; then
+ if test "$prefix" != / -a "$prefix" != /usr; then
+ GPGME_CONFIG_LIBS="-L\${libdir} $GPGME_CONFIG_LIBS"
+ fi
+ elif test "$exec_prefix" != / -a "$exec_prefix" != /usr; then
+ GPGME_CONFIG_LIBS="-L\${libdir} $GPGME_CONFIG_LIBS"
+ fi
+ ;;
+ *) GPGME_CONFIG_LIBS="-L\${libdir} $GPGME_CONFIG_LIBS" ;;
+esac
+
AC_SUBST(GPGME_CONFIG_API_VERSION)
AC_SUBST(GPGME_CONFIG_LIBS)
AC_SUBST(GPGME_CONFIG_CFLAGS)