configure: misc tweaks to be more cross compiler friendly.
This commit is contained in:
parent
c50cbf03c7
commit
a517124eae
20
configure
vendored
20
configure
vendored
@ -181,21 +181,12 @@ echo "CFLAGS = -O2 -pthread" >>$CONFIG_MK
|
|||||||
if [ -n "$CFLAGS" ]; then
|
if [ -n "$CFLAGS" ]; then
|
||||||
echo "CFLAGS += $CFLAGS" >>$CONFIG_MK
|
echo "CFLAGS += $CFLAGS" >>$CONFIG_MK
|
||||||
fi
|
fi
|
||||||
# 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="$EPREFIX/include"
|
|
||||||
_LIBDIR="$LIBDIR"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "LDFLAGS = -L\$(TOPDIR)/lib -L${_LIBDIR}" >>$CONFIG_MK
|
echo "LDFLAGS = -L\$(TOPDIR)/lib" >>$CONFIG_MK
|
||||||
if [ -n "$LDFLAGS" ]; then
|
if [ -n "$LDFLAGS" ]; then
|
||||||
echo "LDFLAGS += $LDFLAGS" >>$CONFIG_MK
|
echo "LDFLAGS += $LDFLAGS" >>$CONFIG_MK
|
||||||
fi
|
fi
|
||||||
echo "CPPFLAGS = -I. -I\$(TOPDIR) -I\$(TOPDIR)/include -I${_INCDIR}" >>$CONFIG_MK
|
echo "CPPFLAGS = -I. -I\$(TOPDIR) -I\$(TOPDIR)/include" >>$CONFIG_MK
|
||||||
echo "CPPFLAGS += -DHAVE_CONFIG_H" >>$CONFIG_MK
|
echo "CPPFLAGS += -DHAVE_CONFIG_H" >>$CONFIG_MK
|
||||||
echo "CPPFLAGS += -DXBPS_SYSCONF_PATH=\\\"${ETCDIR}\\\"" >>$CONFIG_MK
|
echo "CPPFLAGS += -DXBPS_SYSCONF_PATH=\\\"${ETCDIR}\\\"" >>$CONFIG_MK
|
||||||
echo "CPPFLAGS += -DXBPS_VERSION=\\\"${VERSION}\\\"" >>$CONFIG_MK
|
echo "CPPFLAGS += -DXBPS_VERSION=\\\"${VERSION}\\\"" >>$CONFIG_MK
|
||||||
@ -223,9 +214,7 @@ linux)
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
# Add CPPFLAGS/CFLAGS/LDFLAGS to CC for testing features
|
# Add CPPFLAGS/CFLAGS/LDFLAGS to CC for testing features
|
||||||
XCC="$CC `$SED -n -e 's/CPPLAGS+=*\(.*\)/\1/p' $CONFIG_MK`"
|
XCC="$CC $CFLAGS $CPPFLAGS $LDFLAGS"
|
||||||
XCC="$XCC `$SED -n -e 's/CFLAGS+=*\(.*\)/\1/p' $CONFIG_MK`"
|
|
||||||
XCC="$XCC `$SED -n -e 's/LDFLAGS+=*\(.*\)/\1/p' $CONFIG_MK`"
|
|
||||||
# Make sure to disable --as-needed for CC tests.
|
# Make sure to disable --as-needed for CC tests.
|
||||||
XCC="$XCC -Wl,--no-as-needed"
|
XCC="$XCC -Wl,--no-as-needed"
|
||||||
|
|
||||||
@ -327,14 +316,13 @@ fi
|
|||||||
func=vasprintf
|
func=vasprintf
|
||||||
printf "Checking for $func() ... "
|
printf "Checking for $func() ... "
|
||||||
cat <<EOF >_$func.c
|
cat <<EOF >_$func.c
|
||||||
#define _GNU_SOURCE
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
int main(void) {
|
int main(void) {
|
||||||
vasprintf(NULL, NULL, NULL);
|
vasprintf(NULL, NULL, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
if $XCC _$func.c -o _$func 2>/dev/null; then
|
if $XCC -D_GNU_SOURCE _$func.c -o _$func 2>/dev/null; then
|
||||||
echo yes.
|
echo yes.
|
||||||
echo "CPPFLAGS += -DHAVE_VASPRINTF" >> $CONFIG_MK
|
echo "CPPFLAGS += -DHAVE_VASPRINTF" >> $CONFIG_MK
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user