From a517124eae2bf714191249a681bc4d3e0976b210 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 3 Mar 2013 08:12:09 +0100 Subject: [PATCH] configure: misc tweaks to be more cross compiler friendly. --- configure | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/configure b/configure index a50301af..7fbf91ae 100755 --- a/configure +++ b/configure @@ -181,21 +181,12 @@ echo "CFLAGS = -O2 -pthread" >>$CONFIG_MK if [ -n "$CFLAGS" ]; then echo "CFLAGS += $CFLAGS" >>$CONFIG_MK 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 echo "LDFLAGS += $LDFLAGS" >>$CONFIG_MK 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 += -DXBPS_SYSCONF_PATH=\\\"${ETCDIR}\\\"" >>$CONFIG_MK echo "CPPFLAGS += -DXBPS_VERSION=\\\"${VERSION}\\\"" >>$CONFIG_MK @@ -223,9 +214,7 @@ linux) esac # Add CPPFLAGS/CFLAGS/LDFLAGS to CC for testing features -XCC="$CC `$SED -n -e 's/CPPLAGS+=*\(.*\)/\1/p' $CONFIG_MK`" -XCC="$XCC `$SED -n -e 's/CFLAGS+=*\(.*\)/\1/p' $CONFIG_MK`" -XCC="$XCC `$SED -n -e 's/LDFLAGS+=*\(.*\)/\1/p' $CONFIG_MK`" +XCC="$CC $CFLAGS $CPPFLAGS $LDFLAGS" # Make sure to disable --as-needed for CC tests. XCC="$XCC -Wl,--no-as-needed" @@ -327,14 +316,13 @@ fi func=vasprintf printf "Checking for $func() ... " cat <_$func.c -#define _GNU_SOURCE #include int main(void) { vasprintf(NULL, NULL, NULL); return 0; } 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 "CPPFLAGS += -DHAVE_VASPRINTF" >> $CONFIG_MK else