source: trunk/configure @ 5

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

Update 2005-11-18

File size: 3.7 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    --disable-gtk          Don't build the GTK+ GUI
14
15  Some influential environment variables:
16    CC          C compiler command (default "cc")
17    CFLAGS      C compiler flags (default "-g -Wall -W")
18
19EOF
20}
21
22openssl_test()
23{
24  cat > testconf.c << EOF
25  #include <stdio.h>
26  #include <openssl/sha.h>
27  int main()
28  {
29      SHA1( 0, 0, 0 );
30  }
31EOF
32  if [ -n "$PREFIX" ]; then
33    TMPFLAGS="-I$PREFIX/include -L$PREFIX/lib"
34  fi
35  if $CC $TMPFLAGS -o testconf testconf.c -lcrypto > /dev/null 2>&1
36  then
37    echo "OpenSSL: yes"
38    DEFINES="$DEFINES HAVE_OPENSSL"
39    LINKLIBS="$LINKLIBS -lcrypto"
40  else
41    echo "OpenSSL: no, using built-in SHA1 implementation"
42  fi
43  rm -f testconf.c testconf
44}
45
46gtk_test()
47{
48  cat > testconf.c << EOF
49  #include <gtk/gtk.h>
50  int main()
51  {
52    gtk_main();
53  }
54EOF
55  if $CC `pkg-config gtk+-2.0 --cflags --libs 2>/dev/null` -o testconf testconf.c
56  then
57    echo "GTK+: yes"
58    GTK=yes
59    GTKCCFLAGS=`pkg-config gtk+-2.0 --cflags`
60    GTKLINKLIBS=`pkg-config gtk+-2.0 --libs`
61  else
62    echo "GTK+: no"
63    GTK=no
64  fi
65  rm -f testconf.c testconf
66}
67
68#
69# Defaults settings
70#
71CC="${CC-cc}"
72CFLAGS="${CFLAGS--g -Wall -W}"
73# For > 2 GB files
74DEFINES="_FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE"
75# For asprintf
76DEFINES="$DEFINES _GNU_SOURCE"
77openssl_disable=0
78gtk_disable=0
79GTK=no
80GTKCCFLAGS=
81GTKLINKLIBS=
82
83#
84# Parse options
85#
86while [ $# -ne 0 ]; do
87  param=`expr "opt$1" : 'opt[^=]*=\(.*\)'`
88
89  case "x$1" in
90    x--disable-openssl)
91      openssl_disable="1";
92      ;;
93    x--openssl-prefix=*)
94      OPENSSL_PREFIX="$param";
95      ;;
96    x--disable-gtk)
97      gtk_disable="1";
98      ;;
99    x--help)
100      usage
101      exit 0
102      ;;
103  esac
104  shift
105done
106
107#
108# System-specific flags
109#
110SYSTEM=`uname -s`
111case $SYSTEM in
112  BeOS)
113    DEFINES="$DEFINES SYS_BEOS"
114
115    RELEASE=`uname -r`
116    case $RELEASE in
117      6.0|5.0.4) # Zeta or R5 / BONE beta 7
118        SYSTEM="$SYSTEM / BONE"
119        LINKLIBS="$LINKLIBS -lbind -lsocket"
120        ;;
121      5.0*)      # R5 / net_server
122        SYSTEM="$SYSTEM / net_server"
123        DEFINES="$DEFINES BEOS_NETSERVER"
124        LINKLIBS="$LINKLIBS -lnet"
125        ;;
126      *)
127        echo "Unsupported BeOS version"
128        exit 1 ;;
129    esac
130    ;;
131
132  Darwin)
133    DEFINES="$DEFINES SYS_DARWIN"
134    LINKLIBS="$LINKLIBS -lpthread"
135    ;;
136
137  FreeBSD)
138    DEFINES="$DEFINES SYS_FREEBSD"
139    LINKLIBS="$LINKLIBS -pthread"
140    ;;
141
142  NetBSD)
143    DEFINES="$DEFINES SYS_NETBSD"
144    LINKLIBS="$LINKLIBS -lpthread"
145    ;;
146
147  Linux)
148    DEFINES="$DEFINES SYS_LINUX"
149    LINKLIBS="$LINKLIBS -lpthread"
150    ;;
151
152  *)
153    echo "Unsupported operating system"
154    exit 1 ;;
155esac
156echo "System:  $SYSTEM"
157
158# Check for GTK
159if pkg-config gtk+-2.0
160then
161    echo "GTK+: yes"
162    GTK=yes
163    GTKCCFLAGS=`pkg-config gtk+-2.0 --cflags`
164    GTKLINKLIBS=`pkg-config gtk+-2.0 --libs`
165else
166    echo "GTK+: no"
167    GTK=no
168fi
169
170#
171# OpenSSL settings
172#
173if [ ${openssl_disable} = 1 ]; then
174  echo "OpenSSL: no, using built-in SHA1 implementation"
175else
176    openssl_test
177fi
178
179#
180# GTK settings
181#
182if [ ${gtk_disable} = 1 ]; then
183  echo "GTK+: no"
184else
185    gtk_test
186fi
187
188#
189# Generate config.jam
190#
191rm -f config.jam
192cat > config.jam << EOF
193CC          = $CC ;
194LINK        = $CC ;
195CCFLAGS     = $CFLAGS ;
196DEFINES     = $DEFINES ;
197LINKLIBS    = $LINKLIBS ;
198GTK         = $GTK ;
199GTKCCFLAGS  = $GTKCCFLAGS ;
200GTKLINKLIBS = $GTKLINKLIBS ;
201EOF
202if [ -n "$OPENSSL_PREFIX" ]; then
203cat >> config.jam << EOF
204HDRS       += $OPENSSL_PREFIX/include ;
205LINKFLAGS  += -L$OPENSSL_PREFIX/lib ;
206EOF
207fi
208
209echo
210echo "To build Transmission, run 'jam'."
Note: See TracBrowser for help on using the repository browser.