]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
force pkg-config to only use --prefix when cross-compiling
authorHans-Christoph Steiner <hans@eds.org>
Tue, 29 Oct 2019 20:13:56 +0000 (21:13 +0100)
committerteor <teor@torproject.org>
Tue, 5 Nov 2019 05:45:25 +0000 (15:45 +1000)
The current pkg-config setup has no sense of whether it is cross-compiling,
so it will detect things on the build system that are not present or are
wrong for the host system.  This forces the cross-compiling build to only
look for pkg-config .pc files in --prefix.

A version of this has been the setup for many years with the Android builds.

Fixes #32191

Signed-off-by: Hans-Christoph Steiner <hans@eds.org>
changes/ticket32191 [new file with mode: 0644]
configure.ac

diff --git a/changes/ticket32191 b/changes/ticket32191
new file mode 100644 (file)
index 0000000..65e919f
--- /dev/null
@@ -0,0 +1,3 @@
+  o Minor features (build system):
+    - force pkg-config to only use --prefix when cross-compiling.
+      Closes ticket 32191.
index 0e9bfe1f6b0c7340d4b848191d2a2cc2898e5c8b..ece831d5bda6948b1e28cf8cb43ed7e6e656ed2c 100644 (file)
@@ -37,6 +37,16 @@ else
     pkg_config_user_action="check the PKG_CONFIG_PATH environment variable"
 fi
 
+if test "x$PKG_CONFIG_PATH" = "x" && test "x$prefix" != "xNONE" && test "$host" != "$build"; then
+   export PKG_CONFIG_PATH=$prefix/lib/pkgconfig
+   AC_MSG_NOTICE([set PKG_CONFIG_PATH=$PKG_CONFIG_PATH to support cross-compiling])
+   if test -f "$PKG_CONFIG_PATH/libevent.pc"; then
+       echo "checking for $PKG_CONFIG_PATH/libevent.pc... yes"
+   else
+       AC_MSG_ERROR([$PKG_CONFIG_PATH/libevent.pc not found!])
+   fi
+fi
+
 AC_ARG_ENABLE(openbsd-malloc,
    AS_HELP_STRING(--enable-openbsd-malloc, [use malloc code from OpenBSD.  Linux only. Deprecated: see --with-malloc]))
 AC_ARG_ENABLE(static-openssl,