source: trunk/configure.ac @ 5673

Last change on this file since 5673 was 5673, checked in by charles, 13 years ago

#377: preliminary https support. this commit probably breaks mac and cli and is not for the faint of heart.

File size: 8.9 KB
Line 
1AC_INIT([transmission],[1.11Z],[http://trac.transmissionbt.com/newticket])
2PEERID_PREFIX="-TR111Z-"
3USERAGENT_PREFIX="1.11+"
4AC_SUBST(PEERID_PREFIX,[$PEERID_PREFIX])
5AC_SUBST(USERAGENT_PREFIX,[$USERAGENT_PREFIX])
6
7AC_PREREQ(2.54)
8dnl AM_CONFIG_HEADER(config.h)
9AC_CONFIG_SRCDIR(libtransmission/transmission.h)
10AM_INIT_AUTOMAKE([1.9 tar-ustar])
11AC_PROG_LIBTOOL
12
13CURL_MINIMUM=7.16.0
14GIO_MINIMUM=2.15.5
15GLIB_MINIMUM=2.6.0
16GTK_MINIMUM=2.6.0
17WX_MINIMUM=2.6.0
18LIBNOTIFY_MINIMUM=0.4.4
19DBUS_GLIB_MINIMUM=0.70
20AC_SUBST(CURL_MINIMUM)
21AC_SUBST(GIO_MINIMUM)
22AC_SUBST(GLIB_MINIMUM)
23AC_SUBST(GTK_MINIMUM)
24AC_SUBST(WX_MINIMUM)
25AC_SUBST(LIBNOTIFY_MINIMUM)
26AC_SUBST(DBUS_GLIB_MINIMUM)
27
28AC_PROG_CC
29AC_PROG_CXX
30if test "x$GCC" = "xyes" ; then
31    CFLAGS="-g -Wall -W -O3 -funroll-loops"
32    CXXFLAGS="-g -Wall -W -O3 -funroll-loops"
33fi
34AC_HEADER_STDC
35AC_HEADER_TIME
36AC_CHECK_FUNCS([lrintf strlcpy strlcat daemon dirname basename])
37AC_CHECK_SIZEOF([void*])
38AC_PROG_INSTALL
39AC_PROG_MAKE_SET
40AC_PROG_RANLIB
41ACX_PTHREAD
42
43AC_SEARCH_LIBS([socket], [socket net])
44AC_SEARCH_LIBS([gethostbyname], [nsl bind])
45PKG_CHECK_MODULES(OPENSSL, [openssl >= 0.9.4])
46PKG_CHECK_MODULES(LIBCURL, [libcurl >= 0.9.4])
47
48AC_SYS_LARGEFILE
49
50dnl ----------------------------------------------------------------------------
51dnl
52dnl va_copy
53
54AC_MSG_CHECKING([how to copy va_list])
55AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);],
56    AC_MSG_RESULT([va_copy]),
57        [ AH_TEMPLATE([va_copy], [define if va_copy is not available])
58        AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);],
59        [ AC_DEFINE([va_copy], [__va_copy])
60        AC_MSG_RESULT([__va_copy])],
61        [ AC_DEFINE([va_copy(dest,src)], [memcpy(&dest,&src,sizeof(va_list))])
62        AC_MSG_RESULT([memcpy])]
63    )
64])
65
66
67dnl ----------------------------------------------------------------------------
68dnl
69dnl  libevent fun
70
71AC_CONFIG_SUBDIRS([third-party/libevent])
72AC_MSG_NOTICE([invoking libevent's configure script])
73LIBEVENT_CPPFLAGS="-I\$(top_srcdir)/third-party/libevent"
74AC_SUBST(LIBEVENT_CPPFLAGS)
75
76
77dnl ----------------------------------------------------------------------------
78dnl
79dnl  detection for the GTK+ client
80
81PKG_CHECK_MODULES(GTK,
82                  [gtk+-2.0 >= $GTK_MINIMUM
83                   glib-2.0 >= $GLIB_MINIMUM
84                   gmodule-2.0 >= $GLIB_MINIMUM
85                   gthread-2.0 >= $GLIB_MINIMUM],
86                  [have_gtk=yes],
87                  [have_gtk=no])
88AC_ARG_ENABLE([gtk],
89              AC_HELP_STRING([--enable-gtk],[build gtk client]),
90              [want_gtk=${enableval}],
91              [want_gtk=${have_gtk}])
92build_gtk=no
93if test "x$want_gtk" = "xyes" ; then
94    if test "x$have_gtk" = "xyes"; then
95      build_gtk=yes
96    else
97      AC_MSG_ERROR("GTK+ not found!")
98    fi
99fi
100AM_CONDITIONAL([BUILD_GTK],[test "x$build_gtk" = "xyes"])
101AC_SUBST(GTK_LIBS)
102AC_SUBST(GTK_CFLAGS)
103
104PKG_CHECK_MODULES([GIO],
105                  [gio-2.0 >= $GIO_MINIMUM],
106                  [use_gio=yes],
107                  [use_gio=no])
108AC_SUBST(GIO_LIBS)
109AC_SUBST(GIO_CFLAGS)
110if test "x$use_gio" = "xyes"; then
111    AC_DEFINE([HAVE_GIO], 1)
112fi
113
114PKG_CHECK_MODULES([LIBNOTIFY],
115                  [libnotify >= $LIBNOTIFY_MINIMUM],
116                  [have_libnotify=yes],
117                  [have_libnotify=no])
118AC_ARG_ENABLE([libnotify],
119              AS_HELP_STRING([--enable-libnotify],[enable notifications]),,
120              [enable_libnotify=yes])
121use_libnotify=no
122if test "x$enable_libnotify" = "xyes" ; then
123    if test "x$have_libnotify" = "xyes"; then
124        use_libnotify=yes
125        AC_SUBST(LIBNOTIFY_LIBS)
126        AC_SUBST(LIBNOTIFY_CFLAGS)
127        AC_DEFINE([HAVE_LIBNOTIFY], 1)
128    fi
129fi
130
131PKG_CHECK_MODULES([DBUS_GLIB],
132                  [dbus-glib-1 >= $DBUS_GLIB_MINIMUM],
133                  [use_dbus_glib=yes],
134                  [use_dbus_glib=no])
135AC_SUBST(DBUS_GLIB_LIBS)
136AC_SUBST(DBUS_GLIB_CFLAGS)
137if test "x$use_dbus_glib" = "xyes"; then
138    AC_DEFINE([HAVE_DBUS_GLIB], 1)
139fi
140
141AC_CHECK_HEADERS([libintl.h])
142IT_PROG_INTLTOOL([0.23],[no-xml])
143GETTEXT_PACKAGE=transmission
144AC_SUBST(GETTEXT_PACKAGE)
145AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
146AM_GLIB_GNU_GETTEXT
147transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
148AC_SUBST(transmissionlocaledir)
149
150
151dnl ----------------------------------------------------------------------------
152dnl
153dnl  wxWidgets detection for the wxWidgets client
154
155AM_OPTIONS_WXCONFIG
156AM_PATH_WXCONFIG($WX_MINIMUM,[have_wx=yes],[have_wx=no])
157AC_ARG_ENABLE([wx],
158              AC_HELP_STRING([--enable-wx],[build wxWidgets client]),
159              [want_wx=${enableval}],
160              [want_wx=no])
161build_wx=no
162if test "x$want_wx" = "xyes" ; then
163    if test "x$have_wx" = "xyes"; then
164      build_wx=yes
165    else
166      AC_MSG_ERROR("wxWidgets not found!")
167    fi
168fi
169AM_CONDITIONAL([BUILD_WX],[test "x$build_wx" = "xyes"])
170
171
172
173dnl ----------------------------------------------------------------------------
174dnl
175dnl  platform-specific stuff.
176
177AC_CANONICAL_HOST
178have_beos="no"
179have_darwin="no"
180have_msw="no"
181case $host_os in
182
183   *cygwin|*mingw32*)
184     have_msw="yes"
185     CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
186     CPPFLAGS="$CPPFLAGS -DWIN32 -DWIN32_LEAN_AND_MEAN"
187     LIBS="$LIBS -lshell32 -lws2_32"
188     transmissionlocaledir="locale"
189     if test -z "$host_alias"; then
190       hostaliaswindres=
191     else
192       hostaliaswindres="$host_alias-windres";
193     fi
194     AC_PATH_PROGS([WINDRES], [windres $hostaliaswindres $host_os-windres])
195     if test "x$WINDRES" = "x"; then
196       AC_MSG_ERROR([windres could not be found within your path.])
197     fi
198     AC_SUBST(WINDRES)
199     ;;
200
201  *beos*)
202    have_beos="yes"
203    RELEASE=`uname -r`
204    case $RELEASE in
205      6.*|5.0.4) # Zeta or R5 / BONE beta 7
206        ;;
207      5.0*)       # R5 / net_server
208        CPPFLAGS="$CPPFLAGS -DBEOS_NETSERVER"
209        ;;
210      *)
211        AC_MSG_ERROR("Unsupported BeOS version")
212        ;;
213    esac
214    GCCVER=`$CC -dumpversion`
215    case $GCCVER in
216      2.95.3*|3*|4*)
217        ;;
218      2.9*)
219        BEOS_OLDCC=yes
220        ;;
221      *)
222        AC_MSG_ERROR("Unsupported gcc version")
223        ;;
224    esac
225    ;;
226
227  *darwin*)
228    have_darwin="yes"
229    # Make sure the Universal SDK is installed
230    if test ! -d /Developer/SDKs/MacOSX10.4u.sdk; then
231      cat << EOF
232You need to install the Universal SDK in order to build Transmission:
233  Get your Xcode CD or package
234  Restart the install
235  When it gets to "Installation Type", select "Customize"
236  Select "Mac OS X 10.4 (Universal) SDK" under "Cross Development"
237  Finish the install.
238EOF
239      exit 1
240    fi
241    ;;
242
243esac
244
245AC_ARG_ENABLE([beos],
246              [AC_HELP_STRING([--enable-beos],[build OS X client])],
247              [build_beos=${enableval}],
248              [build_beos=${have_beos}])
249AM_CONDITIONAL([BUILD_BEOS],[test "x$build_beos" = "xyes"])
250
251AC_ARG_ENABLE([cli],
252              [AC_HELP_STRING([--enable-cli],[build command-line client])],
253              [build_cli=${enableval}],
254              [build_cli="yes"])
255AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
256
257AC_ARG_ENABLE([darwin],
258              [AC_HELP_STRING([--enable-darwin],[build OS X client])],
259              [build_darwin=${enableval}],
260              [build_darwin=${have_darwin}])
261AM_CONDITIONAL([BUILD_DARWIN],[test "x$build_darwin" = "xyes"])
262
263AC_ARG_ENABLE([daemon],
264              [AC_HELP_STRING([--enable-daemon],[build daemon])],
265              [build_daemon=${enableval}],
266              [build_daemon="yes"])
267AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
268
269
270if test "x$have_beos" = "xyes"; then
271    AC_DEFINE([HAVE_BEOS], 1)
272fi
273if test "x$have_darwin" = "xyes"; then
274    AC_DEFINE([HAVE_DARWIN], 1)
275fi
276if test "x$have_msw" = "xyes"; then
277    AC_DEFINE([HAVE_MSW], 1)
278fi
279
280
281dnl ----------------------------------------------------------------------------
282dnl
283dnl  Generate the output
284
285AC_CONFIG_FILES([Makefile
286                 transmission.spec
287                 beos/Makefile
288                 cli/Makefile
289                 daemon/Makefile
290                 libtransmission/Makefile
291                 third-party/Makefile
292                 third-party/miniupnp/Makefile
293                 third-party/libnatpmp/Makefile
294                 macosx/Makefile
295                 wx/Makefile
296                 wx/images/Makefile
297                 gtk/Makefile
298                 gtk/icons/Makefile
299                 po/Makefile.in])
300
301ac_configure_args="$ac_configure_args --enable-static --disable-shared -q"
302AC_OUTPUT
303
304echo "
305
306Configuration:
307
308        Source code location:       ${srcdir}
309        Compiler:                   ${CXX}
310        Build Command-Line client:  ${build_cli}
311        Build Daemon:               ${build_daemon}
312        Build BeOS client:          ${build_beos}
313        Build GTK+ client:          ${build_gtk}
314          ... gio support:          ${use_gio}
315          ... dbus-glib support:    ${use_dbus_glib}
316          ... libnotify support:    ${use_libnotify}
317        Build OS X client:          ${build_darwin}
318        Build wxWidgets client:     ${build_wx}
319
320"
Note: See TracBrowser for help on using the repository browser.