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],[2.33])
7 m4_define([peer_id_prefix],[-TR2330-])
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-pax])
24 if test m4_substr(peer_id_prefix,6,1) = "0"; then
26 CPPFLAGS="$CPPFLAGS -DNDEBUG"
29 if test "x$GCC" = "xyes" ; then
30 CFLAGS="$CFLAGS -g -O0"
31 CXXFLAGS="$CXXFLAGS -g -O0"
34 AM_CONDITIONAL(TR_UNSTABLE, test "x$supported_build" = "xno")
38 ## MANDATORY for everything
42 AC_SUBST(CURL_MINIMUM)
43 LIBEVENT_MINIMUM=2.0.10
44 AC_SUBST(LIBEVENT_MINIUM)
46 AC_SUBST(OPENSSL_MINIMUM)
50 ## MANDATORY for the GTK+ client
54 AC_SUBST(GLIB_MINIMUM)
60 ## OPTIONAL for the GTK+ client
63 # play the XDG "download done" sound...
65 AC_SUBST(CANBERRA_MINIMUM)
66 # inhibit hibernation when a torrent is active...
67 DBUS_GLIB_MINIMUM=0.70
68 AC_SUBST(DBUS_GLIB_MINIMUM)
69 # implement "watch" directories to use new .torrent files...
72 # pop up a "download done" notice...
73 LIBNOTIFY_MINIMUM=0.4.3
74 AC_SUBST(LIBNOTIFY_MINIMUM)
75 # create the tray icon with AppIndicator
76 LIBAPPINDICATOR_MINIMUM=0.0.11
77 AC_SUBST(LIBAPPINDICATOR_MINIMUM)
83 if test "x$GCC" = "xyes" ; then
85 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 -Winline -Wfloat-equal"
87 dnl figure out gcc version
88 AC_MSG_CHECKING([gcc version])
89 GCC_VERSION=`$CC -dumpversion`
90 GCC_MAJOR=`echo $GCC_VERSION | cut -d . -f1`
91 GCC_MINOR=`echo $GCC_VERSION | cut -d . -f2`
92 GCC_VERSION_NUM=`(expr $GCC_MAJOR "*" 100 + $GCC_MINOR) 2>/dev/null`
94 AC_MSG_RESULT($GCC_VERSION)
95 if test $GCC_VERSION_NUM -ge 304; then
96 dnl these were added in 3.4
97 CFLAGS="$CFLAGS -Wextra -Wdeclaration-after-statement -Winit-self"
99 if test $GCC_VERSION_NUM -ge 403; then
100 dnl these were added in 4.3
101 CFLAGS="$CFLAGS -Wvariadic-macros"
108 AC_CHECK_HEADERS([stdbool.h])
109 AC_CHECK_FUNCS([iconv_open pread pwrite lrintf strlcpy daemon dirname basename strcasecmp localtime_r fallocate64 posix_fallocate memmem strsep strtold syslog valloc getpagesize posix_memalign statvfs htonll ntohll])
114 if test "x$ac_cv_func_strtold" != "xyes" ; then
115 CPPFLAGS="$CPPFLAGS -Dstrtold=strtod"
118 AC_SEARCH_LIBS(cos, [m])
119 AC_SEARCH_LIBS([socket], [socket net])
120 AC_SEARCH_LIBS([gethostbyname], [nsl bind])
121 PKG_CHECK_MODULES(OPENSSL, [openssl >= $OPENSSL_MINIMUM], , [CHECK_SSL()])
122 PKG_CHECK_MODULES(LIBCURL, [libcurl >= $CURL_MINIMUM])
123 PKG_CHECK_MODULES(LIBEVENT, [libevent >= $LIBEVENT_MINIMUM])
127 AC_CHECK_FUNCS([lseek64])
130 dnl ----------------------------------------------------------------------------
134 dnl can posix_fadvise be used
135 AC_CHECK_DECLS(posix_fadvise, [], [], [
136 #define _XOPEN_SOURCE 600
138 AC_CHECK_FUNCS([posix_fadvise])
141 dnl ----------------------------------------------------------------------------
143 dnl file monitoring for the daemon
145 AC_CHECK_HEADER([sys/inotify.h],
146 [AC_CHECK_FUNC([inotify_init],[have_inotify="yes"],[have_inotify="no"])],
148 AC_ARG_WITH([inotify],
149 [AS_HELP_STRING([--with-inotify],[Enable inotify support (default=auto)])],
150 [want_inotify=${withval}],
151 [want_inotify=${have_inotify}])
152 if test "x$want_inotify" = "xyes" ; then
153 if test "x$have_inotify" = "xyes"; then
154 AC_DEFINE([WITH_INOTIFY],[1])
156 AC_MSG_ERROR("inotify not found!")
160 AC_CHECK_HEADER([sys/event.h],
161 [AC_CHECK_FUNC([kqueue],[have_kqueue="yes"],[have_kqueue="no"])],
163 AC_ARG_WITH([kqueue],
164 [AS_HELP_STRING([--with-kqueue],[Enable kqueue support (default=auto)])],
165 [want_kqueue=${withval}],
166 [want_kqueue=${have_kqueue}])
167 if test "x$want_kqueue" = "xyes" ; then
168 if test "x$have_kqueue" = "xyes"; then
169 AC_DEFINE([WITH_KQUEUE],[1])
171 AC_MSG_ERROR("kqueue not found!")
175 AC_CHECK_HEADERS([sys/statvfs.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 ----------------------------------------------------------------------------
200 DHT_CFLAGS="-I\$(top_srcdir)/third-party/dht"
201 DHT_LIBS="\$(top_builddir)/third-party/dht/libdht.a"
206 dnl ----------------------------------------------------------------------------
212 [libutp_extra_libs="-lrt"],
213 [libutp_extra_libs=""])
215 AC_MSG_CHECKING([µTP])
217 if test "x$CXX" = "x" ; then
223 AS_HELP_STRING([--enable-utp],[build µTP support]),
224 [want_utp=${enableval}],
225 [want_utp=${have_utp}])
226 if test "x$want_utp" = "xyes" ; then
227 if test "x$have_utp" = "xyes"; then
228 LIBUTP_CFLAGS="-I\$(top_srcdir)/third-party/"
229 LIBUTP_LIBS="\$(top_builddir)/third-party/libutp/libutp.a"
230 if test "x$libutp_extra_libs" != "x" ; then
231 LIBUTP_LIBS="$LIBUTP_LIBS $libutp_extra_libs"
233 AC_DEFINE([WITH_UTP],[1])
236 AC_MSG_ERROR("Unable to build uTP support -- C++ compiler not found")
239 AC_SUBST(LIBUTP_CFLAGS)
240 AC_SUBST(LIBUTP_LIBS)
241 AM_CONDITIONAL([BUILD_UTP],[test "x$build_utp" = "xyes"])
242 AC_MSG_RESULT([$build_utp])
245 dnl ----------------------------------------------------------------------------
247 dnl detection for the GTK+ client
249 PKG_CHECK_MODULES(GTK,
250 [gtk+-2.0 >= $GTK_MINIMUM
251 glib-2.0 >= $GLIB_MINIMUM
252 gmodule-2.0 >= $GLIB_MINIMUM
253 gthread-2.0 >= $GLIB_MINIMUM],
257 AS_HELP_STRING([--enable-gtk],[build gtk client]),
258 [want_gtk=${enableval}],
259 [want_gtk=${have_gtk}])
262 use_libappindicator=no
266 if test "x$want_gtk" = "xyes" ; then
267 if test "x$have_gtk" = "xyes"; then
270 AC_MSG_ERROR("GTK+ not found!")
273 AM_CONDITIONAL([BUILD_GTK],[test "x$build_gtk" = "xyes"])
275 if test "x$build_gtk" = "xyes"; then
277 PKG_CHECK_MODULES([GIO],
278 [gio-2.0 >= $GIO_MINIMUM],
281 if test "x$use_gio" = "xyes"; then
282 AC_DEFINE([HAVE_GIO], 1)
285 PKG_CHECK_MODULES([LIBNOTIFY],
286 [libnotify >= $LIBNOTIFY_MINIMUM],
287 [have_libnotify=yes],
289 AC_ARG_ENABLE([libnotify],
290 AS_HELP_STRING([--enable-libnotify],[enable notifications]),,
291 [enable_libnotify=yes])
293 if test "x$have_libnotify" = "xyes"; then
294 if test "x$enable_libnotify" = "xyes" ; then
296 AC_DEFINE([HAVE_LIBNOTIFY], 1)
303 PKG_CHECK_MODULES([LIBAPPINDICATOR],
304 [appindicator-0.1 >= $LIBAPPINDICATOR_MINIMUM],
305 [have_libappindicator=yes],
306 [have_libappindicator=no])
308 AC_ARG_ENABLE([libappindicator],
309 AS_HELP_STRING([--enable-libappindicator],[enable AppIndicator support]),,
310 [enable_libappindicator=yes])
311 use_libappindicator=no
312 if test "x$have_libappindicator" = "xyes"; then
313 if test "x$enable_libappindicator" = "xyes" ; then
314 use_libappindicator=yes
315 AC_DEFINE([HAVE_LIBAPPINDICATOR], 1)
317 LIBAPPINDICATOR_CFLAGS=
318 LIBAPPINDICATOR_LIBS=
322 PKG_CHECK_MODULES([LIBCANBERRA],
323 [libcanberra-gtk >= $CANBERRA_MINIMUM],
324 [have_libcanberra=yes],
325 [have_libcanberra=no])
326 AC_ARG_ENABLE([libcanberra],
327 AS_HELP_STRING([--enable-libcanberra],[enable sounds]),,
328 [enable_libcanberra=yes])
329 if test "x$have_libcanberra" = "xyes"; then
330 if test "x$enable_libcanberra" = "xyes" ; then
332 AC_DEFINE([HAVE_LIBCANBERRA], 1)
339 PKG_CHECK_MODULES([DBUS_GLIB],
340 [dbus-glib-1 >= $DBUS_GLIB_MINIMUM],
343 if test "x$use_dbus_glib" = "xyes"; then
344 AC_DEFINE([HAVE_DBUS_GLIB], 1)
346 if test "x$use_dbus_glib" = "xyes"; then
347 AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool, no)
348 if test "x$DBUS_BINDING_TOOL" = xno; then
349 AC_MSG_WARN([Cannot find dbus-binding-tool])
350 use_dbus_glib="no (dbus-binding-tool not found)"
356 AS_HELP_STRING([--enable-nls],[enable native language support]),,
359 if test "x$build_gtk" = "xyes" -a "x$enable_nls" = "xno" ; then
360 AC_MSG_ERROR("The gtk client cannot be built without nls support. Try adding either --enable-nls or --disable-gtk" )
363 dnl This section is only used for internationalization.
364 dnl If you don't need translations and this section gives you trouble --
365 dnl such as if you're building for a headless system --
366 dnl it's okay to tear this section out and re-build the configure script.
368 dnl Note to packagers: the bump to intltool 0.40 was made to fix
369 dnl a "make check" failure on some systems. if upgrading to 0.40 is
370 dnl a problem and the old version was working fine for you,
371 dnl it should be safe to re-edit 0.40 back down to 0.23
374 if test "x$enable_nls" = "xyes" ; then
376 IT_PROG_INTLTOOL([0.35.0],[no-xml])
377 AC_CHECK_HEADERS([libintl.h])
378 GETTEXT_PACKAGE=transmission-gtk
379 AC_SUBST(GETTEXT_PACKAGE)
380 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
382 transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
383 AC_SUBST(transmissionlocaledir)
388 dnl ----------------------------------------------------------------------------
390 dnl platform-specific stuff.
399 CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
400 CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN"
401 LIBS="$LIBS -liphlpapi -lshell32 -lws2_32"
402 transmissionlocaledir="locale"
403 if test -z "$host_alias"; then
406 hostaliaswindres="$host_alias-windres";
408 AC_CHECK_TOOL(WINDRES, windres)
413 CFLAGS="-DMACOSX $CFLAGS"
418 AC_ARG_ENABLE([lightweight],
419 AS_HELP_STRING([--enable-lightweight],[optimize libtransmission for low-resource systems: smaller cache size, prefer unencrypted peer connections, etc.]),
420 [enable_lightweight=${enableval}],
421 [enable_lightweight="no"])
422 if test "x$enable_lightweight" = "xyes" ; then
423 AC_DEFINE([TR_LIGHTWEIGHT],[1],[optimize libtransmission for low-resource systems])
427 [AS_HELP_STRING([--enable-cli],[build command-line client])],
428 [build_cli=${enableval}],
430 AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
433 [AS_HELP_STRING([--enable-mac],[build Mac client])],
434 [build_mac=${enableval}],
435 [build_mac=${have_darwin}])
436 AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"])
438 AC_ARG_ENABLE([daemon],
439 [AS_HELP_STRING([--enable-daemon],[build daemon])],
440 [build_daemon=${enableval}],
441 [build_daemon="yes"])
442 AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
445 if test "x$build_mac" = "xyes" ; then
446 # Make sure the proper Mac SDK is installed
447 if test ! -d /Developer/SDKs/MacOSX10.5.sdk; then
449 You need to install the Mac OS X 10.5 SDK in order to build Transmission
451 Get your Xcode CD or package
453 When it gets to "Installation Type", select "Customize"
454 Select "Mac OS X 10.5 SDK" under "Cross Development"
460 if test "x$have_darwin" = "xyes"; then
461 AC_DEFINE([HAVE_DARWIN], 1)
463 if test "x$have_msw" = "xyes"; then
464 AC_DEFINE([HAVE_MSW], 1)
466 AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes")
468 dnl ----------------------------------------------------------------------------
470 dnl Generate the output
472 AC_CONFIG_FILES([Makefile
473 transmission-gtk.spec
477 libtransmission/Makefile
480 third-party/miniupnp/Makefile
481 third-party/libnatpmp/Makefile
482 third-party/libutp/Makefile
483 third-party/dht/Makefile
489 web/images/buttons/Makefile
490 web/images/graphics/Makefile
491 web/images/progress/Makefile
492 web/javascript/Makefile
493 web/javascript/jquery/Makefile
494 web/stylesheets/Makefile
503 Source code location: ${srcdir}
506 Build libtransmission: yes
508 * optimized for low-resource systems: ${enable_lightweight}
509 * µTP enabled: ${build_utp}
511 Build Command-Line client: ${build_cli}
513 Build GTK+ client: ${build_gtk}
515 Optional dependencies for GTK+ client:
517 * dbus support: ${use_dbus_glib}
518 * gio for watchdir and mime-type support: ${use_gio}
519 * libnotify for 'download completed' popups: ${use_libnotify}
520 * libcanberra for 'download completed' sounds: ${use_canberra}
521 * libappindicator for an Ubuntu-style tray: ${use_libappindicator}
523 Build Daemon: ${build_daemon}
525 Build Mac client: ${build_mac}