1
dnl convention: -TR MAJOR MINOR MAINT STATUS - (each a single char)
2
dnl STATUS: "X" for prerelease beta builds,
3
dnl "Z" for unsupported trunk builds,
4
dnl "0" for stable, supported releases
5
dnl these should be the only two lines you need to change
6
m4_define([user_agent_prefix],[1.92])
7
m4_define([peer_id_prefix],[-TR1920-])
9
AC_INIT([transmission],
11
[http://trac.transmissionbt.com/newticket])
12
AC_SUBST(USERAGENT_PREFIX,[user_agent_prefix])
13
AC_SUBST(PEERID_PREFIX,[peer_id_prefix])
15
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
17
AC_CONFIG_MACRO_DIR([m4])
19
dnl AM_CONFIG_HEADER(config.h)
20
AC_CONFIG_SRCDIR(libtransmission/transmission.h)
21
AM_INIT_AUTOMAKE([1.9 tar-ustar])
24
if test m4_substr(peer_id_prefix,6,1) = "0"; then
26
if test "x$GCC" = "xyes" ; then
27
CFLAGS="$CFLAGS -g -O3 "
28
CXXFLAGS="$CXXFLAGS -g -O3 "
30
CPPFLAGS="$CPPFLAGS -DNDEBUG"
33
if test "x$GCC" = "xyes" ; then
34
CFLAGS="$CFLAGS -g -O0"
35
CXXFLAGS="$CXXFLAGS -g -O0"
38
AM_CONDITIONAL(TR_UNSTABLE, test "x$supported_build" = "xno")
42
## MANDATORY for everything
46
AC_SUBST(CURL_MINIMUM)
47
LIBEVENT_MINIMUM=1.4.5
48
AC_SUBST(LIBEVENT_MINIUM)
50
AC_SUBST(OPENSSL_MINIMUM)
54
## MANDATORY for the GTK+ client
58
AC_SUBST(GLIB_MINIMUM)
64
## OPTIONAL for the GTK+ client
67
# play the XDG "download done" sound...
69
AC_SUBST(CANBERRA_MINIMUM)
70
# inhibit hibernation when a torrent is active...
71
DBUS_GLIB_MINIMUM=0.70
72
AC_SUBST(DBUS_GLIB_MINIMUM)
73
# register the GTK+ client as a magnet link handler...
75
AC_SUBST(GCONF2_MINIMUM)
76
# implement "watch" directories to use new .torrent files...
79
# pop up a "download done" notice...
80
LIBNOTIFY_MINIMUM=0.4.3
81
AC_SUBST(LIBNOTIFY_MINIMUM)
82
# create the tray icon with AppIndicator
83
LIBAPPINDICATOR_MINIMUM=0.0.11
84
AC_SUBST(LIBAPPINDICATOR_MINIMUM)
90
if test "x$GCC" = "xyes" ; then
92
CFLAGS="$CFLAGS -std=gnu99 -ggdb3 -Wall -W -Wpointer-arith -Wformat-security -Wcast-align -Wundef -Wcast-align -Wstrict-prototypes -Wmissing-declarations -Wmissing-format-attribute -Wredundant-decls -Wnested-externs -Wunused-parameter -Wwrite-strings"
94
dnl figure out gcc version
95
AC_MSG_CHECKING([gcc version])
96
GCC_VERSION=`$CC -dumpversion`
97
GCC_MAJOR=`echo $GCC_VERSION | cut -d . -f1`
98
GCC_MINOR=`echo $GCC_VERSION | cut -d . -f2`
99
GCC_VERSION_NUM=`(expr $GCC_MAJOR "*" 100 + $GCC_MINOR) 2>/dev/null`
101
AC_MSG_RESULT($GCC_VERSION)
102
if test $GCC_VERSION_NUM -ge 304; then
103
dnl these were added in 3.4
104
CFLAGS="$CFLAGS -Wextra -Wdeclaration-after-statement -Winit-self"
111
AC_CHECK_FUNCS([pread pwrite lrintf strlcpy daemon dirname basename strcasecmp localtime_r fallocate64 posix_fallocate memmem strtold syslog valloc getpagesize posix_memalign])
116
if test "x$ac_cv_func_strtold" != "xyes" ; then
117
CPPFLAGS="$CPPFLAGS -Dstrtold=strtod"
120
AC_SEARCH_LIBS(cos, [m])
121
AC_SEARCH_LIBS([socket], [socket net])
122
AC_SEARCH_LIBS([gethostbyname], [nsl bind])
123
PKG_CHECK_MODULES(OPENSSL, [openssl >= $OPENSSL_MINIMUM], , [CHECK_SSL()])
124
PKG_CHECK_MODULES(LIBCURL, [libcurl >= $CURL_MINIMUM])
128
AC_CHECK_FUNCS([lseek64])
131
dnl ----------------------------------------------------------------------------
135
dnl can posix_fadvise be used
136
AC_CHECK_DECLS(posix_fadvise, [], [], [
137
#define _XOPEN_SOURCE 600
139
AC_CHECK_FUNCS([posix_fadvise])
142
dnl ----------------------------------------------------------------------------
144
dnl file monitoring for the daemon
146
AC_CHECK_HEADER([sys/inotify.h],
147
[AC_CHECK_FUNC([inotify_init],[have_inotify="yes"],[have_inotify="no"])],
149
AC_ARG_WITH([inotify],
150
[AS_HELP_STRING([--with-inotify],[Enable inotify support (default=auto)])],
151
[want_inotify=${withval}],
152
[want_inotify=${have_inotify}])
153
if test "x$want_inotify" = "xyes" ; then
154
if test "x$have_inotify" = "xyes"; then
155
AC_DEFINE([WITH_INOTIFY],[1])
157
AC_MSG_ERROR("inotify not found!")
161
AC_CHECK_HEADER([sys/event.h],
162
[AC_CHECK_FUNC([kqueue],[have_kqueue="yes"],[have_kqueue="no"])],
164
AC_ARG_WITH([kqueue],
165
[AS_HELP_STRING([--with-kqueue],[Enable kqueue support (default=auto)])],
166
[want_kqueue=${withval}],
167
[want_kqueue=${have_kqueue}])
168
if test "x$want_kqueue" = "xyes" ; then
169
if test "x$have_kqueue" = "xyes"; then
170
AC_DEFINE([WITH_KQUEUE],[1])
172
AC_MSG_ERROR("kqueue not found!")
176
AC_CHECK_HEADERS([xfs/xfs.h])
179
dnl ----------------------------------------------------------------------------
183
AC_MSG_CHECKING([how to copy va_list])
184
AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);],
185
AC_MSG_RESULT([va_copy]),
186
[ AH_TEMPLATE([va_copy], [define if va_copy is not available])
187
AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);],
188
[ AC_DEFINE([va_copy], [__va_copy])
189
AC_MSG_RESULT([__va_copy])],
190
[ AC_DEFINE([va_copy(dest,src)], [memcpy(&dest,&src,sizeof(va_list))])
191
AC_MSG_RESULT([memcpy])]
196
dnl libevent likes to link against librt if possible
197
dnl for clock_gettime() and clock_settime()
198
dnl TODO(libevent2): this can probably be removed after
199
dnl we switch to libevent2, since it will have PKG_CONFIG
202
[libevent_extra_libs="-lrt"],
203
[libevent_extra_libs=""])
205
dnl build our copy of libevent whether we use it or not,
206
dnl because "make dist" needs its Makefiles to exist, and
207
dnl AM_CONDITIONAL + AC_CONFIG_SUBDIRS don't seem to play nice
208
AC_CONFIG_SUBDIRS([third-party/libevent])
209
libevent_source=bundled
210
AC_CHECK_LIB([event],[evutil_vsnprintf],
211
[libevent_found=yes],
213
[$libevent_extra_libs])
214
AC_CHECK_HEADER([event-config.h],
215
[libevent_headers_found=yes],
216
[libevent_headers_found=no])
217
libevent_source=bundled
218
if test "x$libevent_found" = "xyes" ; then
219
if test "x$libevent_headers_found" = "xyes"; then
220
libevent_source=system
223
if test "x$libevent_source" = "xbundled"; then
224
AC_MSG_WARN([using our own libevent from third-party/libevent/])
225
AC_MSG_WARN([if you are cross-compiling this is probably NOT what you want.])
226
LIBEVENT_CFLAGS="-I\$(top_srcdir)/third-party/libevent -I\$(top_builddir)/third-party/libevent"
227
LIBEVENT_LIBS="\$(top_builddir)/third-party/libevent/libevent.la"
230
LIBEVENT_LIBS="-levent $libevent_extra_libs"
232
AC_ARG_VAR([LIBEVENT_CFLAGS], [C compiler flags for LIBEVENT, overriding pkg-config])dnl
233
AC_ARG_VAR([LIBEVENT_LIBS], [linker flags for LIBEVENT, overriding pkg-config])dnl
237
dnl ----------------------------------------------------------------------------
241
DHT_CFLAGS="-I\$(top_srcdir)/third-party/dht"
242
DHT_LIBS="\$(top_builddir)/third-party/dht/libdht.a"
247
dnl ----------------------------------------------------------------------------
249
dnl detection for the GTK+ client
251
PKG_CHECK_MODULES(GTK,
252
[gtk+-2.0 >= $GTK_MINIMUM
253
glib-2.0 >= $GLIB_MINIMUM
254
gmodule-2.0 >= $GLIB_MINIMUM
255
gthread-2.0 >= $GLIB_MINIMUM],
259
AS_HELP_STRING([--enable-gtk],[build gtk client]),
260
[want_gtk=${enableval}],
261
[want_gtk=${have_gtk}])
264
use_libappindicator=no
269
if test "x$want_gtk" = "xyes" ; then
270
if test "x$have_gtk" = "xyes"; then
273
AC_MSG_ERROR("GTK+ not found!")
276
AM_CONDITIONAL([BUILD_GTK],[test "x$build_gtk" = "xyes"])
278
if test "x$build_gtk" = "xyes"; then
280
PKG_CHECK_MODULES([LPI],
281
[launchpad-integration],
284
if test "x$use_lpi" = "xyes"; then
285
AC_DEFINE([HAVE_LPI], 1)
288
PKG_CHECK_MODULES([GIO],
289
[gio-2.0 >= $GIO_MINIMUM],
292
if test "x$use_gio" = "xyes"; then
293
AC_DEFINE([HAVE_GIO], 1)
296
PKG_CHECK_MODULES([LIBNOTIFY],
297
[libnotify >= $LIBNOTIFY_MINIMUM],
298
[have_libnotify=yes],
300
AC_ARG_ENABLE([libnotify],
301
AS_HELP_STRING([--enable-libnotify],[enable notifications]),,
302
[enable_libnotify=yes])
304
if test "x$enable_libnotify" = "xyes" ; then
305
if test "x$have_libnotify" = "xyes"; then
307
AC_DEFINE([HAVE_LIBNOTIFY], 1)
311
PKG_CHECK_MODULES([LIBAPPINDICATOR],
312
[appindicator-0.1 >= $LIBAPPINDICATOR_MINIMUM],
313
[have_libappindicator=yes],
314
[have_libappindicator=no])
316
AC_ARG_ENABLE([libappindicator],
317
AS_HELP_STRING([--enable-libappindicator],[enable AppIndicator support]),,
318
[enable_libappindicator=yes])
319
use_libappindicator=no
320
if test "x$enable_libappindicator" = "xyes" ; then
321
if test "x$have_libappindicator" = "xyes"; then
322
use_libappindicator=yes
323
AC_SUBST(LIBAPPINDICATOR_LIBS)
324
AC_SUBST(LIBAPPINDICATOR_CFLAGS)
325
AC_DEFINE([HAVE_LIBAPPINDICATOR], 1)
329
PKG_CHECK_MODULES([LIBCANBERRA],
330
[libcanberra-gtk >= $CANBERRA_MINIMUM],
331
[have_libcanberra=yes],
332
[have_libcanberra=no])
333
AC_ARG_ENABLE([libcanberra],
334
AS_HELP_STRING([--enable-libcanberra],[enable sounds]),,
335
[enable_libcanberra=yes])
336
if test "x$enable_libcanberra" = "xyes" ; then
337
if test "x$have_libcanberra" = "xyes"; then
339
AC_DEFINE([HAVE_LIBCANBERRA], 1)
343
PKG_CHECK_MODULES([LIBGCONF],
344
[gconf-2.0 >= $GCONF2_MINIMUM],
347
AC_ARG_ENABLE([gconf2],
348
AS_HELP_STRING([--enable-libgconf],[enable GConf support]),,
349
[enable_libgconf=yes])
350
if test "x$enable_libgconf" = "xyes" ; then
351
if test "x$have_libgconf" = "xyes"; then
353
AC_DEFINE([HAVE_LIBGCONF], 1)
357
PKG_CHECK_MODULES([DBUS_GLIB],
358
[dbus-glib-1 >= $DBUS_GLIB_MINIMUM],
361
if test "x$use_dbus_glib" = "xyes"; then
362
AC_DEFINE([HAVE_DBUS_GLIB], 1)
364
if test "x$use_dbus_glib" = "xyes"; then
365
AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool, no)
366
if test "x$DBUS_BINDING_TOOL" = xno; then
367
AC_MSG_WARN([Cannot find dbus-binding-tool])
368
use_dbus_glib="no (dbus-binding-tool not found)"
374
AS_HELP_STRING([--enable-nls],[enable native language support]),,
377
if test "x$build_gtk" = "xyes" -a "x$enable_nls" = "xno" ; then
378
AC_MSG_ERROR("The gtk client cannot be built without nls support. Try adding either --enable-nls or --disable-gtk" )
381
dnl This section is only used for internationalization.
382
dnl If you don't need translations and this section gives you trouble --
383
dnl such as if you're building for a headless system --
384
dnl it's okay to tear this section out and re-build the configure script.
386
dnl Note to packagers: the bump to intltool 0.40 was made to fix
387
dnl a "make check" failure on some systems. if upgrading to 0.40 is
388
dnl a problem and the old version was working fine for you,
389
dnl it should be safe to re-edit 0.40 back down to 0.23
392
if test "x$enable_nls" = "xyes" ; then
394
IT_PROG_INTLTOOL([0.40.0],[no-xml])
395
AC_CHECK_HEADERS([libintl.h])
396
GETTEXT_PACKAGE=transmission
397
AC_SUBST(GETTEXT_PACKAGE)
398
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
400
transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
401
AC_SUBST(transmissionlocaledir)
406
dnl ----------------------------------------------------------------------------
408
dnl platform-specific stuff.
417
CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
418
CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN"
419
LIBS="$LIBS -lshell32 -lws2_32"
420
transmissionlocaledir="locale"
421
if test -z "$host_alias"; then
424
hostaliaswindres="$host_alias-windres";
426
AC_CHECK_TOOL(WINDRES, windres)
431
CFLAGS="-DMACOSX $CFLAGS"
437
[AS_HELP_STRING([--enable-cli],[build command-line client])],
438
[build_cli=${enableval}],
440
AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
443
[AS_HELP_STRING([--enable-mac],[build Mac client])],
444
[build_mac=${enableval}],
445
[build_mac=${have_darwin}])
446
AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"])
448
AC_ARG_ENABLE([daemon],
449
[AS_HELP_STRING([--enable-daemon],[build daemon])],
450
[build_daemon=${enableval}],
451
[build_daemon="yes"])
452
AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
455
if test "x$build_mac" = "xyes" ; then
456
# Make sure the proper Mac SDK is installed
457
if test ! -d /Developer/SDKs/MacOSX10.5.sdk; then
459
You need to install the Mac OS X 10.5 SDK in order to build Transmission
461
Get your Xcode CD or package
463
When it gets to "Installation Type", select "Customize"
464
Select "Mac OS X 10.5 SDK" under "Cross Development"
470
if test "x$have_darwin" = "xyes"; then
471
AC_DEFINE([HAVE_DARWIN], 1)
473
if test "x$have_msw" = "xyes"; then
474
AC_DEFINE([HAVE_MSW], 1)
476
AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes")
478
dnl ----------------------------------------------------------------------------
480
dnl Generate the output
482
AC_CONFIG_FILES([Makefile
487
libtransmission/Makefile
489
third-party/miniupnp/Makefile
490
third-party/libnatpmp/Makefile
491
third-party/dht/Makefile
497
web/images/buttons/Makefile
498
web/images/graphics/Makefile
499
web/images/progress/Makefile
500
web/javascript/Makefile
501
web/javascript/jquery/Makefile
502
web/stylesheets/Makefile
505
ac_configure_args="$ac_configure_args --enable-static --disable-shared -q"
512
Source code location: ${srcdir}
514
System or bundled libevent: ${libevent_source}
516
Build Command-Line client: ${build_cli}
518
Build GTK+ client: ${build_gtk}
519
optional dbus support: ${use_dbus_glib}
520
optional gio for optional watchdir support: ${use_gio}
521
optional libnotify for 'download completed' popups: ${use_libnotify}
522
optional libcanberra for 'download completed' sounds: ${use_canberra}
523
optional libgconf to tell GNOME we handle magnet links: ${use_libgconf}
524
optional libappindicator for Ubuntu-style system tray: ${use_libappindicator}
526
Build Daemon: ${build_daemon}
528
Build Mac client: ${build_mac}