source: trunk/configure.ac

Last change on this file was 14733, checked in by mikedld, 19 months ago

#5921: Use libsystemd instead of libsystemd-daemon (original patches by Sandro Tosi and Mike Gilbert)

In systemd v209, released over two years ago, the various libsystemd-*
libraries (libsystemd-journal.so, libsystemd-login.so, libsystem-daemon.so,
libsystemd-id128.so) were merged into a single libsystemd.so library to
reduce code duplication and avoid cyclic dependencies.

File size: 22.7 KB
Line 
1dnl convention: -TR MAJOR MINOR MAINT STATUS - (each a single char)
2dnl STATUS: "X" for prerelease beta builds,
3dnl         "Z" for unsupported trunk builds,
4dnl         "0" for stable, supported releases
5dnl these should be the only two lines you need to change
6m4_define([user_agent_prefix],[2.92+])
7m4_define([peer_id_prefix],[-TR292Z-])
8
9AC_INIT([transmission],[user_agent_prefix],[http://trac.transmissionbt.com/newticket])
10AC_SUBST(USERAGENT_PREFIX,[user_agent_prefix])
11AC_SUBST(PEERID_PREFIX,[peer_id_prefix])
12
13m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
14
15AC_CONFIG_MACRO_DIR([m4])
16
17dnl AM_CONFIG_HEADER(config.h)
18AC_CONFIG_SRCDIR(libtransmission/transmission.h)
19AM_INIT_AUTOMAKE([1.9 tar-pax no-dist-gzip dist-xz])
20LT_INIT
21LT_LIB_M
22
23if test m4_substr(peer_id_prefix,6,1) = "0"; then
24  supported_build=yes
25  CPPFLAGS="$CPPFLAGS -DNDEBUG"
26else
27  supported_build=no
28  if test "x$GCC" = "xyes" ; then
29    CFLAGS="$CFLAGS -g -O0"
30    CXXFLAGS="$CXXFLAGS -g -O0"
31  fi
32fi
33AM_CONDITIONAL(TR_UNSTABLE, test "x$supported_build" = "xno")
34AM_CONDITIONAL(HAVE_REVISION_FILE, test -f REVISION)
35
36##
37##
38##   MANDATORY for everything
39##
40##
41
42CURL_MINIMUM=7.15.4
43AC_SUBST(CURL_MINIMUM)
44LIBEVENT_MINIMUM=2.0.10
45AC_SUBST(LIBEVENT_MINIMUM)
46ZLIB_MINIMUM=1.2.3
47AC_SUBST(ZLIB_MINIMUM)
48
49# crypto backends
50OPENSSL_MINIMUM=0.9.7
51AC_SUBST(OPENSSL_MINIMUM)
52CYASSL_MINIMUM=3.0
53AC_SUBST(CYASSL_MINIMUM)
54POLARSSL_MINIMUM=0x01020000 # 1.2
55AC_SUBST(POLARSSL_MINIMUM)
56
57##
58##
59##   MANDATORY for the GTK+ client
60##
61##
62
63GTK_MINIMUM=3.4.0
64AC_SUBST(GTK_MINIMUM)
65GLIB_MINIMUM=2.32.0
66AC_SUBST(GLIB_MINIMUM)
67GIO_MINIMUM=2.26.0
68AC_SUBST(GIO_MINIMUM)
69
70##
71##
72##   OPTIONAL for the GTK+ client
73##
74##
75
76# create the tray icon with AppIndicator
77LIBAPPINDICATOR_MINIMUM=0.4.90
78AC_SUBST(LIBAPPINDICATOR_MINIMUM)
79
80
81AC_PROG_CC
82AC_PROG_CXX
83AC_C_INLINE
84if test "x$GCC" = "xyes" ; then
85
86    CFLAGS="$CFLAGS -std=gnu99 -ggdb3 -Wall -W -Wpointer-arith -Wformat-security -Wundef -Wcast-align -Wstrict-prototypes -Wmissing-declarations -Wmissing-format-attribute -Wredundant-decls -Wnested-externs -Wunused-parameter -Wwrite-strings -Winline -Wfloat-equal"
87
88    dnl figure out gcc version
89    AC_MSG_CHECKING([gcc version])
90    GCC_VERSION=`$CC -dumpversion`
91    GCC_MAJOR=`echo $GCC_VERSION | cut -d . -f1`
92    GCC_MINOR=`echo $GCC_VERSION | cut -d . -f2`
93    GCC_VERSION_NUM=`(expr $GCC_MAJOR "*" 100 + $GCC_MINOR) 2>/dev/null`
94
95    AC_MSG_RESULT($GCC_VERSION)
96    if test $GCC_VERSION_NUM -ge 304; then
97        dnl these were added in 3.4
98        CFLAGS="$CFLAGS -Wextra -Winit-self"
99    fi
100    if test $GCC_VERSION_NUM -ge 403; then
101        dnl these were added in 4.3
102        CFLAGS="$CFLAGS -Wvariadic-macros"
103    fi
104fi
105
106AC_HEADER_STDC
107AC_HEADER_TIME
108
109AC_CHECK_HEADERS([stdbool.h xlocale.h])
110AC_CHECK_FUNCS([iconv pread pwrite lrintf strlcpy daemon dirname basename canonicalize_file_name strcasecmp localtime_r fallocate64 posix_fallocate memmem strsep strtold syslog valloc getpagesize posix_memalign statvfs htonll ntohll mkdtemp uselocale _configthreadlocale])
111AC_PROG_INSTALL
112AC_PROG_MAKE_SET
113ACX_PTHREAD
114
115if test "x$ac_cv_func_strtold" != "xyes" ; then
116    CPPFLAGS="$CPPFLAGS -Dstrtold=strtod"
117fi
118
119AC_SEARCH_LIBS(cos, [m])
120AC_SEARCH_LIBS([socket], [socket net])
121AC_SEARCH_LIBS([gethostbyname], [nsl bind])
122AC_SEARCH_LIBS([quotacursor_skipidtype], [quota])
123PKG_CHECK_MODULES(LIBCURL, [libcurl >= $CURL_MINIMUM])
124PKG_CHECK_MODULES(LIBEVENT, [libevent >= $LIBEVENT_MINIMUM])
125PKG_CHECK_MODULES(ZLIB, [zlib >= $ZLIB_MINIMUM])
126
127
128AC_ARG_WITH([crypto], AS_HELP_STRING([--with-crypto=PKG],
129            [Use specified crypto library: auto (default), openssl, cyassl, polarssl]),
130            [want_crypto=$withval], [want_crypto=auto])
131
132AS_IF([test "x$want_crypto" = "xauto" -o "x$want_crypto" = "xopenssl"], [
133    PKG_CHECK_MODULES(OPENSSL, [openssl >= $OPENSSL_MINIMUM],
134        [want_crypto="openssl"; CRYPTO_PKG="openssl"; CRYPTO_CFLAGS="$OPENSSL_CFLAGS"; CRYPTO_LIBS="$OPENSSL_LIBS"],
135        [AS_IF([test "x$want_crypto" = "xopenssl"],
136            [AC_MSG_ERROR([OpenSSL support requested, but library not found.])]
137        )]
138    )
139])
140AS_IF([test "x$want_crypto" = "xauto" -o "x$want_crypto" = "xcyassl"], [
141    PKG_CHECK_MODULES(WOLFSSL, [wolfssl >= $CYASSL_MINIMUM],
142        [want_crypto="cyassl"; CRYPTO_PKG="cyassl"; CRYPTO_CFLAGS="$WOLFSSL_CFLAGS"; CRYPTO_LIBS="$WOLFSSL_LIBS"],
143        [PKG_CHECK_MODULES(CYASSL, [cyassl >= $CYASSL_MINIMUM],
144            [want_crypto="cyassl"; CRYPTO_PKG="cyassl"; CRYPTO_CFLAGS="$CYASSL_CFLAGS"; CRYPTO_LIBS="$CYASSL_LIBS"],
145            [AS_IF([test "x$want_crypto" = "xcyassl"],
146                [AC_MSG_ERROR([CyaSSL support requested, but library not found.])]
147            )]
148        )]
149    )
150])
151AS_IF([test "x$want_crypto" = "xauto" -o "x$want_crypto" = "xpolarssl"], [
152    AC_CHECK_HEADER([polarssl/version.h],
153        [AC_EGREP_CPP([version_ok], [#include <polarssl/version.h>
154                                     #if defined (POLARSSL_VERSION_NUMBER) && POLARSSL_VERSION_NUMBER >= $POLARSSL_MINIMUM
155                                     version_ok
156                                     #endif],
157            [AC_CHECK_LIB([polarssl], [dhm_calc_secret],
158                [want_crypto="polarssl"; CRYPTO_PKG="polarssl"; CRYPTO_CFLAGS=""; CRYPTO_LIBS="-lpolarssl"],
159                [AS_IF([test "x$want_crypto" = "xpolarssl"],
160                    [AC_MSG_ERROR([PolarSSL support requested, but library not found.])]
161                )]
162            )],
163            [AS_IF([test "x$want_crypto" = "xpolarssl"],
164                [AC_MSG_ERROR([PolarSSL support requested, but version not suitable.])]
165            )]
166        )],
167        [AS_IF([test "x$want_crypto" = "xpolarssl"],
168            [AC_MSG_ERROR([PolarSSL support requested, but headers not found.])]
169        )]
170    )
171])
172# we should have found the library by now
173AS_IF([test "x$CRYPTO_PKG" = "x"], [
174    AS_IF([test "x$want_crypto" = "xauto"],
175        [AC_MSG_ERROR([Unable to find any supported crypto library.])],
176        [AC_MSG_ERROR([Requested crypto library "$want_crypto" is not supported.])],
177    )
178])
179
180AM_CONDITIONAL([CRYPTO_USE_OPENSSL],[test "x$CRYPTO_PKG" = "xopenssl"])
181AM_CONDITIONAL([CRYPTO_USE_CYASSL],[test "x$CRYPTO_PKG" = "xcyassl"])
182AM_CONDITIONAL([CRYPTO_USE_POLARSSL],[test "x$CRYPTO_PKG" = "xpolarssl"])
183AC_SUBST(CRYPTO_PKG)
184AC_SUBST(CRYPTO_CFLAGS)
185AC_SUBST(CRYPTO_LIBS)
186
187
188AC_SYS_LARGEFILE
189
190AC_FUNC_GETMNTENT
191
192dnl ----------------------------------------------------------------------------
193dnl
194dnl posix_fadvise
195
196dnl can posix_fadvise be used
197AC_CHECK_DECLS(posix_fadvise, [], [], [
198#define _XOPEN_SOURCE 600
199#include <fcntl.h>])
200AC_CHECK_FUNCS([posix_fadvise])
201
202
203dnl ----------------------------------------------------------------------------
204dnl
205dnl file monitoring for the daemon
206
207AC_ARG_WITH([inotify],
208            [AS_HELP_STRING([--with-inotify], [Enable inotify support (default=auto)])],
209            [WANT_INOTIFY=${withval}],
210            [WANT_INOTIFY=auto])
211HAVE_INOTIFY=0
212AS_IF([test "x$WANT_INOTIFY" != "xno"],
213      [AC_CHECK_HEADER([sys/inotify.h],
214                       [AC_CHECK_FUNC([inotify_init],
215                                      [HAVE_INOTIFY=1])],
216                       [AS_IF([test "x$WANT_INOTIFY" = "xyes"],
217                              [AC_MSG_ERROR("inotify not found!")])])])
218AM_CONDITIONAL([USE_INOTIFY], [test "x$WANT_INOTIFY" != "xno" -a $HAVE_INOTIFY -eq 1])
219
220AC_ARG_WITH([kqueue],
221            [AS_HELP_STRING([--with-kqueue],[Enable kqueue support (default=auto)])],
222            [WANT_KQUEUE=${withval}],
223            [WANT_KQUEUE=auto])
224HAVE_KQUEUE=0
225AS_IF([test "x$WANT_KQUEUE" != "xno"],
226      [AC_CHECK_HEADER([sys/event.h],
227                       [AC_CHECK_FUNC([kqueue],
228                                      [HAVE_KQUEUE=1])],
229                       [AS_IF([test "x$WANT_KQUEUE" = "xyes"],
230                              [AC_MSG_ERROR("kqueue not found!")])])])
231AM_CONDITIONAL([USE_KQUEUE], [test "x$WANT_KQUEUE" != "xno" -a $HAVE_KQUEUE -eq 1])
232
233
234AC_CHECK_HEADERS([sys/statvfs.h \
235                  xfs/xfs.h])
236
237
238dnl ----------------------------------------------------------------------------
239dnl
240dnl file monitoring for the daemon
241
242# Check whether to enable systemd startup notification.
243# This requires libsystemd.
244AC_ARG_WITH([systemd], AS_HELP_STRING([--with-systemd],
245            [Add support for systemd startup notification (default is autodetected)]),
246            [USE_SYSTEMD=$withval], [USE_SYSTEMD=auto])
247AS_IF([test "x$USE_SYSTEMD" != "xno"], [
248    PKG_CHECK_MODULES([SYSTEMD], [libsystemd],
249        [AC_DEFINE(USE_SYSTEMD,1,[Use systemd startup notification])],
250        [AS_IF([test "x$USE_SYSTEMD" = "xyes"],
251            [AC_MSG_ERROR([systemd startup notification support requested, but libsystemd not found.])]
252        )]
253    )
254])
255
256
257dnl ----------------------------------------------------------------------------
258dnl
259dnl  dht
260
261DHT_CFLAGS="-I\$(top_srcdir)/third-party/dht"
262DHT_LIBS="\$(top_builddir)/third-party/dht/libdht.a"
263DHT_LIBS_QT="\$\${TRANSMISSION_TOP}/third-party/dht/libdht.a"
264build_bundled_dht="yes"
265AC_ARG_ENABLE([external-dht],
266              AS_HELP_STRING([--enable-external-dht],[Use system external-dht]),
267              [want_external_dht=${enableval}],
268              [want_external_dht=no])
269if test "x$want_external_dht" != "xno" ; then
270       dnl Would be lovely if it had pkgconfig
271       DHT_CFLAGS=""
272       DHT_LIBS="-ldht"
273       DHT_LIBS_QT="-ldht"
274       build_bundled_dht="no"
275fi
276
277AM_CONDITIONAL([BUILD_DHT],[test "x$build_bundled_dht" = "xyes"])
278AC_SUBST(DHT_CFLAGS)
279AC_SUBST(DHT_LIBS)
280AC_SUBST(DHT_LIBS_QT)
281
282
283dnl ----------------------------------------------------------------------------
284dnl
285dnl  libb64
286
287LIBB64_CFLAGS="-I\$(top_srcdir)/third-party/libb64"
288LIBB64_LIBS="\$(top_builddir)/third-party/libb64/libb64.a"
289LIBB64_LIBS_QT="\$\${TRANSMISSION_TOP}/third-party/libb64/libb64.a"
290build_bundled_b64="yes"
291AC_ARG_ENABLE([external-b64],
292              AS_HELP_STRING([--enable-external-b64],[Use system libb64]),
293              [want_external_b64=${enableval}],
294              [want_external_b64=no])
295if test "x$want_external_b64" != "xno" ; then
296    LIBB64_CFLAGS="-DUSE_SYSTEM_B64"
297    LIBB64_LIBS="-lb64"
298    LIBB64_LIBS_QT="-lb64"
299    build_bundled_b64="no"
300fi
301
302AM_CONDITIONAL([BUILD_B64],[test "x$build_bundled_b64" = "xyes"])
303AC_SUBST(LIBB64_CFLAGS)
304AC_SUBST(LIBB64_LIBS)
305AC_SUBST(LIBB64_LIBS_QT)
306
307
308dnl ----------------------------------------------------------------------------
309dnl
310dnl  utp
311
312AC_CHECK_LIB([rt],
313             [clock_gettime],
314             [libutp_extra_libs="-lrt"],
315             [libutp_extra_libs=""])
316
317AC_MSG_CHECKING([µTP])
318build_utp="no"
319
320ac_save_LIBS="$LIBS"
321LIBS="-lutp"
322AC_LINK_IFELSE(
323  [AC_LANG_PROGRAM([#include <libutp/utp.h>],
324                   [struct UTPFunctionTable func;])],
325  [have_utp="yes"],
326  [have_utp="no"]
327)
328LIBS="$ac_save_LIBS"
329
330if test "x$have_utp" = "xyes" -o "x$CXX" != "x"; then
331    want_utp_default="yes"
332else
333    want_utp_default="no"
334fi
335
336AC_ARG_ENABLE([utp],
337              AS_HELP_STRING([--enable-utp],[build µTP support]),
338              [want_utp=${enableval}],
339              [want_utp=${want_utp_default}])
340if test "x$want_utp" = "xyes"; then
341    if test "x$have_utp" = "xyes"; then
342        dnl Would be lovely if it had pkgconfig
343        LIBUTP_CFLAGS=""
344        LIBUTP_LIBS="-lutp $libutp_extra_libs"
345        LIBUTP_LIBS_QT="-lutp $libutp_extra_libs"
346        AC_DEFINE([WITH_UTP],[1])
347        build_utp="system"
348    elif test "x$CXX" != "x"; then
349        LIBUTP_CFLAGS="-I\$(top_srcdir)/third-party/"
350        LIBUTP_LIBS="\$(top_builddir)/third-party/libutp/libutp.a"
351        LIBUTP_LIBS_QT="\$\${TRANSMISSION_TOP}/third-party/libutp/libutp.a"
352        if test "x$libutp_extra_libs" != "x" ; then
353            LIBUTP_LIBS="$LIBUTP_LIBS $libutp_extra_libs"
354            LIBUTP_LIBS_QT="$LIBUTP_LIBS_QT $libutp_extra_libs"
355        fi
356        AC_DEFINE([WITH_UTP],[1])
357        build_utp="yes"
358    else
359      AC_MSG_ERROR("Unable to build uTP support -- C++ compiler not found")
360    fi
361fi
362AC_SUBST(LIBUTP_CFLAGS)
363AC_SUBST(LIBUTP_LIBS)
364AC_SUBST(LIBUTP_LIBS_QT)
365AM_CONDITIONAL([BUILD_UTP],[test "x$build_utp" = "xyes"])
366AC_MSG_RESULT([$build_utp])
367
368
369dnl
370dnl  look for preinstalled miniupnpc...
371dnl
372
373ac_save_LIBS="$LIBS"
374LIBS="-lminiupnpc"
375AC_MSG_CHECKING([system miniupnpc library])
376
377dnl See if ANY version of miniupnpc is installed
378AC_LINK_IFELSE(
379  [AC_LANG_PROGRAM([#include <miniupnpc/miniupnpc.h>],
380                   [struct UPNPDev dev;])],
381  [upnp_version="unknown"],
382  [upnp_version="none"]
383)
384
385dnl Let's hope it's 1.7 or higher, since it provides
386dnl MINIUPNPC_API_VERSION and we won't have to figure
387dnl it out on our own
388if test "x$upnp_version" = "xunknown" ; then
389  AC_RUN_IFELSE(
390    [AC_LANG_PROGRAM(
391      [#include <stdlib.h>
392       #include <miniupnpc/miniupnpc.h>],
393      [#ifdef MINIUPNPC_API_VERSION
394       return EXIT_SUCCESS;
395       #else
396       return EXIT_FAILURE;
397       #endif]
398    )],
399    [upnp_version=">= 1.7"]
400  )
401fi
402
403dnl Or maybe it's miniupnp 1.6
404if test "x$upnp_version" = "xunknown" ; then
405  AC_LINK_IFELSE([AC_LANG_PROGRAM([[
406    #include <stdlib.h>
407    #include <errno.h>
408    #include <miniupnpc/miniupnpc.h>
409    #include <miniupnpc/upnpcommands.h>
410  ]], [[
411    struct UPNPDev * devlist;
412    struct UPNPUrls urls;
413    struct IGDdatas data;
414    char lanaddr[16];
415    char portStr[8];
416    char intPort[8];
417    char intClient[16];
418    upnpDiscover( 2000, NULL, NULL, 0, 0, &errno );
419    UPNP_GetValidIGD( devlist, &urls, &data, lanaddr, sizeof( lanaddr ) );
420    UPNP_GetSpecificPortMappingEntry( urls.controlURL, data.first.servicetype,
421                        portStr, "TCP", intClient, intPort, NULL, NULL, NULL );
422  ]])],[
423  AC_DEFINE(MINIUPNPC_API_VERSION, 8, [miniupnpc 1.6 has API version 8])
424  upnp_version="1.6"])
425fi
426
427dnl Or maybe it's miniupnp 1.5
428if test "x$upnp_version" = "xunknown" ; then
429  AC_LINK_IFELSE([AC_LANG_PROGRAM([[
430    #include <stdlib.h>
431    #include <miniupnpc/miniupnpc.h>
432    #include <miniupnpc/upnpcommands.h>
433  ]], [[
434    struct UPNPDev * devlist;
435    struct UPNPUrls urls;
436    struct IGDdatas data;
437    char lanaddr[16];
438    char portStr[8];
439    char intPort[8];
440    char intClient[16];
441    upnpDiscover( 2000, NULL, NULL, 0 );
442    UPNP_GetValidIGD( devlist, &urls, &data, lanaddr, sizeof( lanaddr ) );
443    UPNP_GetSpecificPortMappingEntry( urls.controlURL, data.first.servicetype,
444                        portStr, "TCP", intClient, intPort );
445  ]])],[
446  AC_DEFINE(MINIUPNPC_API_VERSION, 5, [miniupnpc 1.5 has API version 5])
447  upnp_version="1.5"])
448fi
449
450# ... and the results of our tests
451LIBS="$ac_save_LIBS"
452AC_MSG_RESULT([$upnp_version])
453AM_CONDITIONAL([BUILD_MINIUPNP],[test "x$upnp_version" = "xnone"])
454if test "x$upnp_version" = "xnone" ; then
455    LIBUPNP_CFLAGS="-I\$(top_srcdir)/third-party/"
456    LIBUPNP_LIBS="\$(top_builddir)/third-party/miniupnp/libminiupnp.a"
457    LIBUPNP_LIBS_QT="\$\${TRANSMISSION_TOP}/third-party/miniupnp/libminiupnp.a"
458else
459    AC_DEFINE([SYSTEM_MINIUPNP])
460    LIBUPNP_CFLAGS=""
461    LIBUPNP_LIBS="-lminiupnpc"
462    LIBUPNP_LIBS_QT="-lminiupnpc"
463fi
464AC_SUBST(LIBUPNP_CFLAGS)
465AC_SUBST(LIBUPNP_LIBS)
466AC_SUBST(LIBUPNP_LIBS_QT)
467
468
469 
470
471dnl ----------------------------------------------------------------------------
472dnl
473dnl  Allow usage of system natpmp library
474
475LIBNATPMP_CFLAGS="-I\$(top_srcdir)/third-party/libnatpmp/"
476LIBNATPMP_LIBS="\$(top_builddir)/third-party/libnatpmp/libnatpmp.a"
477LIBNATPMP_LIBS_QT="\$\${TRANSMISSION_TOP}/third-party/libnatpmp/libnatpmp.a"
478build_bundled_natpmp="yes"
479AC_ARG_ENABLE([external-natpmp],
480              AS_HELP_STRING([--enable-external-natpmp],[Use system external-natpmp]),
481              [want_external_natpmp=${enableval}],
482              [want_external_natpmp=no])
483if test "x$want_external_natpmp" != "xno" ; then
484        dnl Would be lovely if it had pkgconfig
485        LIBNATPMP_CFLAGS="" 
486        LIBNATPMP_LIBS="-lnatpmp"
487        LIBNATPMP_LIBS_QT="-lnatpmp"
488        build_bundled_natpmp="no"
489fi
490AM_CONDITIONAL([BUILD_NATPMP],[test "x$build_bundled_natpmp" = "xyes"])
491AC_SUBST(LIBNATPMP_CFLAGS)
492AC_SUBST(LIBNATPMP_LIBS)
493AC_SUBST(LIBNATPMP_LIBS_QT)
494
495
496dnl ----------------------------------------------------------------------------
497dnl
498dnl  detection for the GTK+ client
499
500AC_ARG_ENABLE([nls],
501              [AS_HELP_STRING([--enable-nls],[enable native language support])],,
502              [enable_nls=yes])
503PKG_CHECK_EXISTS([gtk+-3.0 >= $GTK_MINIMUM
504                  glib-2.0 >= $GLIB_MINIMUM
505                  gio-2.0 >= $GIO_MINIMUM,
506                  gmodule-2.0 >= $GLIB_MINIMUM
507                  gthread-2.0 >= $GLIB_MINIMUM],
508                 [have_gtk=yes],
509                 [have_gtk=no])
510AC_ARG_WITH([gtk], AS_HELP_STRING([--with-gtk],[with Gtk]),
511            [with_gtk=$withval],
512            [with_gtk=$have_gtk])
513AM_CONDITIONAL([BUILD_GTK],[test "x$with_gtk" = "xyes"])
514use_libappindicator=no
515if test "x$with_gtk" = "xyes" ; then
516
517    if test "x$enable_nls" = "xno" ; then
518        AC_MSG_ERROR("The gtk client cannot be built without nls support.  Try adding either --enable-nls or --without-gtk" )
519    fi
520
521    PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= $GTK_MINIMUM
522                              glib-2.0 >= $GLIB_MINIMUM
523                              gio-2.0 >= $GIO_MINIMUM,
524                              gmodule-2.0 >= $GLIB_MINIMUM
525                              gthread-2.0 >= $GLIB_MINIMUM])
526    PKG_CHECK_MODULES([LIBAPPINDICATOR],
527                      [appindicator3-0.1 >= $LIBAPPINDICATOR_MINIMUM],
528                      [have_libappindicator=yes],
529                      [have_libappindicator=no])
530    if test "x$have_libappindicator" = "xyes"; then
531        use_libappindicator=yes
532        AC_DEFINE([HAVE_LIBAPPINDICATOR], 1)
533    else
534        LIBAPPINDICATOR_CFLAGS=
535        LIBAPPINDICATOR_LIBS=
536    fi
537fi
538
539dnl This section is only used for internationalization.
540dnl If you don't need translations and this section gives you trouble --
541dnl such as if you're building for a headless system --
542dnl it's okay to tear this section out and re-build the configure script.
543dnl
544dnl Note to packagers: the bump to intltool 0.40 was made to fix
545dnl a "make check" failure on some systems.  if upgrading to 0.40 is
546dnl a problem and the old version was working fine for you,
547dnl it should be safe to re-edit 0.40 back down to 0.23
548
549use_nls=no
550if test "x$enable_nls" = "xyes" ; then
551    use_nls=yes
552    m4_ifdef([IT_PROG_INTLTOOL],
553             [IT_PROG_INTLTOOL([0.35.0],[no-xml])],
554             [AC_MSG_ERROR("--enable-nls requires intltool to be installed.")])
555    AC_CHECK_HEADERS([libintl.h])
556    GETTEXT_PACKAGE=transmission-gtk
557    AC_SUBST(GETTEXT_PACKAGE)
558    AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
559    AM_GLIB_GNU_GETTEXT
560    transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
561    AC_SUBST(transmissionlocaledir)
562fi
563AC_SUBST(INTLLIBS)
564
565
566dnl ----------------------------------------------------------------------------
567dnl
568dnl  platform-specific stuff.
569
570AC_CANONICAL_HOST
571have_darwin="no"
572have_msw="no"
573case $host_os in
574
575   *mingw32*)
576     have_msw="yes"
577     CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
578     CPPFLAGS="$CPPFLAGS -DWINVER=0x0600 -D_WIN32_WINNT=0x0600 -DWIN32_LEAN_AND_MEAN"
579     # CPPFLAGS="$CPPFLAGS -D__USE_MINGW_ANSI_STDIO=1 -D__STDC_FORMAT_MACROS=1"
580     LIBS="$LIBS -liphlpapi -lshell32 -lws2_32"
581     transmissionlocaledir="locale"
582     if test -z "$host_alias"; then
583       hostaliaswindres=
584     else
585       hostaliaswindres="$host_alias-windres";
586     fi
587     AC_CHECK_TOOL(WINDRES, windres)
588     ;;
589
590  *darwin*)
591    have_darwin="yes"
592    ;;
593
594esac
595
596AC_ARG_ENABLE([lightweight],
597              AS_HELP_STRING([--enable-lightweight],[optimize libtransmission for low-resource systems: smaller cache size, prefer unencrypted peer connections, etc.]),
598              [enable_lightweight=${enableval}],
599              [enable_lightweight="no"])
600if test "x$enable_lightweight" = "xyes" ; then
601  AC_DEFINE([TR_LIGHTWEIGHT],[1],[optimize libtransmission for low-resource systems])
602fi
603
604AC_ARG_ENABLE([cli],
605              [AS_HELP_STRING([--enable-cli],[build command-line client])],
606              [build_cli=${enableval}],
607              [build_cli="no"])
608AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
609
610AC_ARG_ENABLE([mac],
611              [AS_HELP_STRING([--enable-mac],[build Mac client])],
612              [build_mac=${enableval}],
613              [build_mac=${have_darwin}])
614AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"])
615
616AC_ARG_ENABLE([daemon],
617              [AS_HELP_STRING([--enable-daemon],[build daemon])],
618              [build_daemon=${enableval}],
619              [build_daemon="yes"])
620AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
621
622
623if test "x$build_mac" = "xyes" ; then
624   AC_DEFINE([BUILD_MAC_CLIENT], 1)
625    # Make sure the proper Mac SDK is installed
626    if test ! -d /Developer/SDKs/MacOSX10.5.sdk; then
627      cat << EOF
628You need to install the Mac OS X 10.5 SDK in order to build Transmission
629with --enable-mac:
630  Get your Xcode CD or package
631  Restart the install
632  When it gets to "Installation Type", select "Customize"
633  Select "Mac OS X 10.5 SDK" under "Cross Development"
634  Finish the install.
635EOF
636      exit 1
637    fi
638fi
639AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes")
640
641dnl ----------------------------------------------------------------------------
642dnl
643dnl  Generate the output
644
645AC_CONFIG_FILES([Makefile
646                 transmission-gtk.spec
647                 cli/Makefile
648                 daemon/Makefile
649                 extras/Makefile
650                 libtransmission/Makefile
651                 utils/Makefile
652                 third-party/Makefile
653                 third-party/dht/Makefile
654                 third-party/libb64/Makefile
655                 third-party/libutp/Makefile
656                 third-party/libnatpmp/Makefile
657                 third-party/miniupnp/Makefile
658                 macosx/Makefile
659                 gtk/Makefile
660                 gtk/icons/Makefile
661                 qt/config.pri
662                 web/Makefile
663                 web/images/Makefile
664                 web/style/Makefile
665                 web/style/jqueryui/Makefile
666                 web/style/jqueryui/images/Makefile
667                 web/style/transmission/Makefile
668                 web/style/transmission/images/Makefile
669                 web/style/transmission/images/buttons/Makefile
670                 web/javascript/Makefile
671                 web/javascript/jquery/Makefile
672                 po/Makefile.in])
673
674AC_OUTPUT
675
676echo "
677
678Configuration:
679
680   Source code location:                              ${srcdir}
681   Compiler:                                          ${CXX}
682
683   Build libtransmission:                             yes
684      * optimized for low-resource systems:           ${enable_lightweight}
685      * µTP enabled:                                  ${build_utp}
686      * crypto library:                               ${CRYPTO_PKG}
687
688   Build Command-Line client:                         ${build_cli}
689
690   Build GTK+ client:                                 ${with_gtk}
691      * libappindicator for an Ubuntu-style tray:     ${use_libappindicator}
692
693   Build Daemon:                                      ${build_daemon}
694
695   Build Mac client:                                  ${build_mac}
696
697"
Note: See TracBrowser for help on using the repository browser.