1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 09:13:06 +00:00
transmission/configure

243 lines
4.5 KiB
Text
Raw Normal View History

2006-01-12 17:43:21 +00:00
#! /bin/sh
2006-01-12 18:20:48 +00:00
#
# Functions
#
usage()
{
cat << EOF
OpenSSL options:
--disable-openssl Disable OpenSSL, use built-in SHA1 implementation
--openssl-prefix=PATH Location of OpenSSL headers and library
2006-01-12 18:32:29 +00:00
--disable-gtk Don't build the GTK+ GUI
2006-01-12 18:20:48 +00:00
Some influential environment variables:
CC C compiler command (default "cc")
CFLAGS C compiler flags (default "-g -Wall -W")
EOF
}
openssl_test()
{
cat > testconf.c << EOF
#include <stdio.h>
#include <openssl/sha.h>
int main()
{
SHA1( 0, 0, 0 );
}
EOF
if [ -n "$PREFIX" ]; then
TMPFLAGS="-I$PREFIX/include -L$PREFIX/lib"
fi
if $CC $TMPFLAGS -o testconf testconf.c -lcrypto > /dev/null 2>&1
then
echo "OpenSSL: yes"
DEFINES="$DEFINES HAVE_OPENSSL"
LINKLIBS="$LINKLIBS -lcrypto"
else
echo "OpenSSL: no, using built-in SHA1 implementation"
fi
rm -f testconf.c testconf
}
2006-01-12 18:32:29 +00:00
gtk_test()
{
2006-01-12 18:33:20 +00:00
if pkg-config gtk+-2.0 > /dev/null 2>&1
2006-01-12 18:32:29 +00:00
then
2006-01-12 18:45:41 +00:00
if expr `pkg-config --modversion gtk+-2.0` '>=' 2.6.0 > /dev/null 2>&1
2006-01-12 18:33:20 +00:00
then
2006-01-12 18:45:41 +00:00
cat > testconf.c << EOF
#include <gtk/gtk.h>
int main()
{
gtk_main();
}
EOF
if $CC `pkg-config gtk+-2.0 --cflags --libs` -o testconf testconf.c > /dev/null 2>&1
then
echo "GTK+: yes"
GTK=yes
GTKCCFLAGS=`pkg-config gtk+-2.0 --cflags`
GTKLINKLIBS=`pkg-config gtk+-2.0 --libs`
else
echo "GTK+: no"
GTK=no
fi
rm -f testconf.c testconf
2006-01-12 18:33:20 +00:00
else
2006-01-12 18:45:41 +00:00
echo "GTK+: no (2.6.0 or later is required)"
2006-01-12 18:33:20 +00:00
GTK=no
fi
2006-01-12 18:32:29 +00:00
else
2006-01-12 18:33:20 +00:00
echo "GTK+: no"
2006-01-12 18:32:29 +00:00
GTK=no
fi
}
2006-01-12 18:20:48 +00:00
#
# Defaults settings
#
CC="${CC-cc}"
CFLAGS="${CFLAGS--g -Wall -W}"
2006-01-12 17:43:21 +00:00
# For > 2 GB files
DEFINES="_FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE"
# For asprintf
DEFINES="$DEFINES _GNU_SOURCE"
2006-01-12 18:20:48 +00:00
openssl_disable=0
2006-01-12 18:32:29 +00:00
gtk_disable=0
GTK=no
GTKCCFLAGS=
GTKLINKLIBS=
2006-01-12 18:20:48 +00:00
#
# Parse options
#
while [ $# -ne 0 ]; do
param=`expr "opt$1" : 'opt[^=]*=\(.*\)'`
case "x$1" in
x--disable-openssl)
openssl_disable="1";
;;
x--openssl-prefix=*)
OPENSSL_PREFIX="$param";
;;
2006-01-12 18:32:29 +00:00
x--disable-gtk)
gtk_disable="1";
;;
2006-01-12 18:20:48 +00:00
x--help)
usage
exit 0
;;
esac
shift
done
2006-01-12 17:43:21 +00:00
2006-01-12 18:20:48 +00:00
#
2006-01-12 17:43:21 +00:00
# System-specific flags
2006-01-12 18:20:48 +00:00
#
2006-01-12 17:43:21 +00:00
SYSTEM=`uname -s`
case $SYSTEM in
BeOS)
DEFINES="$DEFINES SYS_BEOS"
2006-01-12 18:52:15 +00:00
CC="gcc"
MACHINE=`uname -m`
case $MACHINE in
BePC) # BeOS on x86
CPU="x86"
;;
*)
CPU="ppc"
;;
esac
SYSTEM="$SYSTEM / $CPU"
2006-01-12 17:43:21 +00:00
RELEASE=`uname -r`
case $RELEASE in
2006-01-12 19:00:04 +00:00
6.0*|5.0.4) # Zeta or R5 / BONE beta 7
2006-01-12 17:43:21 +00:00
SYSTEM="$SYSTEM / BONE"
LINKLIBS="$LINKLIBS -lbind -lsocket"
;;
5.0*) # R5 / net_server
SYSTEM="$SYSTEM / net_server"
DEFINES="$DEFINES BEOS_NETSERVER"
LINKLIBS="$LINKLIBS -lnet"
;;
*)
echo "Unsupported BeOS version"
2006-01-12 18:52:15 +00:00
exit 1
;;
2006-01-12 17:43:21 +00:00
esac
;;
Darwin)
DEFINES="$DEFINES SYS_DARWIN"
LINKLIBS="$LINKLIBS -lpthread"
;;
FreeBSD)
DEFINES="$DEFINES SYS_FREEBSD"
LINKLIBS="$LINKLIBS -pthread -lm"
2006-01-12 17:43:21 +00:00
;;
NetBSD)
DEFINES="$DEFINES SYS_NETBSD"
LINKLIBS="$LINKLIBS -lpthread -lm"
2006-01-12 17:43:21 +00:00
;;
Linux)
DEFINES="$DEFINES SYS_LINUX"
2006-01-30 06:59:16 +00:00
LINKLIBS="$LINKLIBS -lpthread -lm"
2006-01-12 17:43:21 +00:00
;;
*)
echo "Unsupported operating system"
exit 1 ;;
esac
echo "System: $SYSTEM"
#
# Mac OS X check for the Universal SDK
#
if [ $SYSTEM = Darwin -a ! -d /Developer/SDKs/MacOSX10.4u.sdk ]; then
echo
echo "You need to install the Universal SDK in order to build Transmission:"
echo " Get your Xcode CD or package"
echo " Restart the install"
echo " When it gets to \"Installation Type\", select \"Customize\""
echo " Select \"Mac OS X 10.4 (Universal) SDL\" under \"Cross Development\""
echo " Finish the install."
exit 1
fi
2006-01-12 18:20:48 +00:00
#
# OpenSSL settings
#
if [ ${openssl_disable} = 1 ]; then
2006-01-12 17:43:21 +00:00
echo "OpenSSL: no, using built-in SHA1 implementation"
2006-01-12 18:20:48 +00:00
else
openssl_test
2006-01-12 17:43:21 +00:00
fi
2006-01-12 18:32:29 +00:00
#
# GTK settings
#
if [ ${gtk_disable} = 1 ]; then
2006-01-12 18:33:20 +00:00
echo "GTK+: no"
2006-01-12 18:32:29 +00:00
else
gtk_test
fi
2006-01-12 18:20:48 +00:00
#
2006-01-12 17:43:21 +00:00
# Generate config.jam
2006-01-12 18:20:48 +00:00
#
2006-01-12 17:43:21 +00:00
rm -f config.jam
2006-01-12 18:20:48 +00:00
cat > config.jam << EOF
2006-01-12 18:32:29 +00:00
CC = $CC ;
LINK = $CC ;
CCFLAGS = $CFLAGS ;
DEFINES = $DEFINES ;
LINKLIBS = $LINKLIBS ;
GTK = $GTK ;
GTKCCFLAGS = $GTKCCFLAGS ;
GTKLINKLIBS = $GTKLINKLIBS ;
2006-01-12 17:43:21 +00:00
EOF
2006-01-12 18:20:48 +00:00
if [ -n "$OPENSSL_PREFIX" ]; then
cat >> config.jam << EOF
2006-01-12 18:32:29 +00:00
HDRS += $OPENSSL_PREFIX/include ;
LINKFLAGS += -L$OPENSSL_PREFIX/lib ;
2006-01-12 18:20:48 +00:00
EOF
fi
2006-01-12 18:52:15 +00:00
if [ -n "$CPU" ]; then
cat >> config.jam << EOF
CPU = $CPU ;
EOF
fi
2006-01-12 17:43:21 +00:00
echo
echo "To build Transmission, run 'jam'."