source: trunk/configure.ac @ 12370

Last change on this file since 12370 was 12370, checked in by livings124, 11 years ago

bump to 2.30 beta 3

File size: 16.9 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.30b3])
7m4_define([peer_id_prefix],[-TR222X-])
8
9AC_INIT([transmission],
10        [user_agent_prefix],
11        [http://trac.transmissionbt.com/newticket])
12AC_SUBST(USERAGENT_PREFIX,[user_agent_prefix])
13AC_SUBST(PEERID_PREFIX,[peer_id_prefix])
14
15m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
16
17AC_CONFIG_MACRO_DIR([m4])
18
19dnl AM_CONFIG_HEADER(config.h)
20AC_CONFIG_SRCDIR(libtransmission/transmission.h)
21AM_INIT_AUTOMAKE([1.9 tar-ustar])
22AC_PROG_LIBTOOL
23
24if test m4_substr(peer_id_prefix,6,1) = "0"; then
25  supported_build=yes
26  CPPFLAGS="$CPPFLAGS -DNDEBUG"
27else
28  supported_build=no
29  if test "x$GCC" = "xyes" ; then
30    CFLAGS="$CFLAGS -g -O0"
31    CXXFLAGS="$CXXFLAGS -g -O0"
32  fi
33fi
34AM_CONDITIONAL(TR_UNSTABLE, test "x$supported_build" = "xno")
35
36##
37##
38##   MANDATORY for everything
39##
40##
41CURL_MINIMUM=7.15.4
42AC_SUBST(CURL_MINIMUM)
43LIBEVENT_MINIMUM=2.0.10
44AC_SUBST(LIBEVENT_MINIUM)
45OPENSSL_MINIMUM=0.9.4
46AC_SUBST(OPENSSL_MINIMUM)
47
48##
49##
50##   MANDATORY for the GTK+ client
51##
52##
53GLIB_MINIMUM=2.8.0
54AC_SUBST(GLIB_MINIMUM)
55GTK_MINIMUM=2.8.0
56AC_SUBST(GTK_MINIMUM)
57
58##
59##
60##   OPTIONAL for the GTK+ client
61##
62##
63# play the XDG "download done" sound...
64CANBERRA_MINIMUM=0.10
65AC_SUBST(CANBERRA_MINIMUM)
66# inhibit hibernation when a torrent is active...
67DBUS_GLIB_MINIMUM=0.70
68AC_SUBST(DBUS_GLIB_MINIMUM)
69# register the GTK+ client as a magnet link handler...
70GCONF2_MINIMUM=2.20.0
71AC_SUBST(GCONF2_MINIMUM)
72# implement "watch" directories to use new .torrent files...
73GIO_MINIMUM=2.15.5
74AC_SUBST(GIO_MINIMUM)
75# pop up a "download done" notice...
76LIBNOTIFY_MINIMUM=0.4.3
77AC_SUBST(LIBNOTIFY_MINIMUM)
78# create the tray icon with AppIndicator
79LIBAPPINDICATOR_MINIMUM=0.0.11
80  AC_SUBST(LIBAPPINDICATOR_MINIMUM)
81
82
83AC_PROG_CC
84AC_PROG_CXX
85AC_C_INLINE
86if test "x$GCC" = "xyes" ; then
87
88    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"
89
90    dnl figure out gcc version
91    AC_MSG_CHECKING([gcc version])
92    GCC_VERSION=`$CC -dumpversion`
93    GCC_MAJOR=`echo $GCC_VERSION | cut -d . -f1`
94    GCC_MINOR=`echo $GCC_VERSION | cut -d . -f2`
95    GCC_VERSION_NUM=`(expr $GCC_MAJOR "*" 100 + $GCC_MINOR) 2>/dev/null`
96
97    AC_MSG_RESULT($GCC_VERSION)
98    if test $GCC_VERSION_NUM -ge 304; then
99        dnl these were added in 3.4
100        CFLAGS="$CFLAGS -Wextra -Wdeclaration-after-statement -Winit-self"
101    fi
102    if test $GCC_VERSION_NUM -ge 403; then
103        dnl these were added in 4.3
104        CFLAGS="$CFLAGS -Wvariadic-macros"
105    fi
106fi
107
108AC_HEADER_STDC
109AC_HEADER_TIME
110
111AC_CHECK_HEADERS([stdbool.h])
112AC_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])
113AC_PROG_INSTALL
114AC_PROG_MAKE_SET
115ACX_PTHREAD
116
117if test "x$ac_cv_func_strtold" != "xyes" ; then
118    CPPFLAGS="$CPPFLAGS -Dstrtold=strtod"
119fi
120
121AC_SEARCH_LIBS(cos, [m])
122AC_SEARCH_LIBS([socket], [socket net])
123AC_SEARCH_LIBS([gethostbyname], [nsl bind])
124PKG_CHECK_MODULES(OPENSSL, [openssl >= $OPENSSL_MINIMUM], , [CHECK_SSL()])
125PKG_CHECK_MODULES(LIBCURL, [libcurl >= $CURL_MINIMUM])
126PKG_CHECK_MODULES(LIBEVENT, [libevent >= $LIBEVENT_MINIMUM])
127AC_PATH_ZLIB
128
129AC_SYS_LARGEFILE
130AC_CHECK_FUNCS([lseek64])
131
132
133dnl ----------------------------------------------------------------------------
134dnl
135dnl posix_fadvise
136
137dnl can posix_fadvise be used
138AC_CHECK_DECLS(posix_fadvise, [], [], [
139#define _XOPEN_SOURCE 600
140#include <fcntl.h>])
141AC_CHECK_FUNCS([posix_fadvise])
142
143
144dnl ----------------------------------------------------------------------------
145dnl
146dnl file monitoring for the daemon
147
148AC_CHECK_HEADER([sys/inotify.h],
149                [AC_CHECK_FUNC([inotify_init],[have_inotify="yes"],[have_inotify="no"])],
150                [have_inotify="no"])
151AC_ARG_WITH([inotify],
152            [AS_HELP_STRING([--with-inotify],[Enable inotify support (default=auto)])],
153            [want_inotify=${withval}],
154            [want_inotify=${have_inotify}])
155if test "x$want_inotify" = "xyes" ; then
156    if test "x$have_inotify" = "xyes"; then
157      AC_DEFINE([WITH_INOTIFY],[1])
158    else
159      AC_MSG_ERROR("inotify not found!")
160    fi
161fi
162 
163AC_CHECK_HEADER([sys/event.h],
164                [AC_CHECK_FUNC([kqueue],[have_kqueue="yes"],[have_kqueue="no"])],
165                [have_kqueue="no"])
166AC_ARG_WITH([kqueue],
167            [AS_HELP_STRING([--with-kqueue],[Enable kqueue support (default=auto)])],
168            [want_kqueue=${withval}],
169            [want_kqueue=${have_kqueue}])
170if test "x$want_kqueue" = "xyes" ; then
171    if test "x$have_kqueue" = "xyes"; then
172      AC_DEFINE([WITH_KQUEUE],[1])
173    else
174      AC_MSG_ERROR("kqueue not found!")
175    fi
176fi
177
178AC_CHECK_HEADERS([sys/statvfs.h \
179                  xfs/xfs.h])
180
181
182dnl ----------------------------------------------------------------------------
183dnl
184dnl va_copy
185
186AC_MSG_CHECKING([how to copy va_list])
187AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);],
188    AC_MSG_RESULT([va_copy]),
189        [ AH_TEMPLATE([va_copy], [define if va_copy is not available])
190        AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);],
191        [ AC_DEFINE([va_copy], [__va_copy])
192        AC_MSG_RESULT([__va_copy])],
193        [ AC_DEFINE([va_copy(dest,src)], [memcpy(&dest,&src,sizeof(va_list))])
194        AC_MSG_RESULT([memcpy])]
195    )
196])
197
198
199dnl ----------------------------------------------------------------------------
200dnl
201dnl  dht
202
203DHT_CFLAGS="-I\$(top_srcdir)/third-party/dht"
204DHT_LIBS="\$(top_builddir)/third-party/dht/libdht.a"
205AC_SUBST(DHT_CFLAGS)
206AC_SUBST(DHT_LIBS)
207
208
209dnl ----------------------------------------------------------------------------
210dnl
211dnl  utp
212
213AC_CHECK_LIB([rt],
214             [clock_gettime],
215             [libutp_extra_libs="-lrt"],
216             [libutp_extra_libs=""])
217
218AC_MSG_CHECKING([µTP])
219build_utp="no"
220if test "x$CXX" = "x" ; then
221    have_utp="no"
222else
223    have_utp="yes"
224fi
225AC_ARG_ENABLE([utp],
226              AS_HELP_STRING([--enable-utp],[build µTP support]),
227              [want_utp=${enableval}],
228              [want_utp=${have_utp}])
229if test "x$want_utp" = "xyes" ; then
230    if test "x$have_utp" = "xyes"; then
231        LIBUTP_CFLAGS="-I\$(top_srcdir)/third-party/"
232        LIBUTP_LIBS="\$(top_builddir)/third-party/libutp/libutp.a"
233        if test "x$libutp_extra_libs" != "x" ; then
234           LIBUTP_LIBS="$LIBUTP_LIBS $libutp_extra_libs"
235        fi
236        AC_DEFINE([WITH_UTP],[1])
237        build_utp="yes"
238    else
239      AC_MSG_ERROR("Unable to build uTP support -- C++ compiler not found")
240    fi
241fi
242AC_SUBST(LIBUTP_CFLAGS)
243AC_SUBST(LIBUTP_LIBS)
244AM_CONDITIONAL([BUILD_UTP],[test "x$build_utp" = "xyes"])
245AC_MSG_RESULT([$build_utp])
246
247
248dnl ----------------------------------------------------------------------------
249dnl
250dnl  detection for the GTK+ client
251
252PKG_CHECK_MODULES(GTK,
253                  [gtk+-2.0 >= $GTK_MINIMUM
254                   glib-2.0 >= $GLIB_MINIMUM
255                   gmodule-2.0 >= $GLIB_MINIMUM
256                   gthread-2.0 >= $GLIB_MINIMUM],
257                  [have_gtk=yes],
258                  [have_gtk=no])
259AC_ARG_ENABLE([gtk],
260              AS_HELP_STRING([--enable-gtk],[build gtk client]),
261              [want_gtk=${enableval}],
262              [want_gtk=${have_gtk}])
263build_gtk=no
264use_gio=no
265use_libappindicator=no
266use_libnotify=no
267use_dbus_glib=no
268use_canberra=no
269use_gconf2=no
270if test "x$want_gtk" = "xyes" ; then
271    if test "x$have_gtk" = "xyes"; then
272      build_gtk=yes
273    else
274      AC_MSG_ERROR("GTK+ not found!")
275    fi
276fi
277AM_CONDITIONAL([BUILD_GTK],[test "x$build_gtk" = "xyes"])
278
279if test "x$build_gtk" = "xyes"; then
280
281    PKG_CHECK_MODULES([GIO],
282                      [gio-2.0 >= $GIO_MINIMUM],
283                      [use_gio=yes],
284                      [use_gio=no])
285    if test "x$use_gio" = "xyes"; then
286        AC_DEFINE([HAVE_GIO], 1)
287    fi
288
289    PKG_CHECK_MODULES([LIBNOTIFY],
290                      [libnotify >= $LIBNOTIFY_MINIMUM],
291                      [have_libnotify=yes],
292                      [have_libnotify=no])
293    AC_ARG_ENABLE([libnotify],
294                  AS_HELP_STRING([--enable-libnotify],[enable notifications]),,
295                  [enable_libnotify=yes])
296    use_libnotify=no
297    if test "x$have_libnotify" = "xyes"; then
298        if test "x$enable_libnotify" = "xyes" ; then
299            use_libnotify=yes
300            AC_DEFINE([HAVE_LIBNOTIFY], 1)
301        else
302            LIBNOTIFY_CFLAGS=
303            LIBNOTIFY_LIBS=
304        fi
305    fi
306
307    PKG_CHECK_MODULES([LIBAPPINDICATOR],
308                      [appindicator-0.1 >= $LIBAPPINDICATOR_MINIMUM],
309                      [have_libappindicator=yes],
310                      [have_libappindicator=no])
311
312    AC_ARG_ENABLE([libappindicator],
313                  AS_HELP_STRING([--enable-libappindicator],[enable AppIndicator support]),,
314                  [enable_libappindicator=yes])
315    use_libappindicator=no
316    if test "x$have_libappindicator" = "xyes"; then
317        if test "x$enable_libappindicator" = "xyes" ; then
318            use_libappindicator=yes
319            AC_DEFINE([HAVE_LIBAPPINDICATOR], 1)
320        else
321            LIBAPPINDICATOR_CFLAGS=
322            LIBAPPINDICATOR_LIBS=
323        fi
324    fi
325
326    PKG_CHECK_MODULES([LIBCANBERRA],
327                      [libcanberra-gtk >= $CANBERRA_MINIMUM],
328                      [have_libcanberra=yes],
329                      [have_libcanberra=no])
330    AC_ARG_ENABLE([libcanberra],
331                  AS_HELP_STRING([--enable-libcanberra],[enable sounds]),,
332                  [enable_libcanberra=yes])
333    if test "x$have_libcanberra" = "xyes"; then
334        if test "x$enable_libcanberra" = "xyes" ; then
335            use_canberra=yes
336            AC_DEFINE([HAVE_LIBCANBERRA], 1)
337        else
338            LIBCANBERRA_CFLAGS=
339            LIBCANBERRA_LIBS=
340        fi
341    fi
342
343    PKG_CHECK_MODULES([GCONF2],
344                      [gconf-2.0 >= $GCONF2_MINIMUM],
345                      [have_gconf2=yes],
346                      [have_gconf2=no])
347    AC_ARG_ENABLE([gconf2],
348                  AS_HELP_STRING([--enable-gconf2],[enable GConf support]),,
349                  [enable_gconf2=yes])
350    if test "x$have_gconf2" = "xyes"; then
351        if test "x$enable_gconf2" = "xyes" ; then
352            use_gconf2=yes
353            AC_DEFINE([HAVE_GCONF2], 1)
354        else
355            GCONF2_CFLAGS=
356            GCONF2_LIBS=
357        fi
358    fi
359
360    PKG_CHECK_MODULES([DBUS_GLIB],
361                      [dbus-glib-1 >= $DBUS_GLIB_MINIMUM],
362                      [use_dbus_glib=yes],
363                      [use_dbus_glib=no])
364    if test "x$use_dbus_glib" = "xyes"; then
365        AC_DEFINE([HAVE_DBUS_GLIB], 1)
366    fi
367    if test "x$use_dbus_glib" = "xyes"; then
368        AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool, no)
369        if test "x$DBUS_BINDING_TOOL" = xno; then
370          AC_MSG_WARN([Cannot find dbus-binding-tool])
371          use_dbus_glib="no (dbus-binding-tool not found)"
372        fi
373    fi
374fi
375
376AC_ARG_ENABLE([nls],
377              AS_HELP_STRING([--enable-nls],[enable native language support]),,
378              [enable_nls=yes])
379
380if test "x$build_gtk" = "xyes" -a  "x$enable_nls" = "xno" ; then
381    AC_MSG_ERROR("The gtk client cannot be built without nls support.  Try adding either --enable-nls or --disable-gtk" )
382fi
383
384dnl This section is only used for internationalization.
385dnl If you don't need translations and this section gives you trouble --
386dnl such as if you're building for a headless system --
387dnl it's okay to tear this section out and re-build the configure script.
388dnl
389dnl Note to packagers: the bump to intltool 0.40 was made to fix
390dnl a "make check" failure on some systems.  if upgrading to 0.40 is
391dnl a problem and the old version was working fine for you,
392dnl it should be safe to re-edit 0.40 back down to 0.23
393
394use_nls=no
395if test "x$enable_nls" = "xyes" ; then
396    use_nls=yes
397    IT_PROG_INTLTOOL([0.35.0],[no-xml])
398    AC_CHECK_HEADERS([libintl.h])
399    GETTEXT_PACKAGE=transmission-gtk
400    AC_SUBST(GETTEXT_PACKAGE)
401    AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
402    AM_GLIB_GNU_GETTEXT
403    transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
404    AC_SUBST(transmissionlocaledir)
405fi
406AC_SUBST(INTLLIBS)
407
408
409dnl ----------------------------------------------------------------------------
410dnl
411dnl  platform-specific stuff.
412
413AC_CANONICAL_HOST
414have_darwin="no"
415have_msw="no"
416case $host_os in
417
418   *mingw32*)
419     have_msw="yes"
420     CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
421     CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN"
422     LIBS="$LIBS -liphlpapi -lshell32 -lws2_32"
423     transmissionlocaledir="locale"
424     if test -z "$host_alias"; then
425       hostaliaswindres=
426     else
427       hostaliaswindres="$host_alias-windres";
428     fi
429     AC_CHECK_TOOL(WINDRES, windres)
430     ;;
431
432  *darwin*)
433    have_darwin="yes"
434    CFLAGS="-DMACOSX $CFLAGS"
435    ;;
436
437esac
438
439AC_ARG_ENABLE([lightweight],
440              AS_HELP_STRING([--enable-lightweight],[optimize libtransmission for low-resource systems: smaller cache size, prefer unencrypted peer connections, etc.]),
441              [enable_lightweight=${enableval}],
442              [enable_lightweight="no"])
443if test "x$enable_lightweight" = "xyes" ; then
444  AC_DEFINE([TR_LIGHTWEIGHT],[1],[optimize libtransmission for low-resource systems])
445fi
446
447AC_ARG_ENABLE([cli],
448              [AS_HELP_STRING([--enable-cli],[build command-line client])],
449              [build_cli=${enableval}],
450              [build_cli="yes"])
451AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
452
453AC_ARG_ENABLE([mac],
454              [AS_HELP_STRING([--enable-mac],[build Mac client])],
455              [build_mac=${enableval}],
456              [build_mac=${have_darwin}])
457AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"])
458
459AC_ARG_ENABLE([daemon],
460              [AS_HELP_STRING([--enable-daemon],[build daemon])],
461              [build_daemon=${enableval}],
462              [build_daemon="yes"])
463AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
464
465
466if test "x$build_mac" = "xyes" ; then
467    # Make sure the proper Mac SDK is installed
468    if test ! -d /Developer/SDKs/MacOSX10.5.sdk; then
469      cat << EOF
470You need to install the Mac OS X 10.5 SDK in order to build Transmission
471with --enable-mac:
472  Get your Xcode CD or package
473  Restart the install
474  When it gets to "Installation Type", select "Customize"
475  Select "Mac OS X 10.5 SDK" under "Cross Development"
476  Finish the install.
477EOF
478      exit 1
479    fi
480fi
481if test "x$have_darwin" = "xyes"; then
482    AC_DEFINE([HAVE_DARWIN], 1)
483fi
484if test "x$have_msw" = "xyes"; then
485    AC_DEFINE([HAVE_MSW], 1)
486fi
487AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes")
488
489dnl ----------------------------------------------------------------------------
490dnl
491dnl  Generate the output
492
493AC_CONFIG_FILES([Makefile
494                 transmission-gtk.spec
495                 cli/Makefile
496                 daemon/Makefile
497                 extras/Makefile
498                 libtransmission/Makefile
499                 utils/Makefile
500                 third-party/Makefile
501                 third-party/miniupnp/Makefile
502                 third-party/libnatpmp/Makefile
503                 third-party/libutp/Makefile
504                 third-party/dht/Makefile
505                 macosx/Makefile
506                 gtk/Makefile
507                 gtk/icons/Makefile
508                 web/Makefile
509                 web/images/Makefile
510                 web/images/buttons/Makefile
511                 web/images/graphics/Makefile
512                 web/images/progress/Makefile
513                 web/javascript/Makefile
514                 web/javascript/jquery/Makefile
515                 web/stylesheets/Makefile
516                 po/Makefile.in])
517
518AC_OUTPUT
519
520echo "
521
522Configuration:
523
524   Source code location:                              ${srcdir}
525   Compiler:                                          ${CXX}
526
527   Build libtransmission:                             yes
528
529      * optimized for low-resource systems:           ${enable_lightweight}
530      * µTP enabled:                                  ${build_utp}
531
532   Build Command-Line client:                         ${build_cli}
533
534   Build GTK+ client:                                 ${build_gtk}
535
536     Optional dependencies for GTK+ client:
537
538      * dbus support:                                 ${use_dbus_glib}
539      * gio for watchdir support:                     ${use_gio}
540      * libnotify for 'download completed' popups:    ${use_libnotify}
541      * libcanberra for 'download completed' sounds:  ${use_canberra}
542      * gconf2 to register as a magnet link handler:  ${use_gconf2}
543      * libappindicator for an Ubuntu-style tray:     ${use_libappindicator}
544
545   Build Daemon:                                      ${build_daemon}
546
547   Build Mac client:                                  ${build_mac}
548
549"
Note: See TracBrowser for help on using the repository browser.