Skip to content

Commit

Permalink
buildsys: automatically select correct PKG_CONFIG_PATH on Solaris
Browse files Browse the repository at this point in the history
For 32-bit builds, make sure that, if /usr/lib/amd64/pkgconfig is in the
path, we put /usr/lib/pkgconfig before it, so that we find the .pc files
for 32-bit versions of packages.

For 64-bit builds, make sure that, if /usr/lib/pkgconfig is in the path,
we put /usr/lib/amd64/pkgconfig before it and, if it's not in the path,
we have /usr/lib/amd64/pkgconfig at the end of the path, so that we find
the .pc files for 64-bit versions of packages.

Original patch by Guy Harris <gharris@sonic.net>.

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
  • Loading branch information
zyv committed Oct 20, 2024
1 parent b407fb0 commit 108c4f7
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,61 @@ aux*)
;;
esac

# Solaris pkg-config is annoying. For at least one package (D-Bus, I'm
# looking at *you*!), there are separate include files for 32-bit and
# 64-bit builds (I guess using "unsigned long long" as a 64-bit integer
# type on a 64-bit build is like crossing the beams or something), and
# there are two separate .pc files, so if we're doing a 32-bit build we
# should make sure we look in /usr/lib/pkgconfig for .pc files and if
# we're doing a 64-bit build we should make sure we look in
# /usr/lib/amd64/pkgconfig for .pc files.
#
case "$host_os" in
solaris*)
if test "$ac_cv_sizeof_void_p" -eq 8; then
#
# 64-bit build. If the path is empty, set it to
# /usr/lib/amd64/pkgconfig; otherwise, if
# /usr/lib/pkgconfig appears in the path, prepend
# /usr/lib/amd64/pkgconfig to it; otherwise, put
# /usr/lib/amd64/pkgconfig at the end.
#
if test -z "$PKG_CONFIG_PATH"; then
#
# Not set, or empty. Set it to
# /usr/lib/amd64/pkgconfig.
#
PKG_CONFIG_PATH=/usr/lib/amd64/pkgconfig
elif test ! -z `echo "$PKG_CONFIG_PATH" | grep "/usr/lib/pkgconfig`; then
#
# It contains /usr/lib/pkgconfig. Prepend
# /usr/lib/amd64/pkgconfig to /usr/lib/pkgconfig.
#
PKG_CONFIG_PATH=`echo "$PKG_CONFIG_PATH" | sed "s;/usr/lib/pkgconfig;/usr/lib/amd64/pkgconfig:/usr/lib/pkgconfig;"`
else
#
# Not empty, but doesn't contain /usr/lib/pkgconfig.
# Append /usr/lib/amd64/pkgconfig to it.
#
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/lib/amd64/pkgconfig"
fi
export PKG_CONFIG_PATH
elif test "$ac_cv_sizeof_void_p" -eq 4; then
#
# 32-bit build. If /usr/amd64/lib/pkgconfig appears
# in the path, prepend /usr/lib/pkgconfig to it.
#
if test ! -z `echo "$PKG_CONFIG_PATH" | grep "/usr/lib/amd64/pkgconfig`; then
#
# It contains /usr/lib/amd64/pkgconfig. Prepend
# /usr/lib/pkgconfig to /usr/lib/amd64/pkgconfig.
#
PKG_CONFIG_PATH=`echo "$PKG_CONFIG_PATH" | sed "s;/usr/lib/amd64/pkgconfig;/usr/lib/pkgconfig:/usr/lib/amd64/pkgconfig;"`
export PKG_CONFIG_PATH
fi
fi
esac

dnl If running under AIX, AC_AIX does not tell us that
AC_MSG_CHECKING([for AIX defines])
AC_EGREP_CPP([yes],
Expand Down

0 comments on commit 108c4f7

Please sign in to comment.