changeset 2528:903fa08b254c draft

Allow the use of libmd in static or /usr builds
author Roy Marples <roy@marples.name>
date Thu, 05 Jun 2014 17:42:21 +0000
parents 0e86e8cd8063
children eddad85c5804
files configure
diffstat 1 files changed, 21 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Thu Jun 05 14:24:21 2014 +0000
+++ b/configure	Thu Jun 05 17:42:21 2014 +0000
@@ -302,6 +302,11 @@
 	echo "LDFLAGS+=	-Wl,-rpath=${LIBDIR}" >>$CONFIG_MK
 fi
 
+if [ -z "$PREFIX" -o "$PREFIX" = / ]; then
+	ALLOW_USR_LIBS=false
+else
+	ALLOW_USR_LIBS=true
+fi
 case "$OS" in
 linux*|sunos*) ;;
 *)
@@ -310,6 +315,7 @@
 	then
 		echo "Forcing a static build for $OS and \$PREFIX of /"
 		STATIC=yes
+		ALLOW_USR_LIBS=true
 	fi
 	;;
 esac
@@ -786,7 +792,11 @@
 }
 EOF
 	# We only want to link to libmd if it exists in /lib
-	set -- $(ls /lib/libmd.so.* 2>/dev/null)
+	if $ALLOW_USR_LIBS; then
+		set -- /
+	else
+		set -- $(ls /lib/libmd.so.* 2>/dev/null)
+	fi
 	if $XCC _md5.c -o _md5 2>/dev/null; then
 		MD5=yes
 	elif [ -e "$1" ] && $XCC _md5.c -lmd -o _md5 2>/dev/null; then
@@ -837,7 +847,11 @@
 }
 EOF
 	# We only want to link to libmd if it exists in /lib
-	set -- $(ls /lib/libmd.so.* 2>/dev/null)
+	if $ALLOW_USR_LIBS; then
+		set -- /
+	else
+		set -- $(ls /lib/libmd.so.* 2>/dev/null)
+	fi
 	if $XCC _sha256.c -o _sha256 2>/dev/null; then
 		SHA2=yes
 	elif [ -e "$1" ] && $XCC _sha256.c -lmd -o _sha256 2>/dev/null; then
@@ -864,7 +878,11 @@
 }
 EOF
 		# We only want to link to libmd if it exists in /lib
-		set -- $(ls /lib/libmd.so.* 2>/dev/null)
+		if $ALLOW_USR_LIBS; then
+			set -- /
+		else
+			set -- $(ls /lib/libmd.so.* 2>/dev/null)
+		fi
 		if $XCC	_sha256.c -o _sha256 2>/dev/null; then
 			SHA2=yes
 			SHA2_RENAMED=yes