From f5bbaba3b2015f039221945431f98027cb3d2d49 Mon Sep 17 00:00:00 2001 From: "Guillermo A. Amaral" Date: Sun, 30 Aug 2015 15:22:58 -0700 Subject: Improved cross compiler support. * Added a configure option for sysroot. * Prevent pkgconfig environment variables to be clobbered. * Prevent PATH environment variable pollution. * Backward compatible. Signed-off-by: Guillermo A. Amaral --- configure | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'configure') diff --git a/configure b/configure index 921c9b49..5a0527df 100755 --- a/configure +++ b/configure @@ -22,6 +22,7 @@ pidfile='/var/run/bitlbee.pid' ipcsocket='' pcdir='$prefix/lib/pkgconfig' systemlibdirs="/lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib" +sysroot='' # Set these to default-on to let it be overriden by either the user or purple # @@ -148,6 +149,7 @@ Option Description Default --target=... Cross compilation target same as host +--sysroot=... Cross compilation sysroot $sysroot EOF exit; fi @@ -239,12 +241,33 @@ EOF if [ -n "$target" ]; then - PKG_CONFIG_LIBDIR=/usr/$target/lib/pkgconfig - export PKG_CONFIG_LIBDIR - PATH=/usr/$target/bin:$PATH + # prepend sysroot to system lib dirs + + systemlibdirs_cross='' + for i in $systemlibdirs; do + systemlibdirs_cross="$systemlibdirs_cross $sysroot$i" + done + systemlibdirs=$systemlibdirs_cross + unset systemlibdirs_cross + + # backward compatibility + + if [ -z "$PKG_CONFIG_LIBDIR" ]; then + PKG_CONFIG_LIBDIR=/usr/$target/lib/pkgconfig + export PKG_CONFIG_LIBDIR + fi + + if [ -d /usr/$target/bin ]; then + PATH=/usr/$target/bin:$PATH + fi + + if [ -d /usr/$target/lib ]; then + systemlibdirs="$systemlibdirs /usr/$target/lib" + fi + CC=$target-cc LD=$target-ld - systemlibdirs="/usr/$target/lib" + STRIP=$target-strip fi if [ "$asan" = "1" ]; then -- cgit v1.2.3