source: trunk/configure.ac @ 14534

Last change on this file since 14534 was 14534, checked in by mikedld, 7 years ago

#5851: Don't use _configthreadlocale if not provided by CRT (even if declaration is present)

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.84+])
7m4_define([peer_id_prefix],[-TR284Z-])
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.4
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_open 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_CHECK_HEADER([sys/inotify.h],
208                [AC_CHECK_FUNC([inotify_init],[have_inotify="yes"],[have_inotify="no"])],
209                [have_inotify="no"])
210AC_ARG_WITH([inotify],
211            [AS_HELP_STRING([--with-inotify],[Enable inotify support (default=auto)])],
212            [want_inotify=${withval}],
213            [want_inotify=${have_inotify}])
214if test "x$want_inotify" = "xyes" ; then
215    if test "x$have_inotify" = "xyes"; then
216      AC_DEFINE([WITH_INOTIFY],[1])
217    else
218      AC_MSG_ERROR("inotify not found!")
219    fi
220fi
221
222AC_CHECK_HEADER([sys/event.h],
223                [AC_CHECK_FUNC([kqueue],[have_kqueue="yes"],[have_kqueue="no"])],
224                [have_kqueue="no"])
225AC_ARG_WITH([kqueue],
226            [AS_HELP_STRING([--with-kqueue],[Enable kqueue support (default=auto)])],
227            [want_kqueue=${withval}],
228            [want_kqueue=${have_kqueue}])
229if test "x$want_kqueue" = "xyes" ; then
230    if test "x$have_kqueue" = "xyes"; then
231      AC_DEFINE([WITH_KQUEUE],[1])
232    else
233      AC_MSG_ERROR("kqueue not found!")
234    fi
235fi
236
237AC_CHECK_HEADERS([sys/statvfs.h \
238                  xfs/xfs.h])
239
240
241dnl ----------------------------------------------------------------------------
242dnl
243dnl file monitoring for the daemon
244
245# Check whether to enable systemd startup notification.
246# This requires libsystemd-daemon.
247AC_ARG_WITH([systemd-daemon], AS_HELP_STRING([--with-systemd-daemon],
248            [Add support for systemd startup notification (default is autodetected)]),
249            [USE_SYSTEMD_DAEMON=$withval], [USE_SYSTEMD_DAEMON=auto])
250AS_IF([test "x$USE_SYSTEMD_DAEMON" != "xno"], [
251    PKG_CHECK_MODULES([SYSTEMD_DAEMON], [libsystemd-daemon],
252        [AC_DEFINE(USE_SYSTEMD_DAEMON,1,[Use systemd startup notification])],
253        [AS_IF([test "x$USE_SYSTEMD_DAEMON" = "xyes"],
254            [AC_MSG_ERROR([systemd startup notification support requested, but libsystemd-daemon not found.])]
255        )]
256    )
257])
258
259
260dnl ----------------------------------------------------------------------------
261dnl
262dnl  dht
263
264DHT_CFLAGS="-I\$(top_srcdir)/third-party/dht"
265DHT_LIBS="\$(top_builddir)/third-party/dht/libdht.a"
266DHT_LIBS_QT="\$\${TRANSMISSION_TOP}/third-party/dht/libdht.a"
267build_bundled_dht="yes"
268AC_ARG_ENABLE([external-dht],
269              AS_HELP_STRING([--enable-external-dht],[Use system external-dht]),
270              [want_external_dht=${enableval}],
271              [want_external_dht=no])
272if test "x$want_external_dht" != "xno" ; then
273       dnl Would be lovely if it had pkgconfig
274       DHT_CFLAGS=""
275       DHT_LIBS="-ldht"
276       DHT_LIBS_QT="-ldht"
277       build_bundled_dht="no"
278fi
279
280AM_CONDITIONAL([BUILD_DHT],[test "x$build_bundled_dht" = "xyes"])
281AC_SUBST(DHT_CFLAGS)
282AC_SUBST(DHT_LIBS)
283AC_SUBST(DHT_LIBS_QT)
284
285
286dnl ----------------------------------------------------------------------------
287dnl
288dnl  libb64
289
290LIBB64_CFLAGS="-I\$(top_srcdir)/third-party/libb64"
291LIBB64_LIBS="\$(top_builddir)/third-party/libb64/libb64.a"
292LIBB64_LIBS_QT="\$\${TRANSMISSION_TOP}/third-party/libb64/libb64.a"
293build_bundled_b64="yes"
294AC_ARG_ENABLE([external-b64],
295              AS_HELP_STRING([--enable-external-b64],[Use system libb64]),
296              [want_external_b64=${enableval}],
297              [want_external_b64=no])
298if test "x$want_external_b64" != "xno" ; then
299    LIBB64_CFLAGS="-DUSE_SYSTEM_B64"
300    LIBB64_LIBS="-lb64"
301    LIBB64_LIBS_QT="-lb64"
302    build_bundled_b64="no"
303fi
304
305AM_CONDITIONAL([BUILD_B64],[test "x$build_bundled_b64" = "xyes"])
306AC_SUBST(LIBB64_CFLAGS)
307AC_SUBST(LIBB64_LIBS)
308AC_SUBST(LIBB64_LIBS_QT)
309
310
311dnl ----------------------------------------------------------------------------
312dnl
313dnl  utp
314
315AC_CHECK_LIB([rt],
316             [clock_gettime],
317             [libutp_extra_libs="-lrt"],
318             [libutp_extra_libs=""])
319
320AC_MSG_CHECKING([µTP])
321build_utp="no"
322
323ac_save_LIBS="$LIBS"
324LIBS="-lutp"
325AC_LINK_IFELSE(
326  [AC_LANG_PROGRAM([#include <libutp/utp.h>],
327                   [struct UTPFunctionTable func;])],
328  [have_utp="yes"],
329  [have_utp="no"]
330)
331LIBS="$ac_save_LIBS"
332
333if test "x$have_utp" = "xyes" -o "x$CXX" != "x"; then
334    want_utp_default="yes"
335else
336    want_utp_default="no"
337fi
338
339AC_ARG_ENABLE([utp],
340              AS_HELP_STRING([--enable-utp],[build µTP support]),
341              [want_utp=${enableval}],
342              [want_utp=${want_utp_default}])
343if test "x$want_utp" = "xyes"; then
344    if test "x$have_utp" = "xyes"; then
345        dnl Would be lovely if it had pkgconfig
346        LIBUTP_CFLAGS=""
347        LIBUTP_LIBS="-lutp $libutp_extra_libs"
348        LIBUTP_LIBS_QT="-lutp $libutp_extra_libs"
349        AC_DEFINE([WITH_UTP],[1])
350        build_utp="system"
351    elif test "x$CXX" != "x"; then
352        LIBUTP_CFLAGS="-I\$(top_srcdir)/third-party/"
353        LIBUTP_LIBS="\$(top_builddir)/third-party/libutp/libutp.a"
354        LIBUTP_LIBS_QT="\$\${TRANSMISSION_TOP}/third-party/libutp/libutp.a"
355        if test "x$libutp_extra_libs" != "x" ; then
356            LIBUTP_LIBS="$LIBUTP_LIBS $libutp_extra_libs"
357            LIBUTP_LIBS_QT="$LIBUTP_LIBS_QT $libutp_extra_libs"
358        fi
359        AC_DEFINE([WITH_UTP],[1])
360        build_utp="yes"
361    else
362      AC_MSG_ERROR("Unable to build uTP support -- C++ compiler not found")
363    fi
364fi
365AC_SUBST(LIBUTP_CFLAGS)
366AC_SUBST(LIBUTP_LIBS)
367AC_SUBST(LIBUTP_LIBS_QT)
368AM_CONDITIONAL([BUILD_UTP],[test "x$build_utp" = "xyes"])
369AC_MSG_RESULT([$build_utp])
370
371
372dnl
373dnl  look for preinstalled miniupnpc...
374dnl
375
376ac_save_LIBS="$LIBS"
377LIBS="-lminiupnpc"
378AC_MSG_CHECKING([system miniupnpc library])
379
380dnl See if ANY version of miniupnpc is installed
381AC_LINK_IFELSE(
382  [AC_LANG_PROGRAM([#include <miniupnpc/miniupnpc.h>],
383                   [struct UPNPDev dev;])],
384  [upnp_version="unknown"],
385  [upnp_version="none"]
386)
387
388dnl Let's hope it's 1.7 or higher, since it provides
389dnl MINIUPNPC_API_VERSION and we won't have to figure
390dnl it out on our own
391if test "x$upnp_version" = "xunknown" ; then
392  AC_RUN_IFELSE(
393    [AC_LANG_PROGRAM(
394      [#include <stdlib.h>
395       #include <miniupnpc/miniupnpc.h>],
396      [#ifdef MINIUPNPC_API_VERSION
397       return EXIT_SUCCESS;
398       #else
399       return EXIT_FAILURE;
400       #endif]
401    )],
402    [upnp_version=">= 1.7"]
403  )
404fi
405
406dnl Or maybe it's miniupnp 1.6
407if test "x$upnp_version" = "xunknown" ; then
408  AC_LINK_IFELSE([AC_LANG_PROGRAM([[
409    #include <stdlib.h>
410    #include <errno.h>
411    #include <miniupnpc/miniupnpc.h>
412    #include <miniupnpc/upnpcommands.h>
413  ]], [[
414    struct UPNPDev * devlist;
415    struct UPNPUrls urls;
416    struct IGDdatas data;
417    char lanaddr[16];
418    char portStr[8];
419    char intPort[8];
420    char intClient[16];
421    upnpDiscover( 2000, NULL, NULL, 0, 0, &errno );
422    UPNP_GetValidIGD( devlist, &urls, &data, lanaddr, sizeof( lanaddr ) );
423    UPNP_GetSpecificPortMappingEntry( urls.controlURL, data.first.servicetype,
424                        portStr, "TCP", intClient, intPort, NULL, NULL, NULL );
425  ]])],[
426  AC_DEFINE(MINIUPNPC_API_VERSION, 8, [miniupnpc 1.6 has API version 8])
427  upnp_version="1.6"])
428fi
429
430dnl Or maybe it's miniupnp 1.5
431if test "x$upnp_version" = "xunknown" ; then
432  AC_LINK_IFELSE([AC_LANG_PROGRAM([[
433    #include <stdlib.h>
434    #include <miniupnpc/miniupnpc.h>
435    #include <miniupnpc/upnpcommands.h>
436  ]], [[
437    struct UPNPDev * devlist;
438    struct UPNPUrls urls;
439    struct IGDdatas data;
440    char lanaddr[16];
441    char portStr[8];
442    char intPort[8];
443    char intClient[16];
444    upnpDiscover( 2000, NULL, NULL, 0 );
445    UPNP_GetValidIGD( devlist, &urls, &data, lanaddr, sizeof( lanaddr ) );
446    UPNP_GetSpecificPortMappingEntry( urls.controlURL, data.first.servicetype,
447                        portStr, "TCP", intClient, intPort );
448  ]])],[
449  AC_DEFINE(MINIUPNPC_API_VERSION, 5, [miniupnpc 1.5 has API version 5])
450  upnp_version="1.5"])
451fi
452
453# ... and the results of our tests
454LIBS="$ac_save_LIBS"
455AC_MSG_RESULT([$upnp_version])
456AM_CONDITIONAL([BUILD_MINIUPNP],[test "x$upnp_version" = "xnone"])
457if test "x$upnp_version" = "xnone" ; then
458    LIBUPNP_CFLAGS="-I\$(top_srcdir)/third-party/"
459    LIBUPNP_LIBS="\$(top_builddir)/third-party/miniupnp/libminiupnp.a"
460    LIBUPNP_LIBS_QT="\$\${TRANSMISSION_TOP}/third-party/miniupnp/libminiupnp.a"
461else
462    AC_DEFINE([SYSTEM_MINIUPNP])
463    LIBUPNP_CFLAGS=""
464    LIBUPNP_LIBS="-lminiupnpc"
465    LIBUPNP_LIBS_QT="-lminiupnpc"
466fi
467AC_SUBST(LIBUPNP_CFLAGS)
468AC_SUBST(LIBUPNP_LIBS)
469AC_SUBST(LIBUPNP_LIBS_QT)
470
471
472 
473
474dnl ----------------------------------------------------------------------------
475dnl
476dnl  Allow usage of system natpmp library
477
478LIBNATPMP_CFLAGS="-I\$(top_srcdir)/third-party/libnatpmp/"
479LIBNATPMP_LIBS="\$(top_builddir)/third-party/libnatpmp/libnatpmp.a"
480LIBNATPMP_LIBS_QT="\$\${TRANSMISSION_TOP}/third-party/libnatpmp/libnatpmp.a"
481build_bundled_natpmp="yes"
482AC_ARG_ENABLE([external-natpmp],
483              AS_HELP_STRING([--enable-external-natpmp],[Use system external-natpmp]),
484              [want_external_natpmp=${enableval}],
485              [want_external_natpmp=no])
486if test "x$want_external_natpmp" != "xno" ; then
487        dnl Would be lovely if it had pkgconfig
488        LIBNATPMP_CFLAGS="" 
489        LIBNATPMP_LIBS="-lnatpmp"
490        LIBNATPMP_LIBS_QT="-lnatpmp"
491        build_bundled_natpmp="no"
492fi
493AM_CONDITIONAL([BUILD_NATPMP],[test "x$build_bundled_natpmp" = "xyes"])
494AC_SUBST(LIBNATPMP_CFLAGS)
495AC_SUBST(LIBNATPMP_LIBS)
496AC_SUBST(LIBNATPMP_LIBS_QT)
497
498
499dnl ----------------------------------------------------------------------------
500dnl
501dnl  detection for the GTK+ client
502
503AC_ARG_ENABLE([nls],
504              [AS_HELP_STRING([--enable-nls],[enable native language support])],,
505              [enable_nls=yes])
506PKG_CHECK_EXISTS([gtk+-3.0 >= $GTK_MINIMUM
507                  glib-2.0 >= $GLIB_MINIMUM
508                  gio-2.0 >= $GIO_MINIMUM,
509                  gmodule-2.0 >= $GLIB_MINIMUM
510                  gthread-2.0 >= $GLIB_MINIMUM],
511                 [have_gtk=yes],
512                 [have_gtk=no])
513AC_ARG_WITH([gtk], AS_HELP_STRING([--with-gtk],[with Gtk]),
514            [with_gtk=$withval],
515            [with_gtk=$have_gtk])
516AM_CONDITIONAL([BUILD_GTK],[test "x$with_gtk" = "xyes"])
517use_libappindicator=no
518if test "x$with_gtk" = "xyes" ; then
519
520    if test "x$enable_nls" = "xno" ; then
521        AC_MSG_ERROR("The gtk client cannot be built without nls support.  Try adding either --enable-nls or --without-gtk" )
522    fi
523
524    PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= $GTK_MINIMUM
525                              glib-2.0 >= $GLIB_MINIMUM
526                              gio-2.0 >= $GIO_MINIMUM,
527                              gmodule-2.0 >= $GLIB_MINIMUM
528                              gthread-2.0 >= $GLIB_MINIMUM])
529    PKG_CHECK_MODULES([LIBAPPINDICATOR],
530                      [appindicator3-0.1 >= $LIBAPPINDICATOR_MINIMUM],
531                      [have_libappindicator=yes],
532                      [have_libappindicator=no])
533    if test "x$have_libappindicator" = "xyes"; then
534        use_libappindicator=yes
535        AC_DEFINE([HAVE_LIBAPPINDICATOR], 1)
536    else
537        LIBAPPINDICATOR_CFLAGS=
538        LIBAPPINDICATOR_LIBS=
539    fi
540fi
541
542dnl This section is only used for internationalization.
543dnl If you don't need translations and this section gives you trouble --
544dnl such as if you're building for a headless system --
545dnl it's okay to tear this section out and re-build the configure script.
546dnl
547dnl Note to packagers: the bump to intltool 0.40 was made to fix
548dnl a "make check" failure on some systems.  if upgrading to 0.40 is
549dnl a problem and the old version was working fine for you,
550dnl it should be safe to re-edit 0.40 back down to 0.23
551
552use_nls=no
553if test "x$enable_nls" = "xyes" ; then
554    use_nls=yes
555    m4_ifdef([IT_PROG_INTLTOOL],
556             [IT_PROG_INTLTOOL([0.35.0],[no-xml])],
557             [AC_MSG_ERROR("--enable-nls requires intltool to be installed.")])
558    AC_CHECK_HEADERS([libintl.h])
559    GETTEXT_PACKAGE=transmission-gtk
560    AC_SUBST(GETTEXT_PACKAGE)
561    AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
562    AM_GLIB_GNU_GETTEXT
563    transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
564    AC_SUBST(transmissionlocaledir)
565fi
566AC_SUBST(INTLLIBS)
567
568
569dnl ----------------------------------------------------------------------------
570dnl
571dnl  platform-specific stuff.
572
573AC_CANONICAL_HOST
574have_darwin="no"
575have_msw="no"
576case $host_os in
577
578   *mingw32*)
579     have_msw="yes"
580     CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
581     CPPFLAGS="$CPPFLAGS -DWINVER=0x0600 -D_WIN32_WINNT=0x0600 -DWIN32_LEAN_AND_MEAN"
582     # CPPFLAGS="$CPPFLAGS -D__USE_MINGW_ANSI_STDIO=1 -D__STDC_FORMAT_MACROS=1"
583     LIBS="$LIBS -liphlpapi -lshell32 -lws2_32"
584     transmissionlocaledir="locale"
585     if test -z "$host_alias"; then
586       hostaliaswindres=
587     else
588       hostaliaswindres="$host_alias-windres";
589     fi
590     AC_CHECK_TOOL(WINDRES, windres)
591     ;;
592
593  *darwin*)
594    have_darwin="yes"
595    ;;
596
597esac
598
599AC_ARG_ENABLE([lightweight],
600              AS_HELP_STRING([--enable-lightweight],[optimize libtransmission for low-resource systems: smaller cache size, prefer unencrypted peer connections, etc.]),
601              [enable_lightweight=${enableval}],
602              [enable_lightweight="no"])
603if test "x$enable_lightweight" = "xyes" ; then
604  AC_DEFINE([TR_LIGHTWEIGHT],[1],[optimize libtransmission for low-resource systems])
605fi
606
607AC_ARG_ENABLE([cli],
608              [AS_HELP_STRING([--enable-cli],[build command-line client])],
609              [build_cli=${enableval}],
610              [build_cli="yes"])
611AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
612
613AC_ARG_ENABLE([mac],
614              [AS_HELP_STRING([--enable-mac],[build Mac client])],
615              [build_mac=${enableval}],
616              [build_mac=${have_darwin}])
617AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"])
618
619AC_ARG_ENABLE([daemon],
620              [AS_HELP_STRING([--enable-daemon],[build daemon])],
621              [build_daemon=${enableval}],
622              [build_daemon="yes"])
623AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
624
625
626if test "x$build_mac" = "xyes" ; then
627   AC_DEFINE([BUILD_MAC_CLIENT], 1)
628    # Make sure the proper Mac SDK is installed
629    if test ! -d /Developer/SDKs/MacOSX10.5.sdk; then
630      cat << EOF
631You need to install the Mac OS X 10.5 SDK in order to build Transmission
632with --enable-mac:
633  Get your Xcode CD or package
634  Restart the install
635  When it gets to "Installation Type", select "Customize"
636  Select "Mac OS X 10.5 SDK" under "Cross Development"
637  Finish the install.
638EOF
639      exit 1
640    fi
641fi
642AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes")
643
644dnl ----------------------------------------------------------------------------
645dnl
646dnl  Generate the output
647
648AC_CONFIG_FILES([Makefile
649                 transmission-gtk.spec
650                 cli/Makefile
651                 daemon/Makefile
652                 extras/Makefile
653                 libtransmission/Makefile
654                 utils/Makefile
655                 third-party/Makefile
656                 third-party/dht/Makefile
657                 third-party/libb64/Makefile
658                 third-party/libutp/Makefile
659                 third-party/libnatpmp/Makefile
660                 third-party/miniupnp/Makefile
661                 macosx/Makefile
662                 gtk/Makefile
663                 gtk/icons/Makefile
664                 qt/config.pri
665                 web/Makefile
666                 web/images/Makefile
667                 web/style/Makefile
668                 web/style/jqueryui/Makefile
669                 web/style/jqueryui/images/Makefile
670                 web/style/transmission/Makefile
671                 web/style/transmission/images/Makefile
672                 web/style/transmission/images/buttons/Makefile
673                 web/javascript/Makefile
674                 web/javascript/jquery/Makefile
675                 po/Makefile.in])
676
677AC_OUTPUT
678
679echo "
680
681Configuration:
682
683   Source code location:                              ${srcdir}
684   Compiler:                                          ${CXX}
685
686   Build libtransmission:                             yes
687      * optimized for low-resource systems:           ${enable_lightweight}
688      * µTP enabled:                                  ${build_utp}
689      * crypto library:                               ${CRYPTO_PKG}
690
691   Build Command-Line client:                         ${build_cli}
692
693   Build GTK+ client:                                 ${with_gtk}
694      * libappindicator for an Ubuntu-style tray:     ${use_libappindicator}
695
696   Build Daemon:                                      ${build_daemon}
697
698   Build Mac client:                                  ${build_mac}
699
700"
Note: See TracBrowser for help on using the repository browser.