+# Chose appropriate suffix for libraries
+case $targetos in
+ Darwin)
+ LIBSUF=".dylib"
+ if [ "$targetarch" = "" ]
+ then
+ sysctl -a hw | grep "x86_64: 1" > /dev/null
+ [ "$?" = "0" ] && targetarch="amd64"
+ fi
+ ;;
+ Linux|FreeBSD|NetBSD)
+ LIBSUF=".so"
+ ;;
+ MINGW32_NT-*|MinGW|mingw)
+ targetos="MinGW"
+ LIBSUF=".dll"
+ ;;
+ *)
+ LIBSUF=".so"
+ ;;
+esac
+export LIBSUF
+
+# Determine if we are compiling for 64-bit Intel architecture
+[ "$targetarch" = "" ] && targetarch=$(uname -m)
+[ "$targetarch" = "amd64" -o "$targetarch" = "x86_64" ] && amd64=true
+