source: trunk/configure.ac @ 14472

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

Define one of LFS macros instead of using xxx64 functions directly.

There're too many functions and types to consider, and benefits of not
using LFS macros aren't that big (I was thinking of using fts(3) but
that may not happen soon or at all).

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