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.81])
7 m4_define([peer_id_prefix],[-TR2810-])
9 AC_INIT([transmission],[user_agent_prefix],[http://trac.transmissionbt.com/newticket])
10 AC_SUBST(USERAGENT_PREFIX,[user_agent_prefix])
11 AC_SUBST(PEERID_PREFIX,[peer_id_prefix])
13 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
15 AC_CONFIG_MACRO_DIR([m4])
17 dnl AM_CONFIG_HEADER(config.h)
18 AC_CONFIG_SRCDIR(libtransmission/transmission.h)
19 AM_INIT_AUTOMAKE([1.9 tar-pax no-dist-gzip dist-xz])
22 if test m4_substr(peer_id_prefix,6,1) = "0"; then
24 CPPFLAGS="$CPPFLAGS -DNDEBUG"
27 if test "x$GCC" = "xyes" ; then
28 CFLAGS="$CFLAGS -g -O0"
29 CXXFLAGS="$CXXFLAGS -g -O0"
32 AM_CONDITIONAL(TR_UNSTABLE, test "x$supported_build" = "xno")
36 ## MANDATORY for everything
40 AC_SUBST(CURL_MINIMUM)
41 LIBEVENT_MINIMUM=2.0.10
42 AC_SUBST(LIBEVENT_MINIMUM)
44 AC_SUBST(OPENSSL_MINIMUM)
48 ## MANDATORY for the GTK+ client
55 AC_SUBST(GLIB_MINIMUM)
61 ## OPTIONAL for the GTK+ client
65 # create the tray icon with AppIndicator
66 LIBAPPINDICATOR_MINIMUM=0.4.90
67 AC_SUBST(LIBAPPINDICATOR_MINIMUM)
72 if test "x$CXX" != "x"; then # CXX is set...
73 if test -f "$CXX"; then # maybe it's an absolute path passed in env variables...
74 AC_MSG_CHECKING([for $CXX])
76 AC_MSG_RESULT([$HAVE_CXX])
78 AC_CHECK_PROG([HAVE_CXX],[$CXX],[yes],[no])
82 if test "x$GCC" = "xyes" ; then
84 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"
86 dnl figure out gcc version
87 AC_MSG_CHECKING([gcc version])
88 GCC_VERSION=`$CC -dumpversion`
89 GCC_MAJOR=`echo $GCC_VERSION | cut -d . -f1`
90 GCC_MINOR=`echo $GCC_VERSION | cut -d . -f2`
91 GCC_VERSION_NUM=`(expr $GCC_MAJOR "*" 100 + $GCC_MINOR) 2>/dev/null`
93 AC_MSG_RESULT($GCC_VERSION)
94 if test $GCC_VERSION_NUM -ge 304; then
95 dnl these were added in 3.4
96 CFLAGS="$CFLAGS -Wextra -Wdeclaration-after-statement -Winit-self"
98 if test $GCC_VERSION_NUM -ge 403; then
99 dnl these were added in 4.3
100 CFLAGS="$CFLAGS -Wvariadic-macros"
107 AC_CHECK_HEADERS([stdbool.h])
108 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 mkdtemp])
113 if test "x$ac_cv_func_strtold" != "xyes" ; then
114 CPPFLAGS="$CPPFLAGS -Dstrtold=strtod"
117 AC_SEARCH_LIBS(cos, [m])
118 AC_SEARCH_LIBS([socket], [socket net])
119 AC_SEARCH_LIBS([gethostbyname], [nsl bind])
120 PKG_CHECK_MODULES(OPENSSL, [openssl >= $OPENSSL_MINIMUM], , [CHECK_SSL()])
121 PKG_CHECK_MODULES(LIBCURL, [libcurl >= $CURL_MINIMUM])
122 PKG_CHECK_MODULES(LIBEVENT, [libevent >= $LIBEVENT_MINIMUM])
126 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 ----------------------------------------------------------------------------
181 dnl file monitoring for the daemon
183 # Check whether to enable systemd startup notification.
184 # This requires libsystemd-daemon.
185 AC_ARG_WITH([systemd-daemon], AS_HELP_STRING([--with-systemd-daemon],
186 [Add support for systemd startup notification (default is autodetected)])
187 [USE_SYSTEMD_DAEMON=$withval], [USE_SYSTEMD_DAEMON=auto])
188 AS_IF([test "x$USE_SYSTEMD_DAEMON" != "xno"], [
189 PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd-daemon],
190 [AC_DEFINE(USE_SYSTEMD_DAEMON,1,[Use systemd startup notification])],
191 [AS_IF([test "x$USE_SYSTEMD_DAEMON" = "xyes"],
192 [AC_MSG_ERROR([systemd startup notification support requested, but libsystemd-daemon not found.])]
198 dnl ----------------------------------------------------------------------------
202 DHT_CFLAGS="-I\$(top_srcdir)/third-party/dht"
203 DHT_LIBS="\$(top_builddir)/third-party/dht/libdht.a"
208 dnl ----------------------------------------------------------------------------
214 [libutp_extra_libs="-lrt"],
215 [libutp_extra_libs=""])
217 AC_MSG_CHECKING([µTP])
219 if test "x$HAVE_CXX" = "xyes" ; then
225 AS_HELP_STRING([--enable-utp],[build µTP support]),
226 [want_utp=${enableval}],
227 [want_utp=${have_utp}])
228 if test "x$want_utp" = "xyes" ; then
229 if test "x$have_utp" = "xyes"; then
230 LIBUTP_CFLAGS="-I\$(top_srcdir)/third-party/"
231 LIBUTP_LIBS="\$(top_builddir)/third-party/libutp/libutp.a"
232 LIBUTP_LIBS_QT="\$\${TRANSMISSION_TOP}/third-party/libutp/libutp.a"
233 if test "x$libutp_extra_libs" != "x" ; then
234 LIBUTP_LIBS="$LIBUTP_LIBS $libutp_extra_libs"
235 LIBUTP_LIBS_QT="$LIBUTP_LIBS_QT $libutp_extra_libs"
237 AC_DEFINE([WITH_UTP],[1])
240 AC_MSG_ERROR("Unable to build uTP support -- C++ compiler not found")
243 AC_SUBST(LIBUTP_CFLAGS)
244 AC_SUBST(LIBUTP_LIBS)
245 AC_SUBST(LIBUTP_LIBS_QT)
246 AM_CONDITIONAL([BUILD_UTP],[test "x$build_utp" = "xyes"])
247 AC_MSG_RESULT([$build_utp])
251 dnl look for preinstalled miniupnpc...
254 AC_MSG_CHECKING([supported miniupnp library])
258 # See if the OS has its miniupnp 1.5 installed
259 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
261 #include <miniupnpc/miniupnpc.h>
262 #include <miniupnpc/upnpcommands.h>
264 struct UPNPDev * devlist;
265 struct UPNPUrls urls;
266 struct IGDdatas data;
271 upnpDiscover( 2000, NULL, NULL, 0 );
272 UPNP_GetValidIGD( devlist, &urls, &data, lanaddr, sizeof( lanaddr ) );
273 UPNP_GetSpecificPortMappingEntry( urls.controlURL, data.first.servicetype,
274 portStr, "TCP", intClient, intPort );
276 AC_DEFINE(HAVE_MINIUPNP_15, 1, [Define to 1 if you have miniupnpc version 1.5])
277 upnp_version="1.5"],[])
279 # See if the OS has its miniupnp 1.6 installed
280 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
283 #include <miniupnpc/miniupnpc.h>
284 #include <miniupnpc/upnpcommands.h>
286 struct UPNPDev * devlist;
287 struct UPNPUrls urls;
288 struct IGDdatas data;
293 upnpDiscover( 2000, NULL, NULL, 0, 0, &errno );
294 UPNP_GetValidIGD( devlist, &urls, &data, lanaddr, sizeof( lanaddr ) );
295 UPNP_GetSpecificPortMappingEntry( urls.controlURL, data.first.servicetype,
296 portStr, "TCP", intClient, intPort, NULL, NULL, NULL );
298 AC_DEFINE(HAVE_MINIUPNP_16, 1, [Define to 1 if you have miniupnpc version 1.6])
299 upnp_version="1.6"],[])
301 # ... and the results of our tests
303 AC_MSG_RESULT([$upnp_version])
304 AM_CONDITIONAL([BUILD_MINIUPNP],[test "x$upnp_version" = "xnone"])
305 if test "x$upnp_version" = "xnone" ; then
306 LIBUPNP_CFLAGS="-I\$(top_srcdir)/third-party/"
307 LIBUPNP_LIBS="\$(top_builddir)/third-party/miniupnp/libminiupnp.a"
308 LIBUPNP_LIBS_QT="\$\${TRANSMISSION_TOP}/third-party/miniupnp/libminiupnp.a"
309 dnl because this is the version that we bundle...
310 AC_DEFINE(HAVE_MINIUPNP_16, 1, [Define to 1 if you have miniupnpc version 1.6])
312 AC_DEFINE([SYSTEM_MINIUPNP])
314 LIBUPNP_LIBS="-lminiupnpc"
315 LIBUPNP_LIBS_QT="-lminiupnpc"
317 AC_SUBST(LIBUPNP_CFLAGS)
318 AC_SUBST(LIBUPNP_LIBS)
319 AC_SUBST(LIBUPNP_LIBS_QT)
324 dnl ----------------------------------------------------------------------------
326 dnl Allow usage of system natpmp library
328 LIBNATPMP_CFLAGS="-I\$(top_srcdir)/third-party/libnatpmp/"
329 LIBNATPMP_LIBS="\$(top_builddir)/third-party/libnatpmp/libnatpmp.a"
330 LIBNATPMP_LIBS_QT="\$\${TRANSMISSION_TOP}/third-party/libnatpmp/libnatpmp.a"
331 build_bundled_natpmp="yes"
332 AC_ARG_ENABLE([external-natpmp],
333 AS_HELP_STRING([--enable-external-natpmp],[Use system external-natpmp]),
334 [want_external_natpmp=${enableval}],
335 [want_external_natpmp=no])
336 if test "x$want_external_natpmp" != "xno" ; then
337 dnl Would be lovely if it had pkgconfig
339 LIBNATPMP_LIBS="-lnatpmp"
340 LIBNATPMP_LIBS_QT="-lnatpmp"
341 build_bundled_natpmp="no"
343 AM_CONDITIONAL([BUILD_NATPMP],[test "x$build_bundled_natpmp" = "xyes"])
344 AC_SUBST(LIBNATPMP_CFLAGS)
345 AC_SUBST(LIBNATPMP_LIBS)
346 AC_SUBST(LIBNATPMP_LIBS_QT)
349 dnl ----------------------------------------------------------------------------
351 dnl detection for the GTK+ client
354 [AS_HELP_STRING([--enable-nls],[enable native language support])],,
356 PKG_CHECK_EXISTS([gtk+-3.0 >= $GTK_MINIMUM
357 glib-2.0 >= $GLIB_MINIMUM
358 gio-2.0 >= $GIO_MINIMUM,
359 gmodule-2.0 >= $GLIB_MINIMUM
360 gthread-2.0 >= $GLIB_MINIMUM],
363 AC_ARG_WITH([gtk], AS_HELP_STRING([--with-gtk],[with Gtk]),
365 [with_gtk=$have_gtk])
366 AM_CONDITIONAL([BUILD_GTK],[test "x$with_gtk" = "xyes"])
367 use_libappindicator=no
368 if test "x$with_gtk" = "xyes" ; then
370 if test "x$enable_nls" = "xno" ; then
371 AC_MSG_ERROR("The gtk client cannot be built without nls support. Try adding either --enable-nls or --without-gtk" )
374 PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= $GTK_MINIMUM
375 glib-2.0 >= $GLIB_MINIMUM
376 gio-2.0 >= $GIO_MINIMUM,
377 gmodule-2.0 >= $GLIB_MINIMUM
378 gthread-2.0 >= $GLIB_MINIMUM])
379 PKG_CHECK_MODULES([LIBAPPINDICATOR],
380 [appindicator3-0.1 >= $LIBAPPINDICATOR_MINIMUM],
381 [have_libappindicator=yes],
382 [have_libappindicator=no])
383 if test "x$have_libappindicator" = "xyes"; then
384 use_libappindicator=yes
385 AC_DEFINE([HAVE_LIBAPPINDICATOR], 1)
387 LIBAPPINDICATOR_CFLAGS=
388 LIBAPPINDICATOR_LIBS=
392 dnl This section is only used for internationalization.
393 dnl If you don't need translations and this section gives you trouble --
394 dnl such as if you're building for a headless system --
395 dnl it's okay to tear this section out and re-build the configure script.
397 dnl Note to packagers: the bump to intltool 0.40 was made to fix
398 dnl a "make check" failure on some systems. if upgrading to 0.40 is
399 dnl a problem and the old version was working fine for you,
400 dnl it should be safe to re-edit 0.40 back down to 0.23
403 if test "x$enable_nls" = "xyes" ; then
405 m4_ifdef([IT_PROG_INTLTOOL],
406 [IT_PROG_INTLTOOL([0.35.0],[no-xml])],
407 [AC_MSG_ERROR("--enable-nls requires intltool to be installed.")])
408 AC_CHECK_HEADERS([libintl.h])
409 GETTEXT_PACKAGE=transmission-gtk
410 AC_SUBST(GETTEXT_PACKAGE)
411 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
413 transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
414 AC_SUBST(transmissionlocaledir)
419 dnl ----------------------------------------------------------------------------
421 dnl platform-specific stuff.
430 CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
431 CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN"
432 LIBS="$LIBS -liphlpapi -lshell32 -lws2_32"
433 transmissionlocaledir="locale"
434 if test -z "$host_alias"; then
437 hostaliaswindres="$host_alias-windres";
439 AC_CHECK_TOOL(WINDRES, windres)
444 CFLAGS="-DMACOSX $CFLAGS"
449 AC_ARG_ENABLE([lightweight],
450 AS_HELP_STRING([--enable-lightweight],[optimize libtransmission for low-resource systems: smaller cache size, prefer unencrypted peer connections, etc.]),
451 [enable_lightweight=${enableval}],
452 [enable_lightweight="no"])
453 if test "x$enable_lightweight" = "xyes" ; then
454 AC_DEFINE([TR_LIGHTWEIGHT],[1],[optimize libtransmission for low-resource systems])
458 [AS_HELP_STRING([--enable-cli],[build command-line client])],
459 [build_cli=${enableval}],
461 AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
464 [AS_HELP_STRING([--enable-mac],[build Mac client])],
465 [build_mac=${enableval}],
466 [build_mac=${have_darwin}])
467 AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"])
469 AC_ARG_ENABLE([daemon],
470 [AS_HELP_STRING([--enable-daemon],[build daemon])],
471 [build_daemon=${enableval}],
472 [build_daemon="yes"])
473 AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
476 if test "x$build_mac" = "xyes" ; then
477 # Make sure the proper Mac SDK is installed
478 if test ! -d /Developer/SDKs/MacOSX10.5.sdk; then
480 You need to install the Mac OS X 10.5 SDK in order to build Transmission
482 Get your Xcode CD or package
484 When it gets to "Installation Type", select "Customize"
485 Select "Mac OS X 10.5 SDK" under "Cross Development"
491 if test "x$have_darwin" = "xyes"; then
492 AC_DEFINE([HAVE_DARWIN], 1)
493 AC_DEFINE([SYS_DARWIN], 1)
495 if test "x$have_msw" = "xyes"; then
496 AC_DEFINE([HAVE_MSW], 1)
498 AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes")
500 dnl ----------------------------------------------------------------------------
502 dnl Generate the output
504 AC_CONFIG_FILES([Makefile
505 transmission-gtk.spec
509 libtransmission/Makefile
512 third-party/dht/Makefile
513 third-party/libutp/Makefile
514 third-party/libnatpmp/Makefile
515 third-party/miniupnp/Makefile
523 web/style/jqueryui/Makefile
524 web/style/jqueryui/images/Makefile
525 web/style/transmission/Makefile
526 web/style/transmission/images/Makefile
527 web/style/transmission/images/buttons/Makefile
528 web/javascript/Makefile
529 web/javascript/jquery/Makefile
538 Source code location: ${srcdir}
541 Build libtransmission: yes
542 * optimized for low-resource systems: ${enable_lightweight}
543 * µTP enabled: ${build_utp}
545 Build Command-Line client: ${build_cli}
547 Build GTK+ client: ${with_gtk}
548 * libappindicator for an Ubuntu-style tray: ${use_libappindicator}
550 Build Daemon: ${build_daemon}
552 Build Mac client: ${build_mac}