source: trunk/configure.ac @ 14168

Last change on this file since 14168 was 14168, checked in by jordan, 8 years ago

bump trunk to 2.82+

File size: 17.5 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.82+])
7m4_define([peer_id_prefix],[-TR282Z-])
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
21
22if test m4_substr(peer_id_prefix,6,1) = "0"; then
23  supported_build=yes
24  CPPFLAGS="$CPPFLAGS -DNDEBUG"
25else
26  supported_build=no
27  if test "x$GCC" = "xyes" ; then
28    CFLAGS="$CFLAGS -g -O0"
29    CXXFLAGS="$CXXFLAGS -g -O0"
30  fi
31fi
32AM_CONDITIONAL(TR_UNSTABLE, test "x$supported_build" = "xno")
33
34##
35##
36##   MANDATORY for everything
37##
38##
39CURL_MINIMUM=7.15.4
40AC_SUBST(CURL_MINIMUM)
41LIBEVENT_MINIMUM=2.0.10
42AC_SUBST(LIBEVENT_MINIMUM)
43OPENSSL_MINIMUM=0.9.4
44AC_SUBST(OPENSSL_MINIMUM)
45
46##
47##
48##   MANDATORY for the GTK+ client
49##
50##
51
52GTK_MINIMUM=3.4.0
53AC_SUBST(GTK_MINIMUM)
54GLIB_MINIMUM=2.32.0
55AC_SUBST(GLIB_MINIMUM)
56GIO_MINIMUM=2.26.0
57AC_SUBST(GIO_MINIMUM)
58
59##
60##
61##   OPTIONAL for the GTK+ client
62##
63##
64
65# create the tray icon with AppIndicator
66LIBAPPINDICATOR_MINIMUM=0.4.90
67AC_SUBST(LIBAPPINDICATOR_MINIMUM)
68
69
70AC_PROG_CC
71AC_PROG_CXX
72if 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])
75    HAVE_CXX="yes"
76    AC_MSG_RESULT([$HAVE_CXX])
77  else
78    AC_CHECK_PROG([HAVE_CXX],[$CXX],[yes],[no])
79  fi
80fi
81AC_C_INLINE
82if test "x$GCC" = "xyes" ; then
83
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"
85
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`
92
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"
97    fi
98    if test $GCC_VERSION_NUM -ge 403; then
99        dnl these were added in 4.3
100        CFLAGS="$CFLAGS -Wvariadic-macros"
101    fi
102fi
103
104AC_HEADER_STDC
105AC_HEADER_TIME
106
107AC_CHECK_HEADERS([stdbool.h])
108AC_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])
109AC_PROG_INSTALL
110AC_PROG_MAKE_SET
111ACX_PTHREAD
112
113if test "x$ac_cv_func_strtold" != "xyes" ; then
114    CPPFLAGS="$CPPFLAGS -Dstrtold=strtod"
115fi
116
117AC_SEARCH_LIBS(cos, [m])
118AC_SEARCH_LIBS([socket], [socket net])
119AC_SEARCH_LIBS([gethostbyname], [nsl bind])
120PKG_CHECK_MODULES(OPENSSL, [openssl >= $OPENSSL_MINIMUM], , [CHECK_SSL()])
121PKG_CHECK_MODULES(LIBCURL, [libcurl >= $CURL_MINIMUM])
122PKG_CHECK_MODULES(LIBEVENT, [libevent >= $LIBEVENT_MINIMUM])
123AC_PATH_ZLIB
124
125AC_SYS_LARGEFILE
126AC_CHECK_FUNCS([lseek64])
127
128AC_FUNC_GETMNTENT
129
130dnl ----------------------------------------------------------------------------
131dnl
132dnl posix_fadvise
133
134dnl can posix_fadvise be used
135AC_CHECK_DECLS(posix_fadvise, [], [], [
136#define _XOPEN_SOURCE 600
137#include <fcntl.h>])
138AC_CHECK_FUNCS([posix_fadvise])
139
140
141dnl ----------------------------------------------------------------------------
142dnl
143dnl file monitoring for the daemon
144
145AC_CHECK_HEADER([sys/inotify.h],
146                [AC_CHECK_FUNC([inotify_init],[have_inotify="yes"],[have_inotify="no"])],
147                [have_inotify="no"])
148AC_ARG_WITH([inotify],
149            [AS_HELP_STRING([--with-inotify],[Enable inotify support (default=auto)])],
150            [want_inotify=${withval}],
151            [want_inotify=${have_inotify}])
152if test "x$want_inotify" = "xyes" ; then
153    if test "x$have_inotify" = "xyes"; then
154      AC_DEFINE([WITH_INOTIFY],[1])
155    else
156      AC_MSG_ERROR("inotify not found!")
157    fi
158fi
159
160AC_CHECK_HEADER([sys/event.h],
161                [AC_CHECK_FUNC([kqueue],[have_kqueue="yes"],[have_kqueue="no"])],
162                [have_kqueue="no"])
163AC_ARG_WITH([kqueue],
164            [AS_HELP_STRING([--with-kqueue],[Enable kqueue support (default=auto)])],
165            [want_kqueue=${withval}],
166            [want_kqueue=${have_kqueue}])
167if test "x$want_kqueue" = "xyes" ; then
168    if test "x$have_kqueue" = "xyes"; then
169      AC_DEFINE([WITH_KQUEUE],[1])
170    else
171      AC_MSG_ERROR("kqueue not found!")
172    fi
173fi
174
175AC_CHECK_HEADERS([sys/statvfs.h \
176                  xfs/xfs.h])
177
178
179dnl ----------------------------------------------------------------------------
180dnl
181dnl file monitoring for the daemon
182
183# Check whether to enable systemd startup notification.
184# This requires libsystemd-daemon.
185AC_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])
188AS_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.])]
193        )]
194    )
195])
196
197
198dnl ----------------------------------------------------------------------------
199dnl
200dnl  dht
201
202DHT_CFLAGS="-I\$(top_srcdir)/third-party/dht"
203DHT_LIBS="\$(top_builddir)/third-party/dht/libdht.a"
204AC_SUBST(DHT_CFLAGS)
205AC_SUBST(DHT_LIBS)
206
207
208dnl ----------------------------------------------------------------------------
209dnl
210dnl  utp
211
212AC_CHECK_LIB([rt],
213             [clock_gettime],
214             [libutp_extra_libs="-lrt"],
215             [libutp_extra_libs=""])
216
217AC_MSG_CHECKING([µTP])
218build_utp="no"
219if test "x$HAVE_CXX" = "xyes" ; then
220    have_utp="yes"
221else
222    have_utp="no"
223fi
224AC_ARG_ENABLE([utp],
225              AS_HELP_STRING([--enable-utp],[build µTP support]),
226              [want_utp=${enableval}],
227              [want_utp=${have_utp}])
228if 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"
236        fi
237        AC_DEFINE([WITH_UTP],[1])
238        build_utp="yes"
239    else
240      AC_MSG_ERROR("Unable to build uTP support -- C++ compiler not found")
241    fi
242fi
243AC_SUBST(LIBUTP_CFLAGS)
244AC_SUBST(LIBUTP_LIBS)
245AC_SUBST(LIBUTP_LIBS_QT)
246AM_CONDITIONAL([BUILD_UTP],[test "x$build_utp" = "xyes"])
247AC_MSG_RESULT([$build_utp])
248
249
250dnl
251dnl  look for preinstalled miniupnpc...
252dnl
253
254AC_MSG_CHECKING([supported miniupnp library])
255upnp_version="none"
256ac_save_LIBS="$LIBS"
257LIBS="-lminiupnpc"
258# See if the OS has its miniupnp 1.5 installed
259AC_LINK_IFELSE([AC_LANG_PROGRAM([[
260    #include <stdlib.h>
261    #include <miniupnpc/miniupnpc.h>
262    #include <miniupnpc/upnpcommands.h>
263]], [[
264    struct UPNPDev * devlist;
265    struct UPNPUrls    urls;
266    struct IGDdatas    data;
267    char lanaddr[16];
268    char portStr[8];
269    char intPort[8];
270    char intClient[16];
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 );
275]])],[
276AC_DEFINE(HAVE_MINIUPNP_15, 1, [Define to 1 if you have miniupnpc version 1.5])
277upnp_version="1.5"],[])
278
279# See if the OS has its miniupnp 1.6 installed
280AC_LINK_IFELSE([AC_LANG_PROGRAM([[
281    #include <stdlib.h>
282    #include <errno.h>
283    #include <miniupnpc/miniupnpc.h>
284    #include <miniupnpc/upnpcommands.h>
285]], [[
286    struct UPNPDev * devlist;
287    struct UPNPUrls    urls;
288    struct IGDdatas    data;
289    char lanaddr[16];
290    char portStr[8];
291    char intPort[8];
292    char intClient[16];
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 );
297]])],[
298AC_DEFINE(HAVE_MINIUPNP_16, 1, [Define to 1 if you have miniupnpc version 1.6])
299upnp_version="1.6"],[])
300
301# ... and the results of our tests
302LIBS="$ac_save_LIBS"
303AC_MSG_RESULT([$upnp_version])
304AM_CONDITIONAL([BUILD_MINIUPNP],[test "x$upnp_version" = "xnone"])
305if 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])
311else
312    AC_DEFINE([SYSTEM_MINIUPNP])
313    LIBUPNP_CFLAGS=""
314    LIBUPNP_LIBS="-lminiupnpc"
315    LIBUPNP_LIBS_QT="-lminiupnpc"
316fi
317AC_SUBST(LIBUPNP_CFLAGS)
318AC_SUBST(LIBUPNP_LIBS)
319AC_SUBST(LIBUPNP_LIBS_QT)
320
321
322 
323
324dnl ----------------------------------------------------------------------------
325dnl
326dnl  Allow usage of system natpmp library
327
328LIBNATPMP_CFLAGS="-I\$(top_srcdir)/third-party/libnatpmp/"
329LIBNATPMP_LIBS="\$(top_builddir)/third-party/libnatpmp/libnatpmp.a"
330LIBNATPMP_LIBS_QT="\$\${TRANSMISSION_TOP}/third-party/libnatpmp/libnatpmp.a"
331build_bundled_natpmp="yes"
332AC_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])
336if test "x$want_external_natpmp" != "xno" ; then
337        dnl Would be lovely if it had pkgconfig
338        LIBNATPMP_CFLAGS="" 
339        LIBNATPMP_LIBS="-lnatpmp"
340        LIBNATPMP_LIBS_QT="-lnatpmp"
341        build_bundled_natpmp="no"
342fi
343AM_CONDITIONAL([BUILD_NATPMP],[test "x$build_bundled_natpmp" = "xyes"])
344AC_SUBST(LIBNATPMP_CFLAGS)
345AC_SUBST(LIBNATPMP_LIBS)
346AC_SUBST(LIBNATPMP_LIBS_QT)
347
348
349dnl ----------------------------------------------------------------------------
350dnl
351dnl  detection for the GTK+ client
352
353AC_ARG_ENABLE([nls],
354              [AS_HELP_STRING([--enable-nls],[enable native language support])],,
355              [enable_nls=yes])
356PKG_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],
361                 [have_gtk=yes],
362                 [have_gtk=no])
363AC_ARG_WITH([gtk], AS_HELP_STRING([--with-gtk],[with Gtk]),
364            [with_gtk=$withval],
365            [with_gtk=$have_gtk])
366AM_CONDITIONAL([BUILD_GTK],[test "x$with_gtk" = "xyes"])
367use_libappindicator=no
368if test "x$with_gtk" = "xyes" ; then
369
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" )
372    fi
373
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)
386    else
387        LIBAPPINDICATOR_CFLAGS=
388        LIBAPPINDICATOR_LIBS=
389    fi
390fi
391
392dnl This section is only used for internationalization.
393dnl If you don't need translations and this section gives you trouble --
394dnl such as if you're building for a headless system --
395dnl it's okay to tear this section out and re-build the configure script.
396dnl
397dnl Note to packagers: the bump to intltool 0.40 was made to fix
398dnl a "make check" failure on some systems.  if upgrading to 0.40 is
399dnl a problem and the old version was working fine for you,
400dnl it should be safe to re-edit 0.40 back down to 0.23
401
402use_nls=no
403if test "x$enable_nls" = "xyes" ; then
404    use_nls=yes
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])
412    AM_GLIB_GNU_GETTEXT
413    transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
414    AC_SUBST(transmissionlocaledir)
415fi
416AC_SUBST(INTLLIBS)
417
418
419dnl ----------------------------------------------------------------------------
420dnl
421dnl  platform-specific stuff.
422
423AC_CANONICAL_HOST
424have_darwin="no"
425have_msw="no"
426case $host_os in
427
428   *mingw32*)
429     have_msw="yes"
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
435       hostaliaswindres=
436     else
437       hostaliaswindres="$host_alias-windres";
438     fi
439     AC_CHECK_TOOL(WINDRES, windres)
440     ;;
441
442  *darwin*)
443    have_darwin="yes"
444    CFLAGS="-DMACOSX $CFLAGS"
445    ;;
446
447esac
448
449AC_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"])
453if test "x$enable_lightweight" = "xyes" ; then
454  AC_DEFINE([TR_LIGHTWEIGHT],[1],[optimize libtransmission for low-resource systems])
455fi
456
457AC_ARG_ENABLE([cli],
458              [AS_HELP_STRING([--enable-cli],[build command-line client])],
459              [build_cli=${enableval}],
460              [build_cli="yes"])
461AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
462
463AC_ARG_ENABLE([mac],
464              [AS_HELP_STRING([--enable-mac],[build Mac client])],
465              [build_mac=${enableval}],
466              [build_mac=${have_darwin}])
467AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"])
468
469AC_ARG_ENABLE([daemon],
470              [AS_HELP_STRING([--enable-daemon],[build daemon])],
471              [build_daemon=${enableval}],
472              [build_daemon="yes"])
473AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
474
475
476if 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
479      cat << EOF
480You need to install the Mac OS X 10.5 SDK in order to build Transmission
481with --enable-mac:
482  Get your Xcode CD or package
483  Restart the install
484  When it gets to "Installation Type", select "Customize"
485  Select "Mac OS X 10.5 SDK" under "Cross Development"
486  Finish the install.
487EOF
488      exit 1
489    fi
490fi
491if test "x$have_darwin" = "xyes"; then
492    AC_DEFINE([HAVE_DARWIN], 1)
493    AC_DEFINE([SYS_DARWIN], 1)
494fi
495if test "x$have_msw" = "xyes"; then
496    AC_DEFINE([HAVE_MSW], 1)
497fi
498AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes")
499
500dnl ----------------------------------------------------------------------------
501dnl
502dnl  Generate the output
503
504AC_CONFIG_FILES([Makefile
505                 transmission-gtk.spec
506                 cli/Makefile
507                 daemon/Makefile
508                 extras/Makefile
509                 libtransmission/Makefile
510                 utils/Makefile
511                 third-party/Makefile
512                 third-party/dht/Makefile
513                 third-party/libutp/Makefile
514                 third-party/libnatpmp/Makefile
515                 third-party/miniupnp/Makefile
516                 macosx/Makefile
517                 gtk/Makefile
518                 gtk/icons/Makefile
519                 qt/config.pri
520                 web/Makefile
521                 web/images/Makefile
522                 web/style/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
530                 po/Makefile.in])
531
532AC_OUTPUT
533
534echo "
535
536Configuration:
537
538   Source code location:                              ${srcdir}
539   Compiler:                                          ${CXX}
540
541   Build libtransmission:                             yes
542      * optimized for low-resource systems:           ${enable_lightweight}
543      * µTP enabled:                                  ${build_utp}
544
545   Build Command-Line client:                         ${build_cli}
546
547   Build GTK+ client:                                 ${with_gtk}
548      * libappindicator for an Ubuntu-style tray:     ${use_libappindicator}
549
550   Build Daemon:                                      ${build_daemon}
551
552   Build Mac client:                                  ${build_mac}
553
554"
Note: See TracBrowser for help on using the repository browser.