configure: use gcc --print-sysroot to behave correctly in cross builds.
This commit is contained in:
parent
d8769c4873
commit
e9e704d59a
3
NEWS
3
NEWS
@ -1,5 +1,8 @@
|
||||
xbps-0.21 (???):
|
||||
|
||||
* configure: don't link to libs in PREFIX/lib blindly; figure out
|
||||
sysroot dir with gcc compiler and use this for headers/libs.
|
||||
|
||||
* libxbps: workaround a bug (found by pancake) when updating a package
|
||||
that is being replaced by a virtual package.
|
||||
|
||||
|
15
configure
vendored
15
configure
vendored
@ -175,16 +175,27 @@ if [ -z "$CC" ]; then
|
||||
else
|
||||
echo "Using compiler $CC"
|
||||
fi
|
||||
|
||||
echo "CC = $CC" >>$CONFIG_MK
|
||||
echo "CFLAGS = -O2 -pthread" >>$CONFIG_MK
|
||||
if [ -n "$CFLAGS" ]; then
|
||||
echo "CFLAGS += $CFLAGS" >>$CONFIG_MK
|
||||
fi
|
||||
echo "LDFLAGS = -L\$(TOPDIR)/lib -L\$(LIBDIR)" >>$CONFIG_MK
|
||||
# Find out if we are cross compiling and use sysroot's value from gcc.
|
||||
_SYSROOT="$($CC --print-sysroot)"
|
||||
if [ -n "${_SYSROOT}" -a "${_SYSROOT}" != "" ]; then
|
||||
_INCDIR="${_SYSROOT}/include"
|
||||
_LIBDIR="${_SYSROOT}/lib"
|
||||
else
|
||||
_INCDIR="$PREFIX/include"
|
||||
_LIBDIR="$LIBDIR"
|
||||
fi
|
||||
|
||||
echo "LDFLAGS = -L\$(TOPDIR)/lib -L${_LIBDIR}" >>$CONFIG_MK
|
||||
if [ -n "$LDFLAGS" ]; then
|
||||
echo "LDFLAGS += $LDFLAGS" >>$CONFIG_MK
|
||||
fi
|
||||
echo "CPPFLAGS = -I. -I\$(TOPDIR) -I\$(TOPDIR)/include" >>$CONFIG_MK
|
||||
echo "CPPFLAGS = -I. -I\$(TOPDIR) -I\$(TOPDIR)/include -I${_INCDIR}" >>$CONFIG_MK
|
||||
echo "CPPFLAGS += -DHAVE_CONFIG_H" >>$CONFIG_MK
|
||||
echo "CPPFLAGS += -DXBPS_SYSCONF_PATH=\\\"${ETCDIR}\\\"" >>$CONFIG_MK
|
||||
echo "CPPFLAGS += -DXBPS_VERSION=\\\"${VERSION}\\\"" >>$CONFIG_MK
|
||||
|
Loading…
Reference in New Issue
Block a user