source: trunk/configure @ 2

Last change on this file since 2 was 2, checked in by root, 16 years ago

Update 2005-11-01

File size: 2.8 KB
Line 
1#! /bin/sh
2
3#
4# Functions
5#
6usage()
7{
8  cat << EOF
9
10  OpenSSL options:
11    --disable-openssl      Disable OpenSSL, use built-in SHA1 implementation
12    --openssl-prefix=PATH  Location of OpenSSL headers and library
13
14  Some influential environment variables:
15    CC          C compiler command (default "cc")
16    CFLAGS      C compiler flags (default "-g -Wall -W")
17
18EOF
19}
20
21openssl_test()
22{
23  cat > testconf.c << EOF
24  #include <stdio.h>
25  #include <openssl/sha.h>
26  int main()
27  {
28      SHA1( 0, 0, 0 );
29  }
30EOF
31  if [ -n "$PREFIX" ]; then
32    TMPFLAGS="-I$PREFIX/include -L$PREFIX/lib"
33  fi
34  if $CC $TMPFLAGS -o testconf testconf.c -lcrypto > /dev/null 2>&1
35  then
36    echo "OpenSSL: yes"
37    DEFINES="$DEFINES HAVE_OPENSSL"
38    LINKLIBS="$LINKLIBS -lcrypto"
39  else
40    echo "OpenSSL: no, using built-in SHA1 implementation"
41  fi
42  rm -f testconf.c testconf
43}
44
45#
46# Defaults settings
47#
48CC="${CC-cc}"
49CFLAGS="${CFLAGS--g -Wall -W}"
50# For > 2 GB files
51DEFINES="_FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE"
52# For asprintf
53DEFINES="$DEFINES _GNU_SOURCE"
54openssl_disable=0
55
56#
57# Parse options
58#
59while [ $# -ne 0 ]; do
60  param=`expr "opt$1" : 'opt[^=]*=\(.*\)'`
61
62  case "x$1" in
63    x--disable-openssl)
64      openssl_disable="1";
65      ;;
66    x--openssl-prefix=*)
67      OPENSSL_PREFIX="$param";
68      ;;
69    x--help)
70      usage
71      exit 0
72      ;;
73  esac
74  shift
75done
76
77#
78# System-specific flags
79#
80SYSTEM=`uname -s`
81case $SYSTEM in
82  BeOS)
83    DEFINES="$DEFINES SYS_BEOS"
84
85    RELEASE=`uname -r`
86    case $RELEASE in
87      6.0|5.0.4) # Zeta or R5 / BONE beta 7
88        SYSTEM="$SYSTEM / BONE"
89        LINKLIBS="$LINKLIBS -lbind -lsocket"
90        ;;
91      5.0*)      # R5 / net_server
92        SYSTEM="$SYSTEM / net_server"
93        DEFINES="$DEFINES BEOS_NETSERVER"
94        LINKLIBS="$LINKLIBS -lnet"
95        ;;
96      *)
97        echo "Unsupported BeOS version"
98        exit 1 ;;
99    esac
100    ;;
101
102  Darwin)
103    DEFINES="$DEFINES SYS_DARWIN"
104    LINKLIBS="$LINKLIBS -lpthread"
105    ;;
106
107  FreeBSD)
108    DEFINES="$DEFINES SYS_FREEBSD"
109    LINKLIBS="$LINKLIBS -pthread"
110    ;;
111
112  NetBSD)
113    DEFINES="$DEFINES SYS_NETBSD"
114    LINKLIBS="$LINKLIBS -lpthread"
115    ;;
116
117  Linux)
118    DEFINES="$DEFINES SYS_LINUX"
119    LINKLIBS="$LINKLIBS -lpthread"
120    ;;
121
122  *)
123    echo "Unsupported operating system"
124    exit 1 ;;
125esac
126echo "System:  $SYSTEM"
127
128#
129# OpenSSL settings
130#
131if [ ${openssl_disable} = 1 ]; then
132  echo "OpenSSL: no, using built-in SHA1 implementation"
133else
134    openssl_test
135fi
136
137#
138# Generate config.jam
139#
140rm -f config.jam
141cat > config.jam << EOF
142CC         = $CC ;
143LINK       = $CC ;
144CCFLAGS    = $CFLAGS ;
145DEFINES    = $DEFINES ;
146LINKLIBS   = $LINKLIBS ;
147EOF
148if [ -n "$OPENSSL_PREFIX" ]; then
149cat >> config.jam << EOF
150HDRS      += $OPENSSL_PREFIX/include ;
151LINKFLAGS += -L$OPENSSL_PREFIX/lib ;
152EOF
153fi
154
155echo
156echo "To build Transmission, run 'jam'."
Note: See TracBrowser for help on using the repository browser.