source: trunk/configure @ 11

Last change on this file since 11 was 10, checked in by root, 17 years ago

Update 2005-12-01

File size: 3.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    --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  if pkg-config gtk+-2.0 > /dev/null 2>&1
49  then
50    if expr `pkg-config --modversion gtk+-2.0` '>=' 2.6.0 > /dev/null 2>&1
51    then
52      cat > testconf.c << EOF
53      #include <gtk/gtk.h>
54      int main()
55      {
56        gtk_main();
57      }
58EOF
59      if $CC `pkg-config gtk+-2.0 --cflags --libs` -o testconf testconf.c > /dev/null 2>&1
60      then
61        echo "GTK+:    yes"
62        GTK=yes
63        GTKCCFLAGS=`pkg-config gtk+-2.0 --cflags`
64        GTKLINKLIBS=`pkg-config gtk+-2.0 --libs`
65      else
66        echo "GTK+:    no"
67        GTK=no
68      fi
69      rm -f testconf.c testconf
70    else
71      echo "GTK+:    no (2.6.0 or later is required)"
72      GTK=no
73    fi
74  else
75    echo "GTK+:    no"
76    GTK=no
77  fi
78}
79
80#
81# Defaults settings
82#
83CC="${CC-cc}"
84CFLAGS="${CFLAGS--g -Wall -W}"
85# For > 2 GB files
86DEFINES="_FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE"
87# For asprintf
88DEFINES="$DEFINES _GNU_SOURCE"
89openssl_disable=0
90gtk_disable=0
91GTK=no
92GTKCCFLAGS=
93GTKLINKLIBS=
94
95#
96# Parse options
97#
98while [ $# -ne 0 ]; do
99  param=`expr "opt$1" : 'opt[^=]*=\(.*\)'`
100
101  case "x$1" in
102    x--disable-openssl)
103      openssl_disable="1";
104      ;;
105    x--openssl-prefix=*)
106      OPENSSL_PREFIX="$param";
107      ;;
108    x--disable-gtk)
109      gtk_disable="1";
110      ;;
111    x--help)
112      usage
113      exit 0
114      ;;
115  esac
116  shift
117done
118
119#
120# System-specific flags
121#
122SYSTEM=`uname -s`
123case $SYSTEM in
124  BeOS)
125    DEFINES="$DEFINES SYS_BEOS"
126
127    RELEASE=`uname -r`
128    case $RELEASE in
129      6.0|5.0.4) # Zeta or R5 / BONE beta 7
130        SYSTEM="$SYSTEM / BONE"
131        LINKLIBS="$LINKLIBS -lbind -lsocket"
132        ;;
133      5.0*)      # R5 / net_server
134        SYSTEM="$SYSTEM / net_server"
135        DEFINES="$DEFINES BEOS_NETSERVER"
136        LINKLIBS="$LINKLIBS -lnet"
137        ;;
138      *)
139        echo "Unsupported BeOS version"
140        exit 1 ;;
141    esac
142    ;;
143
144  Darwin)
145    DEFINES="$DEFINES SYS_DARWIN"
146    LINKLIBS="$LINKLIBS -lpthread"
147    ;;
148
149  FreeBSD)
150    DEFINES="$DEFINES SYS_FREEBSD"
151    LINKLIBS="$LINKLIBS -pthread"
152    ;;
153
154  NetBSD)
155    DEFINES="$DEFINES SYS_NETBSD"
156    LINKLIBS="$LINKLIBS -lpthread"
157    ;;
158
159  Linux)
160    DEFINES="$DEFINES SYS_LINUX"
161    LINKLIBS="$LINKLIBS -lpthread"
162    ;;
163
164  *)
165    echo "Unsupported operating system"
166    exit 1 ;;
167esac
168echo "System:  $SYSTEM"
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.